Category Theory for All (NASSLLI 2012)
Upcoming SlideShare
Loading in...5
×
 

Category Theory for All (NASSLLI 2012)

on

  • 1,124 views

Preliminary, very preliminary slides.

Preliminary, very preliminary slides.

Statistics

Views

Total Views
1,124
Views on SlideShare
1,124
Embed Views
0

Actions

Likes
1
Downloads
44
Comments
1

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Category Theory for All (NASSLLI 2012) Category Theory for All (NASSLLI 2012) Presentation Transcript

    • Category Theory for All: a logicians perspective Valeria de Paiva NASSLLI2012 June, 2012Valeria de Paiva (NASSLLI2012) June, 2012 1 / 113
    • OutlineOutline1 Interested in Category Theory?2 Categories, Functors and Natural Transformations3 Adjunctions4 Deductive Systems as Categories5 A taste of Glue Semantics?...Valeria de Paiva (NASSLLI2012) June, 2012 2 / 113
    • Interested in Category Theory?IntroductionCategory theory is a relatively new branch of mathematics that keepsappearing in texts of computational semantics, on the syntax-semanticsinterface and even on material on pure syntax.It also is very proeminent on the literature on Functional Programming, inthe theory of specications and even on some discussions on databases.Thirdly it has become familiar in texts for physicists, especially the onesinterested in Quantum stu.Category theory is simple, but requires an investment of time to get overthe initial barrier of language, hence it seems an ideal subject to be taughtat NASSLLI. There are two ways to do great mathematics. The rst way is to be smarter than everybody else. The second way is to be stupider than everybody else  but persistent."  Raoul BottValeria de Paiva (NASSLLI2012) June, 2012 3 / 113
    • Interested in Category Theory?A little bit of personal history...Some twenty years ago I nished my PhD thesis "The DialecticaCategories" in Cambridge. My supervisor was Dr Martin Hyland.Valeria de Paiva (NASSLLI2012) June, 2012 4 / 113
    • Interested in Category Theory?Dialectica categories come from Gödels DialecticaInterpretationThe interpretation is named after the Swiss journal Dialectica where itappeared in a special volume dedicated to Paul Bernays 70th birthday in1958.I was originally trying to provide an internal categorical model of theDialectica Interpretation. The categories I came up with proved (also) tobe a model of Linear Logic...Valeria de Paiva (NASSLLI2012) June, 2012 5 / 113
    • Interested in Category Theory?Dialectica categories are models of Linear LogicLinear Logic (LL) introduced by Girard (1987): [...]linear logic comes froma proof-theoretic analysis of usual logic.LL the best of both worlds, the dualities of classical logic plus theconstructive content of proofs of intuitionistic logic.Dialectica categories are a cool model of LL, still one of the best around...Valeria de Paiva (NASSLLI2012) June, 2012 6 / 113
    • Interested in Category Theory?From Linear Logic to Semantics of Natural LanguageMany linguists became interested in Linear Logic because its aresource-conscious logic.I became interested in Linguistics because of Linear Logic and itsprogramme of proofs as rst class objects.Valeria de Paiva (NASSLLI2012) June, 2012 7 / 113
    • Interested in Category Theory?From Linear Logic to Linear Functional ProgrammingI also became interested in Functional Programing because of Linear Logicand its programme of proofs as rst class objects.Valeria de Paiva (NASSLLI2012) June, 2012 8 / 113
    • Interested in Category Theory?Proofs as rst class objects?Programme to elevate the status of proofs to rst class logical objects.Instead of asking `when is a formula A true, we ask `what is a proof of A?Using Freges distinction between sense and denotation:proofs are the senses of logical formulas,whose denotations might be truth values.Sometimes I call this programme Proof Semantics.sometimes I call it Categorical Proof Theory (because the semantics of proofsare given in terms of natural constructions in Category Theory).Valeria de Paiva (NASSLLI2012) June, 2012 9 / 113
    • Interested in Category Theory?The Challenges of Proof Semantics...There is a problem with viewing proofs as logical objects:We do not have direct access to proofs.Only to syntactic representations of them, in the form of derivations insome proof system (e.g. axiomatic, natural deduction or sequent calculus).Syntactic derivations are awed means of accessing the underlying proofobjects. The syntax can introduce spurious dierences between derivationsthat do not correspond to dierences in the underlying proofs; it can alsomask dierences that really are there.Semantics of proofs is what categorical logic is about.Our category theory will be directed towards proof semantics.Valeria de Paiva (NASSLLI2012) June, 2012 10 / 113
    • Interested in Category Theory?Things I hope you know...We will assume some familiarity with rst-order predicate calculus, arudimentary knowledge of the lambda-calculus and type theory, and a basicidea of what logical inference is about.If you have an intuitive understanding what the following means I thinkyoull be ne. ∀x. man(x) → mortal(x), man(john) mortal(john) λx.see(x, john) (f red) ≡β see(f red, john)If you have done a basic course in abstract algebra, linear algebra orgroups, then you should be in really good shape.Valeria de Paiva (NASSLLI2012) June, 2012 11 / 113
    • Interested in Category Theory?What is Categorical Logic? Traditionally mathematical logic divided into four areas:proof theorymodel theory,recursion theoryand set theory.A trend towards adding `Complexity to the four basic areas.Categorical logic means dierent things to dierent people.In this course we will mean categorical `proof theory.Valeria de Paiva (NASSLLI2012) June, 2012 12 / 113
    • Interested in Category Theory?What is Categorical Proof Theory?Proof theory using categorical models instead of Sets-based models...Logic could be rst-order, but it will be propositional only.Classical logic poses some problems, discussed later on.We deal with propositional intuitionistic logic IPL.For this course this means that we need to consider three independentconnectives: conjunction (A ∧ B ), disjunction (A ∨ B) and implication(A → B ).These are not interdenable, so some of the usual classical rules (e.g.A → B ∼ ¬A ∨ B ) = are not valid.Valeria de Paiva (NASSLLI2012) June, 2012 13 / 113
    • Interested in Category Theory?The quest for proofs...Traditional proof theory, to the extent that it relies on models usesalgebraic structures such as Boolean algebras, Heyting algebras or Kripkemodels of several styles.These models lose one important dimension. In these models dierentproofs are not represented at all.Provability, the fact that Γ a collection of premisses A1 , . . . , A k entails A,is represented by the less or equal ≤ relation in the model.This does not give us a way of representing the proofs themselves. We onlyknow if a proof exists Γ≤A or not. All proofs are collapsed into theexistence of this relation.Valeria de Paiva (NASSLLI2012) June, 2012 14 / 113
    • Interested in Category Theory?The quest for proofs...By contrast in categorical proof theory we think and write a proof as Γ →f Awhere f is the reason why we can deduce A from Γ, a name for the proofwe are thinking of. Thus we can observe and name and compare dierentderivations. Which means that we can see subtle dierences in the logics.Valeria de Paiva (NASSLLI2012) June, 2012 15 / 113
    • Interested in Category Theory?Constructive perspective: not much of one...This course is not about the deep philosophical questions of the foundationsof mathematics. We will side-step every philosophical issue that we can.(It is not that these issues are not interesting. They are. It is just that Idont think I can enlighten anyone much on them.)Caveat emptor Whether you believe or not that there is a single logic thatis the correct one, applications (especially in CS) have provided us withempirical evidence that there are several logical systems that are convenientfor use in specic contexts.When studying these contexts and applications it pays to keep aconstructive viewpoint. If classical logic turns out to be necessary, we willpragmatically use it and ag its use.Commmitment to intuitionistic principles is a matter of pragmatic choice:It is easier to be intuitionistic and then if need arises to become classicthan the other way round. Moreover its safer: intuitionistic principles areaccepted by all...Valeria de Paiva (NASSLLI2012) June, 2012 16 / 113
    • Interested in Category Theory?The real point of this course...Valeria de Paiva (NASSLLI2012) June, 2012 17 / 113
    • Interested in Category Theory?Edwardian proofs for futuristic programs...Valeria de Paiva (NASSLLI2012) June, 2012 18 / 113
    • Interested in Category Theory?Introductions to category theory?...There are many. check out logic-forall for links.S. Mac Lane, Categories for the Working Mathematician (1971, 1998)J.-Y. Girard, Y. Lafont, P. Taylor, Proofs and Types (1989)M. Barr, C. Wells, Category Theory for Computer Science (1995)B.C. Pierce, Basic Category Theory for Computer Science (1991)R. Blute P. Scott, Category Theory for Linear Logicians (2003)F.W. Lawvere, S.H. Schanuel, Conceptual Mathematics (1997)Abramsky,Tzevelekos, Introduction to Cats and Categorical Logic (2010)S. Awodey, Category Theory, (2010).H. Simmons, An Introduction to Category Theory, (2011)V. de Paiva, Categorical Proof Theory and Linear Logic (1996)Blog http://logic-forall.blogspot.com/Valeria de Paiva (NASSLLI2012) June, 2012 19 / 113
    • Interested in Category Theory?More Introductions...M. Johansson, Category Theory and Functional Programming, StanfordFALL 2009, and St. Andrews 2012also Chalmers discussion group:G. Hutton, Introduction to Category Theory , Midlands Grad School, 2012D. Verity, An Introduction to Category Theory - FP-Syd talk,E. Cheng, The Catstars YouTube channel,J. van Oosten, Basic Category Theory, 2002,L. Maertens, Category Theory for Program Construction. ESSLLI (1995)Benton, Bierman, Hyland and de Paiva, Term Assignment for IntuitionisticLinear Logic, 1992.Valeria de Paiva (NASSLLI2012) June, 2012 20 / 113
    • Interested in Category Theory?Elements of category theory...Meant to imply that we will discuss and do exercises on some basicconcepts. necessary for categorical proof theory, in the restricted senseabove.No promisses of completeness of building blocks...Basic concepts we intend to cover: categories, functors, natural transformations products, pullbacks, equalizers, initial and terminal objects adjunctions and monoidal closure Yoneda Lemma (monads, algebras, coalgebras and comonads?)Valeria de Paiva (NASSLLI2012) June, 2012 21 / 113
    • Categories, Functors and Natural TransformationsDenition of a CategoryA category C consists of a collection of objects (A, B, . . .) and a collectionof morphisms (or maps) from A to B (written asf : A → B ) satisfyingthree easy conditions:1. Given maps f : A → B and g : B → C such that the codomain of f isequal to the domain of g , there is an operation of composition ofmorphisms, which produces a map f ; g : A → C .2. The composition operation is associative, ie. f ; (g; h) = (f ; g); h.3. For each object A in the category we have an associated identitymorphism idA : A → A such that if f : A → B is any map in the category,then idA ; f = f = f ; idB .Note on `writing composition: mathematicians usually write g◦f for whatI mostly write as f ; g. Use whatever you like, and have a scratchpad nearbyto check it out...Valeria de Paiva (NASSLLI2012) June, 2012 22 / 113
    • Categories, Functors and Natural TransformationsThe Denition of CategoryValeria de Paiva (NASSLLI2012) June, 2012 23 / 113
    • Categories, Functors and Natural TransformationsThe Denition of CategoryValeria de Paiva (NASSLLI2012) June, 2012 24 / 113
    • Categories, Functors and Natural TransformationsExamples of CategoriesValeria de Paiva (NASSLLI2012) June, 2012 25 / 113
    • Categories, Functors and Natural TransformationsExamples of CategoriesValeria de Paiva (NASSLLI2012) June, 2012 26 / 113
    • Categories, Functors and Natural TransformationsExamples of kinds of CategoriesValeria de Paiva (NASSLLI2012) June, 2012 27 / 113
    • Categories, Functors and Natural TransformationsExamples of CategoriesValeria de Paiva (NASSLLI2012) June, 2012 28 / 113
    • Categories, Functors and Natural TransformationsExamples of CategoriesThe category of Sets and usual functions is the paradigmatic example.Maybe its too intuitive.A good example to show the dierence between morphisms and functions isthe category Rel of sets and relations.Easy mathematical examples:Groups and homomorphisms,vector spaces and linear transformations,monoids and monoid homomorphisms.More complicated example: topological spaces and continuous maps.Valeria de Paiva (NASSLLI2012) June, 2012 29 / 113
    • Categories, Functors and Natural TransformationsExamples of Categories: MonoidsA monoid M is a set with a `multiplication-like operation and one identity,say the element e. So M = (M, ·, e) where ·: M × M → M is such thatm1 · (m2 · m3 ) = (m1 · m2 ) · m3 and m· e = m = e · mEasy mathematical examples:(N, +, 0) integers under addition,(R, ×, 1) reals under multiplicationmatrices under multiplication of matrices (Matn , ·, In )strings over alphabet {0, 1}, under concatenation, (String, ·, λ).Valeria de Paiva (NASSLLI2012) June, 2012 30 / 113
    • Categories, Functors and Natural TransformationsTwo extreme examplesThe empty category (writen as 0), which has no objects nor morphisms.(Just a parallel concept to the empty set.)The singleton category (written as 1), which has a single object and asingle morphism, which is the identity on the single object.Valeria de Paiva (NASSLLI2012) June, 2012 31 / 113
    • Categories, Functors and Natural TransformationsWhy Categories?Category theory (CT) is a convenient new languageIt puts existing mathematical results into perspectiveIt gives an appreciation of the unity of modern mathematicsAs a language, it oers economy of thought and expressionReveals common ideas in (apparently) unrelated areas of mathematicsA single result proved in CT generates many results in dierent areasDuality: for every categorical construct, there is a dual, reverse all the mapsDicult problems in some areas of mathematics can be translated into(easier) problems in other areas (e.g. by using functors, which map fromone category to another)Makes precise some notions that were previously vague, e.g. universality,naturality, etcValeria de Paiva (NASSLLI2012) June, 2012 32 / 113
    • Categories, Functors and Natural TransformationsWhy Categories?Category theory is ideal for:Reasoning about structure and the mappings that preserve structureAbstracting away from detailsAutomation (constructive methods for many useful categorical structures)Applications of Category theory in software engineering:The category of algebraic specications: category theory used to representcomposition and renementThe category of temporal logic specications: category theory used to buildmodular specications and decompose system properties across themAutomata theory: category theory oers a new way of comparing automataLogic as a category: represent a logical system as a category, and constructproofs using universal constructs in category theory (diagram chasing).A category of logics: theorem provers in dierent logic systems can behooked together through institution morphismsFunctional Programming: type theory, programming language semantics...Valeria de Paiva (NASSLLI2012) June, 2012 33 / 113
    • Categories, Functors and Natural TransformationsBeware of paradoxes...To avoid set theoretical paradoxes care must be taken.Oversimplifying: small collections are sets, big collections are classes andtry not to pay much attention to the dierences between them.Say C is a small category if boththe collection objects of C (written as obj(C) or |C|) andthe collection of maps between two objects HomC (A, B) (for all A, Bobjects of C) are sets.Say C is a locally small category if HomC (A, B) is a set for any twoobjects A and B in the category.We assume all the categories we discuss are at least locally small and thatthe sets of morphisms HomC (A, B) are disjoint for distinct pairs of objectsA and B. We also draw diagrams and say they commute to stateequations between morphisms.Valeria de Paiva (NASSLLI2012) June, 2012 34 / 113
    • Categories, Functors and Natural Transformations beginframeValeria de Paiva (NASSLLI2012) June, 2012 35 / 113
    • Categories, Functors and Natural TransformationsInitial and Terminal ObjectsValeria de Paiva (NASSLLI2012) June, 2012 35 / 113
    • Categories, Functors and Natural TransformationsRecap1. Discussed the idea of categorical semantics:Valeria de Paiva (NASSLLI2012) June, 2012 36 / 113
    • Categories, Functors and Natural TransformationsRecap1. Discussed the idea of categorical semantics:want our to be able to distinguish dierent derivations of the same formulafrom same assumptions;Valeria de Paiva (NASSLLI2012) June, 2012 36 / 113
    • Categories, Functors and Natural TransformationsRecap1. Discussed the idea of categorical semantics:want our to be able to distinguish dierent derivations of the same formulafrom same assumptions;2. want to use categorical morphisms as denotations of our proofs;Valeria de Paiva (NASSLLI2012) June, 2012 36 / 113
    • Categories, Functors and Natural TransformationsRecap1. Discussed the idea of categorical semantics:want our to be able to distinguish dierent derivations of the same formulafrom same assumptions;2. want to use categorical morphisms as denotations of our proofs;3. want Curry-Howard "triangles" for other logics/other typetheories/other categories;Valeria de Paiva (NASSLLI2012) June, 2012 36 / 113
    • Categories, Functors and Natural TransformationsRecap1. Discussed the idea of categorical semantics:want our to be able to distinguish dierent derivations of the same formulafrom same assumptions;2. want to use categorical morphisms as denotations of our proofs;3. want Curry-Howard "triangles" for other logics/other typetheories/other categories;for now want to understand how original categorical Curry-Howard worksValeria de Paiva (NASSLLI2012) June, 2012 36 / 113
    • Categories, Functors and Natural TransformationsRecap1. Discussed the idea of categorical semantics:want our to be able to distinguish dierent derivations of the same formulafrom same assumptions;2. want to use categorical morphisms as denotations of our proofs;3. want Curry-Howard "triangles" for other logics/other typetheories/other categories;for now want to understand how original categorical Curry-Howard works4. Saw the denition of a category and some examplesValeria de Paiva (NASSLLI2012) June, 2012 36 / 113
    • Categories, Functors and Natural TransformationsRepeating: a CategoryA category C consists of a collection of objects (A, B, . . .) and a collectionof morphisms (or maps/arrows) from A to B (written as f : A → B)satisfying three easy conditions:1. Given maps f : A → B and g : B → C such that the codomain of f isequal to the domain of g , there is an operation of composition ofmorphisms, which produces a map f ; g : A → C .2. The composition operation is associative, ie. f ; (g; h) = (f ; g); h.3. For each object A in the category we have an associated identitymorphism idA : A → A such that if f : A → B is any map in the category,then idA ; f = f = f ; idB .Note on `writing composition: mathematicians usually write g◦f for whatI mostly write as f ; g. Use whatever you like, and have a scratchpad nearbyto check it out...Valeria de Paiva (NASSLLI2012) June, 2012 37 / 113
    • Categories, Functors and Natural TransformationsRepeating: Examples0. Category Set, plus few nite ones, plus `sets-with-structure (universalalgebra)...1.any partially-ordered set (P, ≤) can be seen as a category, a morphismexists between p, q in P just when p ≤ q, ie. either a single or no morphismbetween objects.Valeria de Paiva (NASSLLI2012) June, 2012 38 / 113
    • Categories, Functors and Natural TransformationsRepeating: Examples0. Category Set, plus few nite ones, plus `sets-with-structure (universalalgebra)...1.any partially-ordered set (P, ≤) can be seen as a category, a morphismexists between p, q in P just when p ≤ q, ie. either a single or no morphismbetween objects.how do we show this satises conditions for category?2. category of monoids (M, ·, e) and monoid homormorphisms, ie mapsf :M →M such that f (m · n) = f (m) · f (n) and f (e) = e .Valeria de Paiva (NASSLLI2012) June, 2012 38 / 113
    • Categories, Functors and Natural TransformationsTwo extreme examples of categoriesThe empty category (writen as 0), which has no objects nor morphisms.(Just a parallel concept to the empty set.)The singleton category (written as 1), which has a single object and asingle morphism,Valeria de Paiva (NASSLLI2012) June, 2012 39 / 113
    • Categories, Functors and Natural TransformationsTwo extreme examples of categoriesThe empty category (writen as 0), which has no objects nor morphisms.(Just a parallel concept to the empty set.)The singleton category (written as 1), which has a single object and asingle morphism, which is the identity on the single object.Valeria de Paiva (NASSLLI2012) June, 2012 39 / 113
    • Categories, Functors and Natural TransformationsThe opposite category CopGiven any category C we can formally invert all its morphisms, to constructthe category Cop .Why would you do this?Actually will be extremely useful to deal with e.g. logical implication.But for the time being, its a simple way of seeing that morphisms do nothave to be function-based.Fork on the road: structures inside categories vs. structures relating catsValeria de Paiva (NASSLLI2012) June, 2012 40 / 113
    • Categories, Functors and Natural TransformationsProducts of CategoriesGiven categories C and D we consider a new category whose objects arepairs of objects (C, D), C in C and D in D and morphisms are pairs ofmorphisms (f, g), f : C → C , g : D → D . This builds the categoryC × D.Valeria de Paiva (NASSLLI2012) June, 2012 41 / 113
    • Categories, Functors and Natural TransformationsProducts of CategoriesGiven categories C and D we consider a new category whose objects arepairs of objects (C, D), C in C and D in D and morphisms are pairs ofmorphisms (f, g), f : C → C , g : D → D . This builds the categoryC × D.Does the operation of taking products of categories has a unity?Valeria de Paiva (NASSLLI2012) June, 2012 41 / 113
    • Categories, Functors and Natural TransformationsSlice CategoriesThis construction is a bit more involved. Given a category C and an objectA of C, the slice category over A, C/A is a category whose objects aremorphisms of the form C → A.A morphism from C → A to C → A is a morphism in C, f : C → C suchthat the following triangle commutes: f - C  C ? AValeria de Paiva (NASSLLI2012) June, 2012 42 / 113
    • Categories, Functors and Natural TransformationsA menagerie of CategoriesValeria de Paiva (NASSLLI2012) June, 2012 43 / 113
    • Categories, Functors and Natural TransformationsFunctorsWe have been stressing that more than objects it is the way that objectsrelate to each that matters in category theory. The same is true ofcategories themselves.Hence the old Eilenberg-MacLane joke that categories were only inventedso that they could talk about functors. And functors were only invented totalk about natural transformations. and yes talk about the naturaltransformations was what the algebraic geometers wanted to do all along.So we need maps of categories, the natural way of relating categories.Which structure should they preserve?Valeria de Paiva (NASSLLI2012) June, 2012 44 / 113
    • Categories, Functors and Natural TransformationsFunctorsWe have been stressing that more than objects it is the way that objectsrelate to each that matters in category theory. The same is true ofcategories themselves.Hence the old Eilenberg-MacLane joke that categories were only inventedso that they could talk about functors. And functors were only invented totalk about natural transformations. and yes talk about the naturaltransformations was what the algebraic geometers wanted to do all along.So we need maps of categories, the natural way of relating categories.Which structure should they preserve?Composition and identities, of course.Valeria de Paiva (NASSLLI2012) June, 2012 44 / 113
    • Categories, Functors and Natural TransformationsFunctorsGiven categories C and D, F : C → D consists a functor of an assignmentof objects of C to objects to D such that if f : A → B is a morphism in Cthen F (f ) : F (A) → F (B) is a morphism in D and1. F preserves composition, F (f ; g) = F (f ); F (g) and2. F preserves identities, F (idA ) = idF (A)Valeria de Paiva (NASSLLI2012) June, 2012 45 / 113
    • Categories, Functors and Natural TransformationsFunctorsValeria de Paiva (NASSLLI2012) June, 2012 46 / 113
    • Categories, Functors and Natural TransformationsExamples of FunctorsThe trivial example is the identity functor on any category C.1. A functor between posets is simply an order-preserving function.(they are called monotonic or monotone functions..)2. Forgetful functors simply forget the mathematical structure present. Forexample, the functor U : Mon → Sets simply forgets the monoid structureand returns the set that is the carrier of the monoid.Similarly for U : Group → Sets, the functor that forgets the groupstructure.3. More interesting are the free functors, that create free structure on baresets. For example, FreeMon : Sets → Mon creates free monoids.Valeria de Paiva (NASSLLI2012) June, 2012 47 / 113
    • Categories, Functors and Natural TransformationsExamples of FunctorsThe trivial example is the identity functor on any category C.1. A functor between posets is simply an order-preserving function.(they are called monotonic or monotone functions..)2. Forgetful functors simply forget the mathematical structure present. Forexample, the functor U : Mon → Sets simply forgets the monoid structureand returns the set that is the carrier of the monoid.Similarly for U : Group → Sets, the functor that forgets the groupstructure.3. More interesting are the free functors, that create free structure on baresets. For example, FreeMon : Sets → Mon creates free monoids.Can you guess what the free monoid functor FreeMon does to a setA = {a, b, c} ?Valeria de Paiva (NASSLLI2012) June, 2012 47 / 113
    • Categories, Functors and Natural TransformationsMore Slice CategoriesGiven a map f: A→B in C we have a functor Σf : C/A → C/B .For g : C/A → C/A g - C C  ? AValeria de Paiva (NASSLLI2012) June, 2012 48 / 113
    • Categories, Functors and Natural TransformationsMore Slice CategoriesGiven a map f: A→B in C we have a functor Σf : C/A → C/B .For g : C/A → C/A g - C C  ? AΣf acts as g - C C - ? ? A - BValeria de Paiva (NASSLLI2012) June, 2012 48 / 113
    • Categories, Functors and Natural TransformationsMore Examples of FunctorsFrom Huttons notes, http://www.cs.nott.ac.uk/ gmh/cat.html.1. The powerset functor, P : Set → Set, P(A) is the set of all subsets ofA, for example if A = {0, 1} then P(A) = {∅, {0}, {1}, {0, 1}}.2. The List : Set → Set functor. On objects ListA is the set dened by thegrammar ListA ::= Nil | ConsA(ListA)On maps, if f: A→B is a function then List(f ) : List(A) → List(B) isthe function dened by the equations:Valeria de Paiva (NASSLLI2012) June, 2012 49 / 113
    • Categories, Functors and Natural TransformationsMore Examples of FunctorsFrom Huttons notes, http://www.cs.nott.ac.uk/ gmh/cat.html.1. The powerset functor, P : Set → Set, P(A) is the set of all subsets ofA, for example if A = {0, 1} then P(A) = {∅, {0}, {1}, {0, 1}}.2. The List : Set → Set functor. On objects ListA is the set dened by thegrammar ListA ::= Nil | ConsA(ListA)On maps, if f: A→B is a function then List(f ) : List(A) → List(B) isthe function dened by the equations: List f (Nil) = NilValeria de Paiva (NASSLLI2012) June, 2012 49 / 113
    • Categories, Functors and Natural TransformationsMore Examples of FunctorsFrom Huttons notes, http://www.cs.nott.ac.uk/ gmh/cat.html.1. The powerset functor, P : Set → Set, P(A) is the set of all subsets ofA, for example if A = {0, 1} then P(A) = {∅, {0}, {1}, {0, 1}}.2. The List : Set → Set functor. On objects ListA is the set dened by thegrammar ListA ::= Nil | ConsA(ListA)On maps, if f: A→B is a function then List(f ) : List(A) → List(B) isthe function dened by the equations: List f (Nil) = Nil List f (Cons x xs) = Cons(f (x))(List f xs))Valeria de Paiva (NASSLLI2012) June, 2012 49 / 113
    • Categories, Functors and Natural TransformationsMore Examples of FunctorsFrom Huttons notes, http://www.cs.nott.ac.uk/ gmh/cat.html.1. The powerset functor, P : Set → Set, P(A) is the set of all subsets ofA, for example if A = {0, 1} then P(A) = {∅, {0}, {1}, {0, 1}}.2. The List : Set → Set functor. On objects ListA is the set dened by thegrammar ListA ::= Nil | ConsA(ListA)On maps, if f: A→B is a function then List(f ) : List(A) → List(B) isthe function dened by the equations: List f (Nil) = Nil List f (Cons x xs) = Cons(f (x))(List f xs))Preservation of composition and identities proved by induction.3. Can you do the functor Tree : Set → Set such that TreeA is the set ofbinary trees whose leaves are elements of the set A?Valeria de Paiva (NASSLLI2012) June, 2012 49 / 113
    • Categories, Functors and Natural TransformationsRecap:1. Discussed categories. what are they?Valeria de Paiva (NASSLLI2012) June, 2012 50 / 113
    • Categories, Functors and Natural TransformationsRecap:1. Discussed categories. what are they? collection of objects, collection ofmaps such that maps compose (associatively) and there are identities foreach objectf ; (g; h) = (f ; g); hf (idA ) = idf (A)2. talked about some examples e.g. monoids and monoid morphismsValeria de Paiva (NASSLLI2012) June, 2012 50 / 113
    • Categories, Functors and Natural TransformationsRecap:1. Discussed categories. what are they? collection of objects, collection ofmaps such that maps compose (associatively) and there are identities foreach objectf ; (g; h) = (f ; g); hf (idA ) = idf (A)2. talked about some examples e.g. monoids and monoid morphismscan you remember two examples of monoids?slice category where objects are already morphisms..product category C × D.3. dened functor F : C → D need to map objects to objects and maps tomaps. need to satisfy F (f ; g) = F (f ); F (g) F (idA ) = idF (A)Valeria de Paiva (NASSLLI2012) June, 2012 50 / 113
    • Categories, Functors and Natural TransformationsRecap:1. Discussed categories. what are they? collection of objects, collection ofmaps such that maps compose (associatively) and there are identities foreach objectf ; (g; h) = (f ; g); hf (idA ) = idf (A)2. talked about some examples e.g. monoids and monoid morphismscan you remember two examples of monoids?slice category where objects are already morphisms..product category C × D.3. dened functor F : C → D need to map objects to objects and maps tomaps. need to satisfy F (f ; g) = F (f ); F (g) F (idA ) = idF (A) where arethese compositions?Valeria de Paiva (NASSLLI2012) June, 2012 50 / 113
    • Categories, Functors and Natural TransformationsTwo more examples of Categories: I. Labelled GraphsCan you describe the category of `labelled graphs ? what are the objects?Valeria de Paiva (NASSLLI2012) June, 2012 51 / 113
    • Categories, Functors and Natural TransformationsLabelled GraphsMorphisms/arrows/maps from one labelled graph to another?Valeria de Paiva (NASSLLI2012) June, 2012 52 / 113
    • Categories, Functors and Natural TransformationsLabelled GraphsMorphisms/arrows/maps from one labelled graph to another?Valeria de Paiva (NASSLLI2012) June, 2012 52 / 113
    • Categories, Functors and Natural TransformationsMaps of Labelled GraphsValeria de Paiva (NASSLLI2012) June, 2012 53 / 113
    • Categories, Functors and Natural TransformationsSecond Example: Automataremember these?Valeria de Paiva (NASSLLI2012) June, 2012 54 / 113
    • Categories, Functors and Natural TransformationsSecond Example: Automata from Goguens ManifestoValeria de Paiva (NASSLLI2012) June, 2012 55 / 113
    • Categories, Functors and Natural TransformationsMore Examples of FunctorsBack to the powerset functor, P : Set → Set, P(A) is the set of all subsetsof A, for example if A = {0, 1} then P(A) = {∅, {0}, {1}, {0, 1}}.if B = {a, b, c} thenP(B) = {∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}.You can also consider only nite subsets of a set Pf in (A), which makesmore sense if the set is innite.The power set functorP : Set → Set maps each set to its power set andeach function f : X → Y to the map which sends U ⊆ X to its imagef (U ) ⊆ Y . One can also consider the contravariant power set functorwhich sends f :X→Y to the map which sends V ⊆Y to its inverse −1image f (V ) ⊆ X .Valeria de Paiva (NASSLLI2012) June, 2012 56 / 113
    • Categories, Functors and Natural TransformationsMore Examples of FunctorsThe List : Set → Set functor. On objects ListA is the set dened by thegrammar ListA ::= Nil | ConsA(ListA)On maps, if f: A→B is a function then List(f ) : List(A) → List(B) isthe function dened by the equations:Valeria de Paiva (NASSLLI2012) June, 2012 57 / 113
    • Categories, Functors and Natural TransformationsMore Examples of FunctorsThe List : Set → Set functor. On objects ListA is the set dened by thegrammar ListA ::= Nil | ConsA(ListA)On maps, if f: A→B is a function then List(f ) : List(A) → List(B) isthe function dened by the equations: List f (Nil) = NilValeria de Paiva (NASSLLI2012) June, 2012 57 / 113
    • Categories, Functors and Natural TransformationsMore Examples of FunctorsThe List : Set → Set functor. On objects ListA is the set dened by thegrammar ListA ::= Nil | ConsA(ListA)On maps, if f: A→B is a function then List(f ) : List(A) → List(B) isthe function dened by the equations: List f (Nil) = Nil List f (Cons x xs) = Cons(f (x))(List f xs))Valeria de Paiva (NASSLLI2012) June, 2012 57 / 113
    • Categories, Functors and Natural TransformationsMore Examples of FunctorsThe List : Set → Set functor. On objects ListA is the set dened by thegrammar ListA ::= Nil | ConsA(ListA)On maps, if f: A→B is a function then List(f ) : List(A) → List(B) isthe function dened by the equations: List f (Nil) = Nil List f (Cons x xs) = Cons(f (x))(List f xs))Preservation of composition and identities proved by induction.3. Can you do the functor Tree : Set → Set such that TreeA is the set ofbinary trees whose leaves are elements of the set A?Valeria de Paiva (NASSLLI2012) June, 2012 57 / 113
    • Categories, Functors and Natural TransformationsBack to math: Hom FunctorsPick a category C and an object A in it. Then HomC (A, −) is a functorfrom C to Set, where HomC (A, −) the collection of all morphisms of Cwith source A. F isA functor represented by an object A if F is naturally isomorphic toHomC (A, −).Valeria de Paiva (NASSLLI2012) June, 2012 58 / 113
    • Categories, Functors and Natural TransformationsMore Hom FunctorsPick a category C and an object A in it. Look at HomC (−, A) is a functorfrom C to Set, where HomC (−, A) is the collection of all morphisms of Cwith codomain A.Valeria de Paiva (NASSLLI2012) June, 2012 59 / 113
    • Categories, Functors and Natural TransformationsFunctors: more notationA functor of the form H : C × D → E, where the domain is a productcategory, is called a bi-functor.Projections from a product category π1,2 : A × B → A are bi-functors. opA functor of the form F: C → D, whose domain is the opposite of agiven category, is called a contravariant functor.Example of non-functor that looks like one: the centre of a group" (thecenter Z(G) of a group G, is dened as the subgroup consisting of allelements g ∈ G such that for all elements h ∈ H the equality gh = hgholds).Valeria de Paiva (NASSLLI2012) June, 2012 60 / 113
    • Categories, Functors and Natural TransformationsFunctors are ubiquitous?Graham says:The wikipedia says: For functors as a synonym of "function objects" incomputer programming to pass function pointers along with its state, seefunction object. For the use of the functor morphism presented here infunctional programming see also the fmap function of Haskells Functorclass. Functor is also used to name functions in Prolog. For functors inlinguistics, see Function word.Valeria de Paiva (NASSLLI2012) June, 2012 61 / 113
    • Categories, Functors and Natural TransformationsNatural TransformationsGiven functors F : C → D and G : C → D, a natural transformationα : F → G consists of morphisms αA : F (A) → G(A) such that, for any Ain C and for any f : A → B in C we have: αA- F (A) G(A) F (f ) G(f ) ? ? F (B) - G(B) αBdo easy case and mentionhttp://blog.sigfpe.com/2008/05/you-could-have-dened-natural.html`Starting with the idea of a function that doesnt `peek inside itsarguments, were led inexorably to the idea of substitutability of argumentsand from there to a categorical denition of a natural transformation.Valeria de Paiva (NASSLLI2012) June, 2012 62 / 113
    • Categories, Functors and Natural Transformations... prettier picture from Edsko de Vries, thanks!Valeria de Paiva (NASSLLI2012) June, 2012 63 / 113
    • Categories, Functors and Natural TransformationsExamples of Natural TransformationsReversing lists. If A is a set, then revA : List → List is a function denedby: revA (Nil) = Nil revA (Cons x xs) = revA (xs) · (Consx Nil)To show this is natural must show revA ListA - ListA Listf Listf ? ? ListB - ListB revBValeria de Paiva (NASSLLI2012) June, 2012 64 / 113
    • Categories, Functors and Natural TransformationsConstructions in Categories: ProductsA category C A and B in C, there has binary products, if given objectsexists an objectA × B and morphisms π1 : A × B → A andp2 : A × B → B of C such that if P is another object of C equipped withmorphisms p1 : P → A and p2 : P → B , then theres a unique mapu : P → A × B such that the triangles below commute. P p2 p1 u -  π1 ? π2 - A A×B BValeria de Paiva (NASSLLI2012) June, 2012 65 / 113
    • Categories, Functors and Natural TransformationsConstructions in Categories: PullbacksA category C f : X → Z and g : Y → Z in C, has pullbacks, if given mapsthere exists an object P equipped with morphisms p1 : P → X andp2 : P → Y of C such that if Q is another object of C equipped withmorphisms q1 : Q → X and q2 : Q → Y , then theres a unique mapu : Q → P such that the `triangles below commute.Valeria de Paiva (NASSLLI2012) June, 2012 66 / 113
    • Categories, Functors and Natural TransformationsConstructions in Categories: EqualizersA category C has equalizers, if given maps f: A→B and g : A → B inC, there exists an object E equipped with a morphism e : E → A of Csuch that if E is another object of C equipped with a morphisme : E → A, then theres a unique map e: E → E such that the trianglebelow commutes.Valeria de Paiva (NASSLLI2012) June, 2012 67 / 113
    • Categories, Functors and Natural TransformationsRecap...Valeria de Paiva (NASSLLI2012) June, 2012 68 / 113
    • Categories, Functors and Natural TransformationsRecap...Got up our ladder: categories, functors and natural transformations.Cats have objects and maps, identity morphism for each object, satisfyingcomposition and identity law.Functors transform cats into other cats,F : C → D have a component forobjects a component for maps, st F (f ; g) = F (f ); F (g) (covariantfunctor) and F (idC ) = idF C .constructions relating cats: opposite or dual cat, products, extra exampleslike slice cat and Hom-functor. constructions inside a cat: initial/terminalobject, products (coproducts), pullbacks (push-outs), equalizers(co-equalizers).Not worrying about size considerations (set-theoretic paradoxes) can build:1. category of small categories where morphisms are functors between cats.2. Cat of functors between two given cats F un(C, D) where objects arefunctors and morphisms are natural transformations.Valeria de Paiva (NASSLLI2012) June, 2012 68 / 113
    • Categories, Functors and Natural TransformationsRecap...A nat transformation α: F → G between functors F and G both from Cto D is a collection of morphisms in D αC one for each object C of thecategory C satisfying a nice square, for each morphism in C f: C →C : αC- F (C) G(C) F (f ) G(f ) ? ? F (C ) - G(C ) αConly example "reverse" between lists in Set...Valeria de Paiva (NASSLLI2012) June, 2012 69 / 113
    • Categories, Functors and Natural TransformationsTrivial example: identity natural transformationα − idC : F → F .how does it go?Valeria de Paiva (NASSLLI2012) June, 2012 70 / 113
    • Categories, Functors and Natural TransformationsTrivial example: identity natural transformationα − idC : F → F .how does it go?A nat transformation α: F → G between functors F and G both from Cto C is a collection of morphisms in C αC one for each object C of thecategory satisfying a nice square, for each morphism in C f: C →C : α − idC F (C) - F (C) F (f ) F (f ) ? ? F (C ) - F (C ) α − idCValeria de Paiva (NASSLLI2012) June, 2012 70 / 113
    • AdjunctionsAdjunctions?Given functors F: C →D and G : D → C, we say that F is left-adjoint toG (or that G is right-adjoint to F ) F G if there is a natural bijection HomD (F C, D) ∼ HomC (C, GD) =for each pair of objects C in C and D in D.Many people prefer to think of them as Galois connections.Valeria de Paiva (NASSLLI2012) June, 2012 71 / 113
    • AdjunctionsGalois connections...Let (A, ≤) and (B, ≤) be two partially ordered sets. A Galois connectionbetween these posets consists of two monotone functions: F: A→B andG : B → A, such that for all a in A andb in B, we have F (a) ≤ b if and only if a ≤ G(b)In this situation,F is called the lower adjoint of G and G is called theupper adjoint of F.Several names in the literature, wikipedia has a good selection.Originally from Galois work on groups.Check out Peter Smiths carefully written "The Galois Connection betweenSyntax and Semantics".Abstract Algebraic Logic. Abstract interpretation. "Concept analysis",some Information Flow...Valeria de Paiva (NASSLLI2012) June, 2012 72 / 113
    • AdjunctionsExamples of AdjunctionsFree monoids again... Cartesian Closedness (monoidal closedness)Valeria de Paiva (NASSLLI2012) June, 2012 73 / 113
    • AdjunctionsFree monoids?Recall the functor Free : Set → Mon.On an set A it produces the free monoid. i.e sequences of elements fromA, multiplied by concatenation, (A∗ , [], concat).On an set B it produces the free monoid (sequences of elements from B)(B ∗ , [], concat).Valeria de Paiva (NASSLLI2012) June, 2012 74 / 113
    • AdjunctionsFree monoids?Recall the functor Free : Set → Mon.On an set A it produces the free monoid. i.e sequences of elements fromA, multiplied by concatenation, (A∗ , [], concat).On an set B it produces the free monoid (sequences of elements from B)(B ∗ , [], concat).remind me, whats the rest of the functor?Valeria de Paiva (NASSLLI2012) June, 2012 74 / 113
    • AdjunctionsFree monoids?Recall the functor Free : Set → Mon.On an set A it produces the free monoid. i.e sequences of elements fromA, multiplied by concatenation, (A∗ , [], concat).On an set B it produces the free monoid (sequences of elements from B)(B ∗ , [], concat).remind me, whats the rest of the functor?On a map f: A→B the action of Free, f ∗ is simply doing the function fin each of the elements of A.Recall also the `boring forgetful functor U : Mon → Set. Given anymonoid (M, ·, e) it returns simply M . Given a monoid morphismh : (M, ·, e) → (M , ·, e ), return simply the function h.Valeria de Paiva (NASSLLI2012) June, 2012 74 / 113
    • AdjunctionsFree monoids?Now let us look at the denition of adjunction: Two functors F, G going inopposite directions st HomD (F C, D) ∼ HomC (C, GD) =where ∼ = means there is a bijection that is natural in C and D.Valeria de Paiva (NASSLLI2012) June, 2012 75 / 113
    • AdjunctionsFree monoids?Now let us look at the denition of adjunction: Two functors F, G going inopposite directions st HomD (F C, D) ∼ HomC (C, GD) =where ∼ = means there is a bijection that is natural in C and D.We do have functors going between categories Mon and Set in oppositedirections.U : Mon → Set and Free : Set → MonDo we have .... HomSet (U M, A) ∼ HomMon (M, FreeA) =More than 20 dierent denitions of adjunction...Valeria de Paiva (NASSLLI2012) June, 2012 75 / 113
    • AdjunctionsFree monoids?Simmons says:There is a lot going on with adjunctions and you willprobably get confused more than once. Dont worry....universal property: a morphism η : A → U (FreeA) such that whenever Mis a monoid, and g : A → U (M ) a function, then there is a unique monoidmorphism h : Free(A) → M such that U (h) · η = g . A - UM - ? U (Free(A))Go and read it at your own pace. for intuition think the free monoid is themonoid built on the generators, the elements of the original set. you canalways embedd the original set into the set that is the forgotten monoid..Valeria de Paiva (NASSLLI2012) June, 2012 76 / 113
    • AdjunctionsAn über familiar adjunction... HomSet (A × B, C) ∼ HomSet (A, C B ) =So f: A×B →C f : A → CB. is bijectively related toThis is trivial currying of functions, if your f has 2 arguments a and b, youcan transform it into a function f of a single argument a that returns afunction taking bs to cs, right?Schoennkel (1920s) the rst (?) to notice its importance for combinators .Now can we do it in a generic category C?We have products. Need to internalize the notion of maps in C from B toC.In Set is easy, the set of functions from X to Y may be denoted X→Y or XY .As a special case, the power set of a set X may be identied with the setof all functions from X to {0, 1}, denoted 2X .Valeria de Paiva (NASSLLI2012) June, 2012 77 / 113
    • AdjunctionsAn über familiar adjunction...Consider the functor − × B : Set → Set, where B is a xed object of Set.On object A we have A × B ,on object A we have A × B .Valeria de Paiva (NASSLLI2012) June, 2012 78 / 113
    • AdjunctionsAn über familiar adjunction...Consider the functor − × B : Set → Set, where B is a xed object of Set.On object A we have A × B ,on object A we have A × B .whats the morphism component?On a map f: A→A we simply product with the identity on B.Now consider the functor (−)B : → Set. Set BOn object D , D is the set of all maps B → D .On object D it is the set of all maps B → D .and on a morphism, f : D → Dits the usual, composition.Now, if we "formally" plug in these two functors into our denition ofadjunction, what happens?Valeria de Paiva (NASSLLI2012) June, 2012 78 / 113
    • AdjunctionsAn über familiar adjunction...Look at: HomD (F C, D) ∼ HomC (C, GD) =where F =−×B and G = (−)BValeria de Paiva (NASSLLI2012) June, 2012 79 / 113
    • AdjunctionsAn über familiar adjunction...Look at: HomD (F C, D) ∼ HomC (C, GD) =where F =−×B and G = (−)Bapplying to objects C and D we have: HomSet (C × B, D) ∼ HomSet (C, DB ) ∼ HomSet (C, B → D) = =which corresponds to our trivial operation on of currying functions...So I want to conclude that in a generic category C with products, I have anadjunction between functors −×B and (−)B .Valeria de Paiva (NASSLLI2012) June, 2012 79 / 113
    • AdjunctionsAn über familiar adjunction...ok, Im cheating. I didnt tell you how to construct the functor (−)B inother categories. We know we can do it in Set, but what about anywhereelse?I can give a proper denition of (−)B if I work hard on limits, the generalnotion of which we saw 3 instances: products, pullbacks and equalizers.then the adjunction is obvious.or I can give you the adjunction saying youve used it a billion times beforeand say, go get your general denition of "internalizing functions" from theadjunction. Ie dene function spaces as the functor that makes theadjunction work, like many books do.A bit like riding a bike, if you start you can keep your balance...Valeria de Paiva (NASSLLI2012) June, 2012 80 / 113
    • AdjunctionsCartesian Closed Categories...A category C is called a cartesian closed category (CCC) if it has productsand if for each object X of C, the product functor −×X: C →C has a Xright adjoint, written as (−) . That is we have HomC (A × X, B) ∼ HomC (A, B X ) =A minor modication, not insisting on "real" cartesian products, producesthe denition of symmetric monoidal closed category. HomC (A ⊗ X, B) ∼ HomC (A, [X, B]C ) =Valeria de Paiva (NASSLLI2012) June, 2012 81 / 113
    • AdjunctionsHave you seen this adjunction before?...If you squint a little and make × the same as ∧ and → logical implicationand think of maps in the category as proofs, you can read HomC (A × X, B) ∼ HomC (A, X → B) =as any proof of A∧X →B corresponds bijectively to a proof ofA → X → B, which is a form of the Deduction Theorem in logic.Valeria de Paiva (NASSLLI2012) June, 2012 82 / 113
    • Deductive Systems as CategoriesLambek introduced the idea of using Gentzen methods in category theoryand linguistics in the Sixties.A deductive system is simply a labelled graph whose objects are formulasand whose edges are labelled sequents. There are special identity arrowsand some special rules for creating new sequents outof the old ones. Givena graph GValeria de Paiva (NASSLLI2012) June, 2012 83 / 113
    • Deductive Systems as CategoriesWhat are the Deductive Systems trying to do?...Valeria de Paiva (NASSLLI2012) June, 2012 83 / 113
    • Deductive Systems as CategoriesHow do sequents relate to categories?...Basic idea: a formula corresponds to an object in a suitable categoryWe assign to each sequent Γ A a map in the suitable category C fromthe interpretation of Γ to the interpretation of A. (But we dont bother toshow the dierence between A formula and A object in the category...)Clearly the interpretation must be compositional: we get the interpretationof Γ = A1 , . . . , A n from the interpretations of the components Ai .What is the less contraining construction we can do in a category that willinterpret the context Γ?People will worry about commutativity, associativity of commas.If I am talking about intuitionistic logic, where conjunction is commutativeand associative, cartesian product would be ne, but a commutative tensorproduct ⊗ is ne too.Valeria de Paiva (NASSLLI2012) June, 2012 84 / 113
    • Deductive Systems as CategoriesHow do sequents relate to categories?...Tensor products? Well, I mentioned categorical products and their universalproperty. It turns out that universality is not really required to modelcontexts.So we can do simply with a product-like functor ⊗: C × C → C, which isassociative, commutative and has an identity, usually written as I.Categorical products are unique up to iso, so if you have products, thats it.(up to iso).But tensor products are not unique, you can have several, this correspondsto several kinds of "conjunction" in your logic.A category with an associated tensor product and unit is called a monoidalcategory. A category with an associated categorical product and terminalobject is called a cartesian category.Monoidal categories are very fashionable, as they seem more exible formodelling phenomena. (glossing over issues with coherence).Valeria de Paiva (NASSLLI2012) June, 2012 85 / 113
    • Deductive Systems as CategoriesHow do sequents relate to categories? ...Adding terms/morphisms to a suitable version of sequent calculus rules weget a full interpretation of the suimply typed lambda-calculus in categories.This allows us to think of proofs as λ-terms or of morphisms in thecategory build up from identities and the constructors we allowed.Are we there yet?Valeria de Paiva (NASSLLI2012) June, 2012 86 / 113
    • Deductive Systems as CategoriesHow do sequents relate to categories? ...Adding terms/morphisms to a suitable version of sequent calculus rules weget a full interpretation of the suimply typed lambda-calculus in categories.This allows us to think of proofs as λ-terms or of morphisms in thecategory build up from identities and the constructors we allowed.Are we there yet?No, must prove it works.Must prove we have triangle...Valeria de Paiva (NASSLLI2012) June, 2012 86 / 113
    • Deductive Systems as CategoriesValeria de Paiva (NASSLLI2012) June, 2012 87 / 113
    • Deductive Systems as CategoriesOld pictureValeria de Paiva (NASSLLI2012) June, 2012 88 / 113
    • Deductive Systems as CategoriesProblems?..We can add terms to Natural Deduction (Curry-Howard correspondence).But need sequent formulation provably equivalent to Natural Deduction.(there is a problem with associating categorical constructions to sequentcalculus rules without ND, the proof equalities dont work without extraconstraints, Herbelin.)We will discuss this tomorrow.Valeria de Paiva (NASSLLI2012) June, 2012 89 / 113
    • Deductive Systems as CategoriesRecap..So I goofed, shouldve dened:An object C in a category D is an internal hom object or an exponentialobject [A → B] or B A if it comes equipped with an arrowev : [A → B] × A → B , called the evaluation arrow, such that for anyother arrow f : C × A → B , there is a unique arrow λf : C → [A → B]such that the compositeC × A →λf ×1A [A → B] × A →ev Bis f .but yes, the bike metaphor is still valid...Valeria de Paiva (NASSLLI2012) June, 2012 90 / 113
    • Deductive Systems as CategoriesTraditional Curry-Howard reloaded..Valeria de Paiva (NASSLLI2012) June, 2012 91 / 113
    • Deductive Systems as CategoriesTraditional Curry-Howard reloaded..But 88 pages in Gallier to prove ND equivalent to sequent calculus...Once you have it:Valeria de Paiva (NASSLLI2012) June, 2012 92 / 113
    • Deductive Systems as CategoriesTraditional Curry-Howard reloaded..Valeria de Paiva (NASSLLI2012) June, 2012 93 / 113
    • Deductive Systems as CategoriesCategorical Curry-Howard reloaded..Valeria de Paiva (NASSLLI2012) June, 2012 94 / 113
    • Deductive Systems as CategoriesCategorical Curry-Howard reloaded..Valeria de Paiva (NASSLLI2012) June, 2012 95 / 113
    • Deductive Systems as CategoriesTraditional Curry-Howard reloaded..Valeria de Paiva (NASSLLI2012) June, 2012 96 / 113
    • Deductive Systems as CategoriesTraditional Curry-Howard reloaded..What can we prove?Few more (traditional denitions)A signature is a collection of basic types (Nat, Bool, Char, ...) and typedfunctional symbols (add, succ,..., etc).Consider a basic signature that contains at least basic types 1, 0 and basicoperators × for conjunctions, + for disjunctions and → for logicalimplication.Take a cartesian closed category C with products, coproducts and functionspaces.An interpretation I for signature Σ in C ( a Σ-structure in C) is speciedby giving an object of C for each type in Σ and a map in C for eachfunction symbol f in Σ.Valeria de Paiva (NASSLLI2012) June, 2012 97 / 113
    • Deductive Systems as CategoriesTraditional Curry-Howard reloaded..Considering terms in context, for any interpretation of Σ in C there exists astandard inductive denition of the interpretation of terms in context,induced by the interpretation of Σ.Consider equations in context. Say an equation in EqΣ holds for aninterpretation I if the interpretations of the terms in context are equalmorphims in the category.Say an interpretation is a model of a set of equations if it satises all theequations in the set.Finally can state:Valeria de Paiva (NASSLLI2012) June, 2012 98 / 113
    • Deductive Systems as CategoriesCategorical Curry-Howard reloaded..Soundness Theorem[Categorical Modelling of IPL]Let C be a cartesian closed category with coproducts and let I be a modelof EqΣ in C. Then I satises any equation derivable from Eqσ usingequational logic.Valeria de Paiva (NASSLLI2012) June, 2012 99 / 113
    • Deductive Systems as CategoriesCategorical Curry-Howard reloaded..Soundness Theorem[Categorical Modelling of IPL]Let C be a cartesian closed category with coproducts and let I be a modelof EqΣ in C. Then I satises any equation derivable from EqΣ usingequational logic.Completeness Theorem[Categorical Modelling of IPL]For all signatures Σ there exists a cartesian closed category with coproductsC and an interpretation of the calculus in this category such that:If Γ t:A and Γ s : A are derivable, then t and s are interpreted as thesame morphism only if t = s is provable from the equations above usingtyped equational logic.Valeria de Paiva (NASSLLI2012) June, 2012 100 / 113
    • Deductive Systems as CategoriesWadlers TakeValeria de Paiva (NASSLLI2012) June, 2012 101 / 113
    • A taste of Glue Semantics?...Glue semantics in 5 minThanks for slides, Dick!Glue semantics is a theory of the syntax-semantics interface that useslinear logic for meaning composition.Distinguish two separate logics in semantic interpretation 1. Meaning logic: target logical representation 2. Glue logic: logical specication of how chunks of meaning are assembledIn principle, Glue uses any of several grammar formalisms/any of themainstream semantics. In practice Glue started for LFG, with a vanillaMontague-style logic for meanings.Valeria de Paiva (NASSLLI2012) June, 2012 102 / 113
    • A taste of Glue Semantics?...Linguistic applications of linear logic 1. Categorial and type-logical grammar (Moortgat, vanBenthem):including parsing categorial grammars (Morrill, Hepple) andcompositional semantics of categorial grammars (Morrill, Carpenter) 2. `Glue semantics (a version of categorial semantics without anassociated categorial grammar?) (Dalrymple, Lamping & Gupta)) 3. Resource-based reformulations of other grammatical theoriesMinimalism (Retore,Stabler)Lexical Functional Grammar (Saraswat,Muskens)Tree Adjoining Grammar (Abrusci) 4. Also AI issues such as the frame problem (White) or planning(Dixon) with linguistic relevanceValeria de Paiva (NASSLLI2012) June, 2012 103 / 113
    • A taste of Glue Semantics?...Curry-Howard Isomorphism (CHI)CHI = Pairing of proof rules with operations on proof terms But doesnt work for all logics, or proof systemsDenes interesting identity criteria for proofs Syntactically distinct derivations corresponding to same proofIntimate relation between logic and type-theory.Varied applications, e.g.  Proofs as programs  Semantic construction for natural languageValeria de Paiva (NASSLLI2012) June, 2012 104 / 113
    • A taste of Glue Semantics?...Example: Input to Semantic InterpretationLexicon Word Meaning Glue John john ↑ where ↑= g Fred fred ↑ where ↑= h saw λy.λx. see(x, y) ↑ .OBJ −◦ (↑ .SU BJ −◦ ↑) where ↑= f , f.OBJ = h, f.SU BJ = gConstituents g, h, f : semantic resources, consuming & producing meaningsValeria de Paiva (NASSLLI2012) June, 2012 105 / 113
    • A taste of Glue Semantics?...Lexical Premises: Their nature saw aλy.λx. see(x, y) : bh −◦ (g −◦ f ) cMeaning Term dGlue Formula (Propositional LL)Atomic propositions (f, g, h):• Correspond to syntactic constituents found in parsing• Denote resources used in semantic interpretation (Match production & consumption of constituent meanings)Meaning terms:• Expressions in some chosen meaning language• Language must support abstraction and application• . . . but otherwise relatively free choiceValeria de Paiva (NASSLLI2012) June, 2012 106 / 113
    • A taste of Glue Semantics?...Cutting and Pasting 1...Valeria de Paiva (NASSLLI2012) June, 2012 107 / 113
    • A taste of Glue Semantics?...The Form of Glue Derivations Γ M:fwhere• Γ is set of lexical premises (instantiated by parse)• f is (LL atom corresponding to) sentential constituent• M is meaning term produced by derivation(Semantic) AmbiguityOften (many) alternative derivations Γ Mi : feach producing a dierent meaning term Mi for fNeed to nd all alternative derivations (eciently!)Valeria de Paiva (NASSLLI2012) June, 2012 108 / 113
    • A taste of Glue Semantics?...Alternative Derivations: Modier ScopeConsider phrase  alleged criminal from London λx. criminal(x) : f λP. alleged(P ) : f −◦ f λP λx. from(l, x) ∧ P (x) : f −◦ fTwo derivations, resulting in:1. λx. from(l, x) ∧ alleged(criminal)(x) : f2. alleged(λx. from(l, x) ∧ criminal(x)) : fValeria de Paiva (NASSLLI2012) June, 2012 109 / 113
    • A taste of Glue Semantics?...Independence of Glue and Meaning Original Glue (93) Curry-Howard Glue (97) mixes meanings & glue separates meanings & glue gjohn john : g hf red f red : h ∀y. hy −◦ ∀x. (gx −◦ f see(x, y)) λyλx. see(x, y) : h −◦ (g −◦ f )Some meaning separation rules: • [[∀M. (rM −◦ ϕ)]]m = λM. [[ϕ]]m • [[rM]]m = MSome expressions cant be separated: gjohn −◦ f sleep(john)  Avoid these: derivations dependent on meanings, and higher order unication needed to match meaningsCurry-Howard: good for understanding derivationsOriginal: good for understanding premisesValeria de Paiva (NASSLLI2012) June, 2012 110 / 113
    • A taste of Glue Semantics?...Skeletons and modiers?Valeria de Paiva (NASSLLI2012) June, 2012 111 / 113
    • A taste of Glue Semantics?...Glue Sales Pitch Linguistically powerful & exible approach Interesting analyses of scope, control (Asudeh), event-based semantics (Fry), intensional verbs (Dalrymple), context dependence, coordination. But many other phenomena still to do Grammar & semantics engineering Applicable to grammars besides LFG based ones Steep learning curve for writing lexical entries But turns out to allow plentiful re-use of lingware Can be implemented ecientlyValeria de Paiva (NASSLLI2012) June, 2012 112 / 113
    • A taste of Glue Semantics?...ConclusionsWe missed Ulrik but managed to muddle through some basic denitions ofcategory theory.Covered categories, functors, natural transformations and some examples.Also discussed adjunctions and two of their easier examples: free monoidsand cartesian closedness.We discussed an extended version of CurryHoward to relates logics, notonly to type theory, but also to categories and structures inside thosecategories. Heres a graphic reminder of the main point.As an novel and kind of unique application we mentione Glue Semanticsvery briey.Valeria de Paiva (NASSLLI2012) June, 2012 113 / 113