Some Aspects of Categories in Computer Science
Total Page:16
File Type:pdf, Size:1020Kb
This is a technical rep ort A mo died version of this rep ort will b e published in Handbook of Algebra Vol edited by M Hazewinkel Some Asp ects of Categories in Computer Science P J Scott Dept of Mathematics University of Ottawa Ottawa Ontario CANADA Sept Contents Intro duction Categories Lamb da Calculi and FormulasasTyp es Cartesian Closed Categories Simply Typ ed Lamb da Calculi FormulasasTyp es the fundamental equivalence Some Datatyp es Polymorphism Polymorphic lamb da calculi What is a Mo del of System F The Untyp ed World Mo dels and Denotational Semantics CMonoids and Categorical Combinators Church vs Curry Typing Logical Relations and Logical Permutations Logical Relations and Syntax Example ReductionFree Normalization Categorical Normal Forms P category theory and normalization algorithms Example PCF PCF Adequacy Parametricity Dinaturality Reynolds Parametricity Linear Logic Monoidal Categories Gentzens pro of theory Gentzen sequents Research partially supp orted by NSERC Canada Girards Analysis of the Structural Rules Fragments and Exotic Extensions Top ology of Pro ofs What is a categorical mo del of LL General Mo dels Concrete Mo dels Full Completeness Representation Theorems Full Completeness Theorems Linear Lauchli Semantics Feedback and Trace Traced Monoidal Categories Partially Additive Categories GoI Categories Literature Notes Intro duction Over the past years category theory has b ecome an increasingly signicant conceptual and practical to ol in many areas of computer science There are ma jor conferences and journals de voted wholly or partially to applying categorical metho ds to computing At the same time the close connections of computer science to logic have seen categorical logic develop ed in the s fruitfully applied in signicant ways in b oth theory and practice Given the rapid and enormous development of the sub ject and the availability of suitable gradu ate texts and sp ecialized survey articles we shall only examine a few of the areas that app ear to the author to have conceptual and mathematical interest to the readers of this Handb o ok Along with the many references in the text the reader is urged to examine the nal section Literature Notes where we reference omitted imp ortant areas as well as the Bibliography We shall b egin by discussing the close connections of certain closed categories with typ ed lamb da calculi on the one hand and with the pro of theory of various logics on the other It cannot b e overemphasized that mo dern computer science heavily uses formal syntax but we shall try to tread lightly The socalled CurryHoward isomorphism which identies formal pro ofs with lamb da terms hence with arrows in certain free categories is the cornerstone of mo dern programming language semantics and simply cannot b e overlo oked o Notation We often elide comp osition symb ols writing g f A C for g f A C whenever f A B and g B C To save some space we have omitted large numb ers of routine diagrams which the reader can nd in the sources referenced Categories Lamb da Calculi and FormulasasTyp es Cartesian Closed Categories Cartesian closed categories cccs were develop ed in the s by F W Lawvere Law Law Both Lawvere and Lamb ek L stressed their connections to Churchs lamb da calculus as well as to intuitionistic pro of theory In the s work of Dana Scott and Gordon Plotkin established their fundamental role in the semantics of programming languages A precise equivalence b etween these three notions cccs typ ed lamb da calculi and intuitionistic pro of theory was published in Lamb ek and Scott LS We recall the appropriate denitions from LS Ob jects Distinguished Arrows Equations ! A Terminal A f A f A AB o A B A hf g i f 1 1 AB o Pro ducts A B A B B hf g i g 2 2 f g C A C B o o h h hi h 1 2 hf g i C A B h C A B A A o o i f Exp onentials B ev B A B ev hf 1 2 AB f C A B o o ev hg i g 1 2 f A A C B g C B Figure CCCs Equationally Denition i A cartesian category C is a category with distinguished nite pro ducts equivalently binary pro ducts and a terminal ob ject This says there are isomorphisms natural in A B C H om A fg C H om C A B H om C A H om C B C C C ii A cartesian closed category C is a cartesian category C such that for each ob ject A C A the functor A C C has a sp ecied right adjoint denoted That is there is an isomorphism natural in B and C A H om C A B H om C B C C For many purp oses in computer science it is often useful to have categories with explicitly given strict structure along with strict functors that preserve everything on the nose We may present such cccs equationally in the spirit of multisorted universal algebra The arrows and equations are summarized in Figure These equations determine the isomorphisms and In this presentation we say the structure is strict meaning there is only one ob ject representing each of A A the ab ove constructs A B B The exp onential ob ject B is often called the function space of A and B In the computer science literature the function space is often denoted A B while the f A arrow C B is often called currying of f Remark Following most categorical logic and computer science literature we do not assume cccs have nite limits Law LS AC Mit in order to keep the corresp ondence with simply typ ed lamb da calculi cf Theorem b elow Earlier b o oks cf Mac do not always follow this convention Let us list some useful examples of cartesian closed categories for details see LS Mit Mac Example The category Set of sets and functions Here A B is a chosen cartesian pro duct ev A A and B is the set of functions from A to B The map B A B is the usual evaluation map f A B is the map c a f c a while currying C An imp ortant subfamily of examples are Henkin models which are cccs in which the terminal ob ject is a generator Mit Theorem More concretely for a lamb da calculus signature with freely generated typ es cf Section b elow a Henkin model A is a typ eindexed family of A sets A fA j a typ e g where A fg A A A A A which forms a ccc with 1 resp ect to restriction of the usual ccc structure of Set In the case of atomic base sorts b A is b some xed but arbitrary set A ful l type hierarchy is a Henkin mo del with full function spaces ie A A A op C Example More generally the functor category Set of presheaves on C is cartesian closed Its ob jects are contravariant functors from C to Set and its arrows are natural transformations op C b etween them We sketch the ccc structure given F G Set dene F G p ointwise on F A ob jects and arrows Motivated by Yonedas Lemma dene G A N ath F G where A F h H omA This easily extends to a functor Finally if H F G dene H G by a h c H ha c C C A Functor categories have b een used in studying problematic semantical issues in Algollike lan guages Rey Ol OHT Ten as well as recently in concurrency theory and mo dels of calculus CSW CaWi Sp ecial cases of presheaves have b een studied extensively Mit LS op C Let C b e a p oset qua trivial category Then Set the category of Kripke mo dels over C may b e identied with sets indexed or graded by the p oset C Such mo dels are fundamental in intuitionistic logic LS TrvD and also arise in Kripke Logical Relations an imp ortant to ol in semantics of programming languages Mit OHT OHRi Let C O X the p oset of op ens of the top ological space X The sub category S hX of sheaves on X is cartesian closed op C is the category of M Let C b e a monoid M qua category with one ob ject Then Set sets ie sets X equipp ed with a left action equivalently a monoid homomorphism M E ndX where E ndX is the monoid of endomaps of X Morphisms of M sets X and Y are equivariant maps ie functions commuting with the action A sp ecial case of this is when M is actually a group G qua category with one ob ject where all maps are isos In op C that case Set is the category of Gsets the category of p ermutational representations of G Its ob jects are sets X equipp ed with left actions G S y mX and whose morphisms are equivariant maps We shall return to these examples when we sp eak of Lauc hli semantics and Full Completeness Section Example CPO Ob jects are p osets P such that countable ascending chains a a a 0 1 2 have suprema Morphisms are maps which