Extensional Concepts in Intensional Type Theory
Total Page:16
File Type:pdf, Size:1020Kb
Extensional concepts in intensional type theory Martin Hofmann Do ctor of Philosophy University of Edinburgh Abstract Theories of dep endent types have b een prop osed as a foundation of constructive mathematics and as a framework in which to construct certied programs In these applications an imp ortant role is played by identity types which internalise equality and therefore are essential for accommo dating pro ofs and programs in the same formal system This thesis attempts to reconcile the two dierent ways that type theories deal with identity types In extensional type theory the prop ositional equality induced by the identity types is identied with denitional equality ie conversion This renders typechecking and wellformedness of prop ositions undecidable and leads to nontermination in the presence of universes In intensional type theory prop os itional equality is coarser than denitional equality the latter b eing conned to denitional expansion and normalisation Then typechecking and wellformedness are decidable and this variant is therefore adopted by most implementations However the identity type in intensional type theory is not p owerful enough for formalisation of mathematics and program development Notably it do es not identify p ointwise equal functions functional extensionality and provides no means of redening equality on a type as a given relation ie quotient types We call such capabilities extensional concepts Other extensional concepts of interest are uniqueness of pro ofs and more sp ecically of equality pro ofs subset types and prop ositional extensionalitythe identication of equivalent prop ositions In this work we investigate to what extent these extensional concepts may b e added to intensional type theory without sacricing decidability and existence of canonical forms The metho d we use is the translation of identity types into equivalence relations dened by induction on the type structure In this way type theory with i Abstract ii extensional concepts can b e understo o d as a highlevel language for working with equivalence relations instead of equality Such translations of type theory into itself turn out to b e b est describ ed using categorical mo dels of type theory We thus b egin with a thorough treatment of categorical mo dels with particular emphasis on the interpretation of typetheoretic syntax in such mo dels We then show how pairs of types and predicates can b e organised into a mo del of type theory in which subset types are available and in which any two pro ofs of a prop osition are equal This mo del has applications in the areas of program extraction from pro ofs and mo dules for functional programs For us its main purp ose is to clarify the idea of syntactic translations via categorical mo del constructions The main result of the thesis consists of the construction of two mo dels in which functional extensionality and quotient types are available In the rst one types are mo delled by types together with prop ositionvalued partial equivalence relations This mo del is rather simple and in addition provides subset types and prop ositional extensionality However it do es not furnish prop er dep endent types such as vectors or matrices We try to overcome this disadvantage by using another mo del based on families of typevalued equivalence relations which is however much more complicated and validates certain conversion rules only up to prop ositional equality We illustrate the use of these mo dels by several small examples taken from b oth formalised mathematics and program development We also establish various syntactic prop erties of prop ositional equality includ ing a pro of of the undecidability of typing in extensional type theory and a corres p ondence b etween derivations in extensional type theory and terms in intensional type theory with extensional concepts added Furthermore we settle armatively the hitherto op en question of the indep endence of unicity of equality pro ofs in intensional type theory which implies that the addition of pattern matching to intensional type theory do es not yield a conservative extension Acknowledgements This thesis would not have app eared without the generous help and supp ort of many p eople to whom I wish to express my deep thanks here The rst p erson to thank here is my sup ervisor Don Sannella He has taught me a lot on research in general and in particular on writing in our weekly meetings He created a wonderful environment which allowed me to fo cus on my research only without b eing o ccupied by nancial or administrative problems His detailed comments on an earlier draft of this thesis resulted in imp ortant improvements My second sup ervisor Gordon Plotkin has provided valuable guidance in discussions and in particular has suggested and made p ossible a visit to Gothenburg during which the idea for this thesis work arose Terry Stroup my former sup ervisor from Erlangen brought me to Edinburgh and lo oked after me during my rst year of studies I am grateful to Ro d Burstall and Andy Pitts for agreeing to b e examiners of this thesis Ro d Burstall was a step sup ervisor as he once put it during the whole p erio d of this research and help ed me a lot b oth p ersonally and scientically My friend and colleague Thorsten Altenkirch provided invaluable input to my research and moral supp ort in many sometimes lively discussions He carefully pro ofread an earlier draft and suggested ma jor improvements I also owe him thanks for introducing me to Bath Street Housing Co op the place where I sp ent my rst two years in Edinburgh My thanks go to the Co op members to o for making me feel at home in Scotland Thomas Streicher help ed me in many conversations made imp ortant sugges tions and was a wonderful host during several visits of mine to Munich iii Acknowledgements iv The LFCS provided an excellent environment for scientic work The courses the visitors the computing facilities and the administration to ok away most of the diculties other young researchers have to cop e with Thanks for stimulating conversations and suggestions on the sub ject of this thesis go to David Aspinall Adriana Compagnoni Thierry Co quand Wolfgang Degen Peter Dyb jer Bart Jacobs Per MartinLof Zhaohui Luo James Mc Kinna Uwe Nestmann Benjamin Pierce Alex Simpson Martin Steen Makoto Takeyama and the members of the Edinburgh Lego Club Prof Ulrich Herzog and his colleagues have provided a desk and a computer and b efore all a very friendly atmosphere during two p erio ds which I sp ent in Erlangen I wish to acknowledge nancial supp ort by Edinburgh University the DAAD and the Europ ean Union HCM programme contract number ERBCHBICT My very sp ecial thanks go to my wife Annette for her love and patience during our geographical separation Declaration This thesis was comp osed by myself and the work rep orted herein is my own unless explicitly declared otherwise Large parts of the material in Chapter have already b een published in Sect Sect together with Th Strei cher Sect v Table of Contents Introduction Denitional and prop ositional equality Extensional concepts Metho d The use of categorical mo dels Syntactic mo dels Applications Application to machineassisted theorem proving Overview Syntax and semantics of dep endent types Syntax for a core calculus Raw syntax Judgements Notation Derived rules and metatheoretic prop erties Highlevel syntax Telescopes Elements of telescop es and context morphisms vi Table of Contents vii Denitions and substitution Further type formers Unit type types Function and cartesian pro duct types The Calculus of Constructions Universes Quotient types Abstract semantics of type theory Syntactic categories with attributes Type constructors Interpreting the syntax Partial interpretation Soundness of the interpretation Discussion and related work Syntactic prop erties of prop ositional equality Intensional type theory Substitution Uniqueness of identity Functional extensionality Extensional type theory Comparison with Troelstras presentation Undecidability of extensional type theory Interpreting extensional type theory in intensional type theory Table of Contents viii An extension of TT for which the interpretation in TT is I E surjective Conservativity of TT over TT E I Discussion and extensions Conservativity of quotient types and functional extensionality Related work Pro of irrelevance and subset types The renement approach The deliverables approach The deliverables mo del