(Ventures Into) Dependent Type Theory with Reductions
Total Page:16
File Type:pdf, Size:1020Kb
(Ventures into) Dependent Type Theory with Reductions Sam Speight [email protected] Spring 2019 Last updated July 7, 2020 In this note we introduce dependent type theory with reductions and categories with ordered families, the former being an internal language for the latter. This is motivated by the desire to extend to dependent type theory Gallier’s [Gal95] semantic method for proving metatheoretic properties of type theories involving reduction, which requires se- mantics that distinguishes judgementally equal objects and instead models reductions between them. 1 Introduction and motivation In [Gal95], Gallier presents a method for proving properties that involve reduction of terms of simply typed ¸-calculus and system F; instantiating his method, he proves confluence and strong normalisation for each of these type theories. Gallier’s motivation is to render the (Tait-Girard) “reducibility" method in more semantic terms. Much of the work is carried out at the level of pre-applicative ¯-structures, novel structures that serve to interpret well-typed terms and reductions between them (and so distinguish between terms that are judgemen- tally equal/convertible). Gallier mentions that he attempted to lift his method to dependent type theory, though ran into a problem that ‘has to do with type-conversion rules: a term no longer has a unique type, and we run into a coherence problem in attempting to define the meaning of term by induction on typing-derivations’; getting round this problem is described as ‘the most pressing open problem’ [Gal95, p. 364]. As far as we understand, the issue is to get a good notion of pre-applicative ¯-structures for the dependent setting. In this note, we introduce categories with ordered families (CwOFs), a natural higher- dimensional generalisation of Dybjer’s categories with families (CwFs) [Dyb95]. We believe that CwOFs could play the role of pre-applicative ¯-structures in a lifting of Gallier’s method to dependent type theory. To interpret type theory in CwOFs, as in CwFs, a partial interpre- tation function is given taking untyped syntax to the relevant part of a CwOF; after this it is proved that the interpretation function is defined on well-typed syntax, as is usual when in- terpreting dependent type theory (see [Hof97]. In this way, Gallier’s problem is circumvented. The internal language of CwOFs is a type theory that we call dependent type theory with reductions (DTTwR). As the aim is to give a model of dependent type theory that models reductions between terms and types (reductions can occur between types when types may depend on terms), and so distinguishes between terms and types that are convertible in de- pendent type theory as usually formulated (DTT, which we take to be something like that presented in [Hof97]), this must of course be reflected in DTTwR. Thus we have a notion of judgemental reduction, and we replace computation rules (the ¯-rule for ¦-types, for in- stance) as judgemental equalities with computation rules as judgemental reductions (we do 1 retain a notion of judgemental equality, but this has rather a different role than it usually does). However, due to the dependency of types on terms, modifying judgemental equality has an effect on the typing of terms. Thus, DTTwR bears a non-trivial relationship to DTT. We are yet to relate DTTwR to DTT and untyped reduction, as well as carry out the development of Gallier’s method for dependent type theory using CwOFs. We give some thoughts on the first of these tasks in 4.2 Future work. 2 Dependent type theory with reductions We work with a relatively straightforward type theory, which has one closed ground type G0, one other ground type G1 depending on terms of type G0 and ¦-types. Neither of the ground types are taken to have any term constructors, thus the only term constructors we have are c SUB for ¸-abstraction, application and coercion A,A0 (t) (see the rule in Figure1). (In this way we have types genuinely depending on terms.) As well as the usual judgements for well-typed contexts, types and terms, and judgemen- tal equality for contexts, types and terms, we have judgemental reduction for types ¡ A ` ) A0 type and terms ¡ t t 0 : A, with the intuitive meaning that, in the first case, say: in ` ) context ¡ the term t of type A reduces to the term t 0 of type A. Judgemental reduction is meant to capture the reflexive transitive closure of ¯-reduction acting in all contexts (we are not concerned with ´ here). The typing rules are given in Figure1 (p. 11), with the omission of the usual strucutral rules, the ususal rules saying that judgemental equality is a congruence on type and term for- mers and the usual rules for ¦-formation, ¸-abstraction and application (see [Hof97, §2]. Im- portantly, judgemental reduction is not symmetric, and we do not make the ¯-rule a judge- mental equality, but a judgemental reduction. The SUB rule (for “subsumption”, due to its likeness to the eponymous rule in subtyping disciplines) coerces a type to a “lower", more reduced, type. Note that whenever we have ¡ t t 0 : A we are careful in making sure that t and t 0 should be well-typed with type A in ` ) context ¡ (and similarly for types)—it is not as simple as repeating the rues for judgemental equality but without symmetry. For example, in the -¦ rule, when giving conditions under ) which Q B reduces t Q B , B and B are compared in context ,x : A; but B expects (x:A) (x:A0) 0 0 ¡ 0 the variable x to have type A0, and so in B 0 we replace x by its coercion down to the type A0. The last two rules allow coercions to be pushed inside ¸ and App. Note that we use fully annotated syntax. However, we take the view that annotations are annotations: they are for the purpose of rigorously interpreting the syntax into the semantics and therefore do not contribute to reductions. 3 Categories with ordered families Recall that a CwF [Dyb95] (again, see also [Hof97], which we rely on for results and notation, often without explicit mention) involves a functor Cop Fam, ! where C is a category (with a terminal object) and Fam is the category of set indexed families of sets. In moving from CwFs to CwOFs, we “bump-up” the dimension of each of the above components—and add to the comprehension axiom that is also required of a CwF. As we have a proof-irrelevant notion of judgemental reduction, we need only add extra layers of preordered structure. First we describe the bumped-up version of Fam. Definition 3.1. The category OFam (for “ordered families”) is given by the following. 2 • Objects are triples ¡ ¢ I,(Pi )i I ,(ci i )(i i ) Mor(I) , 2 ) 0 ) 0 2 where I and each of the Pi are preorders (with a morphism from a to b in some pre- order denoted by a b), and the ci i : Pi Pi are monotone functions such that: ) ) 0 ! 0 ci i idP , ) Æ i ci i ci i ci i . 0) 00 ± ) 0 Æ ) 00 The ci i are the semantic coercion functions. ) 0 • A morphism (I,(Pi ),ci i ) (J,Q j ,c j j )) is a pair: ) 0 ! ) 0 ¡ ¢ f : I J,(fi : Pi Q f (i))i I , ! ! 2 where f and each fi are monotone , such that the following square commutes. ci i ) 0 Pi Pi 0 fi f i0 Q f (i) c Q f (i) f (i)(i0) Composition and identities are as in Fam: the composition of (f ,(fi )) : (I,(Pi ),(ci i )) ) 0 ! (J,(Q j ),(c j j )) and (g,(gi )) : (J,(Q j ),(c j j )) (K ,(Rk ),(ck k )) is given by: ) 0 0 ) 0 ! ) 0 (g,(g )) (f ,(f )) : (g f : I K ,g f : P R ). j ± i Æ ! f (i) i i ! g(f (i)) • A 2-cell (f ,(fi )) (g,(gi )) : (I,(Pi ),ci i ) (J,(Q j ),(c j j ))) is determined pointwise ) ) 0 ! ) 0 in the codomain; that is, there is a 2-cell (f ,(f )) (g,(g )) whenever: i ) i (i) i i 0 I. f (i) g(i 0) J, and 8 ) 2 ) 2 (ii) i i 0 I and p Pi ,p0 Pi such that ci i (p) p0 Pi we have that: 8 ) 2 8 2 2 0 ) 0 ) 2 0 c f (i) g(i )(fi (p)) gi (p0) Qg(i ). ) 0 ) 0 2 0 y We use this category in the definition of CwOFs as follows. Definition 3.2. A category with ordered families is given by a preordered 2-category C (in which a 2-cell between f and g is denoted f g) with a (1-)terminal object and a preordered ) 2-functor F : Cop OFam, ! ¡ ¢ (where, like with CwFs, we write F ¡ as Ty(¡),(Tm(¡, A))A Ty(¡),(cA A )A A Ty(¡) and we 2 ) 0 ) 02 write both components of the morphism (Ty,Tm)(f : ¡ ¢) as ( ){f }; 2-cells—as well as ! ¡ preorder relations—are aslways written with ), such that the following comprehension ax- ) iom is satisfied. For any ¡ C and A Ty(¡) there is an object ¡.A C and a morphism p(A): ¡.A A and 2 2 2 ! semantic term v Tm(¡.A, A{p(A)}) such that for any f : ¢ ¡ and t Tm(¢, A{f }) there is A 2 ! 2 a unique morphism f ,t : ¢ ¡.A such that the following commutes. h iA ! v A ¡.A ( ){ f ,t A } ¡ h i p(A) f ,t A h i t ¢ ¡ f 3 (This much is the comprehension axiom for CwFs.) Moreover, whenever A A0 Ty(¡) ) 2 we have a unique morphism r (A, A0): ¡.A ¡.A0 in C such that p(A0) r (A, A0) p(A) and ! ± Æ v A {r (A, A0)} cA A (v A) and whenever t t 0 Tm(¢, A{f }) then f ,t A f ,t 0 A.