Lambda-Free Logical Frameworks

We present the definition of the logical framework TF, the Type Framework. TF is a lambda-free logical framework; it does not include lambda-abstraction or product kinds. We give formal proofs of several results in the metatheory of TF, and show how …

Authors: Robin Adams

Lambda-F ree Logica l F rameworks ✩ Robin Adams a a R oyal Ho l loway, University of L ondon Abstract W e presen t t he definition of the logical fra mework TF, the T yp e F r amework . TF is a la mbda-free lo gical framework; it does not include la mbda-abstra ction or pro duct kinds. W e give for mal pro ofs of several re sults in the metatheory of TF, and s how how it ca n b e co nserv atively embedded in the log ical framework LF: its judgemen ts can b e seen as the judgements of LF th a t are in beta-no rmal, eta-long normal form. W e s how how se veral prop erties, such as the injectivity of constants and the strong normalisa tio n of an ob ject theory , can b e prov en more easily in TF, and then ‘lifted’ to LF. Key wor ds: logical framework, type theory, lambda - free 2000 MSC: 03B15 , 03B2 2, 0 3B35, 03B70, 68T1 5 1. In tro duction A lo gic al fr amework is a t yping sys tem in tended as a meta-languag e for the sp ecification of other fo rmal systems, which may themselves b e type theories or o ther systems of logic, such a s predica te lo gic. T raditionally , lo g ical fra me- works ar e based on a typed la mbda calculus; v ar iable binding is represented by lambda-abstr action in the framework, a nd substitution by application in the framework. The corresp ondence b etw een the ob ject theor y and its repr esenta- tion in the framework is not exa c t: each en tity of the ob ject theory is r e presented by more than one ob ject in the framework — typically , β η -conv er tible o b jects represent the sa me entit y o f the ob ject theory — and there are ob jects in the framework (such as partially applied meta - functions) that do not corresp ond to a ny entit y of the o b ject theory . It is therefo r e necessa ry to prov e ade quacy the or ems establishing the rela tionship b etw een an ob ject theory and its rep- resentation in a logical fr a mework; and thes e theo r ems are notor iously often difficult to prove. ✩ Corresp onding address: Departmen t of Computer Science, Roy al H ollow ay , Universit y of London, Egham Hill , Egham, Surrey . TW20 0EX. England. T el.: +44 1784 443421. F ax: +44 1784 439786. Email robin@cs.rhul .ac.uk This research was s upp orted b y the UK EPSRC researc h gr an t Pythagoras GR/R84092, the EU F r amewo r k V I grant TYPES 510996 , and the UK EPSRC researc h fellowship EP/D066638/1 . Pr eprint submitte d to Elsevier Octob er 30, 2018 It is po s sible to construct a logical framework that do es not employ all the ap- paratus of the la mbda calculus. W e c a n construct logica l framew o rks that do not make use of abstr action a nd substitution, but instead in volve only parametrisa - tion and the instantiation o f parameter s. W e shall call these lamb da-fr e e logical frameworks. They can be seen as frameworks that only use β - normal, η -long normal fo rms. Lambda-fr e e frameworks provide a more faithful r epresentation of an ob ject theory — there is a one-to -one c o rresp o ndence b etw een the ob jects of the framework and the terms and types of the ob ject theory . Because of this, many results including a de q uacy theorems are eas ier to prove in a lambda-free framework. It is often p ossible to emb e d a lambda-free framework L within a traditiona l framework F ; that is, to provide a tr anslation from L int o F such that the deriv a ble judgemen ts of L ma p ont o ex a ctly the der iv a ble judgements of F that are in normal for m. F can then b e see n as a cons e r v a tive extensio n of L . Once this embedding has b een established, we can ‘lift’ results fr o m L to F ; that is, we can prove a result for L , and then deduce that the corr esp onding r esult holds for F as a corolla ry . There is a price to b e paid for using a lambda-free fra mework: the early metatheoretic results are m uch more difficult to establish, as is the so undness of the embeddings discus sed ab ov e. But this is a ‘o ne-time’ cost; once this price has b een paid, it is compara tively easy to prov e ma ny results in the lambda-fre e framework, and then lift them to the traditional frameworks. 1.1. Backgr ound and O utline The term ‘lam b da- free log ical fra mework’ w as first use to descr ib e the frame- work P AL + [1], which uses para metrisation and definitions as its basic no tions rather tha n lam b da- abstractio n. In P AL + , how ever, it is p o ssible to form ab- stractions (using pa r ametric definition) that ca n then be applied to o b jects. W e ar e us ing the phra se ‘lambda-free lo gical framework’ in a s tr icter sens e, to describ e a fra mework which do es not per mit abs tractions to be applied to ob jects, a nd which therefore contain no fra mework-level notion of reduction. W e shall use the phrase ‘traditiona l fra mework’ throughout this pap er to denote a logical framework that is not lam b da-free , such a s the Edinburgh LF [2] or Martin-L¨ of ’s Logical F ramework [3 ]. When w e repres ent a formal system S within a logica l framework F , the system S is refer red to as the obje ct the ory . The fr a mework TF first app ear e d in an unpublished no te by Aczel [4]. It was developed b y myself in my thesis [5]. In particular , I int r o duced the set of a r ities to organis e the grammar , and ma de explicit the definition of instantiation. In Section 2, w e give the formal definition of TF, and descr ib e how a t yp e theory may be sp ecified in TF. In Section 3, we b egin to prov e the metatheoretic prop erties of TF. W e would lik e to prove that these prop er ties ho ld under an arbitrar y t yp e theory specifica tion in TF. How ever, fo r most of the prop erties considered in Section 3 , we a re at present only able to prove them for tw o larg e classes o f sp ecifications — those with no equation declara tio ns, and those which 2 do not inv olve v a riables of o rder 2 or highe r 1 . T he pro ofs are given in Section 3, with the mor e technical pro o fs given in the App endix. In Section 4, we des crib e a s econd lambda-free logical framework TF k , which is a Churc h-typed version of TF; that is, the b ound v ar iables are la b elled with their kinds. W e define translations b etw e e n TF and TF k in Section 4 . It is often very conv enient to hav e these t wo versions of TF av ailable, and to b e able to mov e b etw een them at will. In Section 5 , we show how TF may be em b edded in L F, a Ch urch-typed version of Martin-L¨ of ’s Logica l F ra mework [6]. W e do so b y defining a tra ns- lation from TF k to LF and from LF to TF, taking adv a nt a ge of the results of Section 4. W e show how this em b edding allows results to b e lifte d ; that is, a result may b e pr oven to hold for TF, and the fact that it holds for LF follows as an easy corollar y . W e demonstrate this for tw o r esults: the injectivit y of t yp e constructors , a nd str ong normalisatio n of a n ob ject theory . In Section 6, we descr ib e tw o other frameworks that have app ear ed in the literature which are lambda-free logica l fra meworks in the stricter sense: the Concurrent Logical F ramework (Co ncurrent LF) [7, 8] and DMBEL [9, 10]. In both of these frameworks, abstractions may b e formed, and a co nstant or v ar iable may b e applied to an a bstraction, but abstractions may not themselves be applied to o b jects. Each of these may b e conser v a tively embedded in TF. T ha t is, we can find a subsystem S o f TF such that there exist bijective tra nslations b etw een Concur - rent LF a nd S , and such that TF is a conserv ative extension o f S . Likewise, we can find a subsystem S ′ such that ther e e x ist bijective translations be t ween DM- BEL and S ′ , a nd such that TF is a conser v ative ex tension of S ′ . It is p os sible to find many such subsystems of TF, which all extend one a nother cons erv a tively; this idea, called a ‘modular hierar ch y of logical frameworks’, w as describ ed in Adams [11] and the for mal details given in Adams [5]. W e give the details in the case of Concur rent LF and DMBE L in Section 6. Abbr eviation. Thr o ughout this pap er, the phrase ‘induction h yp othesis ’ shall be abbrevia ted to ‘i.h.’. 2. The T yp e F ramework TF W e pr esent our first example of a la mbda -free fra mework, the T yp e F ra me- work TF. The framework TF includes nothing but what is essential for repre- senting an ob ject theory . In particular, it c o ntains neither lambda-a bs traction nor lo cal definition; its ba sic concepts are par ametrisatio n, the instantiation of parameters , and the declaration of equa tions. 1 In Adams [5], the prop erties in Section 3 were claimed to hold under an arbitrary sp eci- fication, but a mi stak e has since b een found in the pro of. 3 2.1. Gr ammar 2.1.1. Arities W e b egin by introducing the set of arities , with which w e shall organis e the syntax of TF. The arities a re defined inductively th us: If α 1 , . . . , α n are arities, then ( α 1 , . . . , α n ) is an a rity . The base case o f this definition is the case n = 0, yielding the arity (), which we shall write as 0 . The next ar ities tha t can b e formed are n z }| { ( 0 , . . . , 0 ) for p ositive n ; we shall write this ar ity as n . The next arities that ca n be formed are ( n 1 , . . . , n k ), and so forth. The intuition b ehind the arities is that a n ( α 1 , . . . , α n )-ary function is a function that ta kes n arguments — namely an α 1 -ary function, . . . , and an α n -ary function — and returns an ent ity (term or type) of the ob ject theory . In par ticular, a 0 -ary (or b ase ) function is just an entit y of the ob ject theory; a 2 -a ry function is a binar y op er ation on the entities of the ob ject theory; and so forth. W e denote by α ˆ β the c onc atenation of the tw o a rities α and β : ( α 1 , . . . , α m ) ˆ ( β 1 , . . . , β n ) ≡ ( α 1 , . . . , α m , β 1 , . . . , β n ) . W e also ascr ib e a n or der to each ar ity as follows: • The only 0th-or der, or b ase , arity is 0 . • If the highest order a mong the arities α 1 , . . . , α n is k , then ( α 1 , . . . , α n ) is a k + 1st-order arity . F or example, the first-o rder arities are those of the form n for p o sitive n , a nd the second-o r der arities a re those of the for m ( n 1 , . . . , n k ) where at leas t o ne n i is po sitive. W e s ay the arity α is a sub arity of the a rity β if α o ccurs inside β . W e say α is a pr op er subar it y o f β if α is a suba rity of β and α 6≡ β . 2.2. Obje ct s The obje cts of TF are expre ssions intended to r epresent the terms and types of the o b ject theory . They are built up from variables a nd c onstants , to each of which is assigned an a r ity . The constants shall be used fo r the type constructors and term constructo rs of the o b ject theory . The v ariables shall b e used as the v ar iables of the ob ject theory . 4 The set o f ob jects is defined by the following inductive definition: If z is an α -ary c onstant or v ariable, wher e α ≡ (( α 11 , . . . , α 1 r 1 ) , . . . , ( α n 1 , . . . , α nr n )) , then z [[ x 11 , . . . , x 1 r 1 ] M 1 , . . . , [ x n 1 , . . . , x nr n ] M n ] (1) is an ob ject, where each x ij is a n α ij -ary v ar iable, and each M i an ob ject. Each x ij is b ound within the corr esp onding ob ject M i , a nd we identify ob jects up to α -conv er s ion. The ba s e case of this definitio n is that, if z is a base v ar iable or constant (that is, a 0 -ary v ariable or consta nt ), then z [] is an ob ject; we sha ll henceforth write this o b ject as just z . Likewise, if z is an n -a ry v ariable or constant, then z [[] M 1 , . . . , [] M n ] is an ob ject for any ob jects M 1 , . . . , M n ; w e shall write this ob ject s imply as z [ M 1 , . . . , M n ]. The sub express io ns of the ob ject (1) such as [ x 1 , . . . , x r ] M a re not first- class entities of TF; they ca nnot o ccur except a s arguments to some v aria ble or constant z . Nevertheless, it shall be convenien t to have s ome w ay o f refer - ring to these pieces of raw syntax. W e shall therefor e intro duce the following terminology: • An ( α 1 , . . . , α n )-ary variable se quenc e is a s equence of n distinct v ar iables h x 1 , . . . , x n i , where x i has arity α i . • An α -ar y abstr action is an express io n o f the form [ ~ x ] M , where ~ x is an α -ary v ar iable sequence, and M an o b ject. W e tak e each member of ~ x to b e b ound within this abstraction, and iden tify abstra ctions up to α - conv ersio n. • An ( α 1 , . . . , α n )-ary abstr action se qu enc e is a sequence h F 1 , . . . , F n i , where F i is an α i -ary abstractio n. Thu s , a n ob ject has the form z [ ~ F ], where z is an α -ary v a riable o r cons ta nt , and ~ F an α -a ry a bs traction sequence. W e shall often write this ob ject as just z ~ F . W e note that the only ex pressions that can o cc ur as arguments to a symbol are a bstractions. In the situations where we would naturally wis h to write a v ar iable or constant in an argument p o s ition, we instead write its η - long form . Definition 2.1 ( η -long F orm). Giv en an y α -ary v a riable or co nstant z , the η -long form z η of z is the α -ary abstr a ction defined by r ecursion on α as follows: If α ≡ ( α 1 , . . . , α n ), then z η ≡ [ x 1 , . . . , x n ] z [ x η 1 , . . . , x η n ] , where each x i is an α i -ary v ariable. (By α -conv ersion, it do es no t matter which v ar iables w e cho ose.) 5 2.3. Her e ditary S ubstitution and Employment W e cannot use the fa milia r op er ation of substitution in TF. The result of substituting a n abstrac tion [ ~ y ] M for the v a riable x in the o b ject x ~ F is not an ob ject o f TF; ra ther, it would b e a β -redex. Instead, we introduce an op er a tion that we name instant iation . The o p- eration o f instantiating an abstra ction F for a v ar iable x can b e thought of as s ubs tituting F for x , then r e ducing to normal fo rm (that is, β -normal, η -long form). How ever, w e no te that the definition do es not use any notion of reduction. Definition 2.2 (Instantiation). Giv en an α -ar y abstraction F , an α -a ry v a ri- able x , and an ob ject N , the ob ject { F /x } N , the re s ult o f instantiating F for x in N , is defined b y recurs ion firstly on the a rity α , secondly on the o b ject N , as follows: { F /x } z [ G 1 , . . . , G n ] ≡ z [ { F /x } G 1 , . . . , { F / x } G n ] ( z 6≡ x ) If F ≡ [ t 1 , . . . , t n ] P , then { F /x } x [ G 1 , . . . , G n ] ≡ {{ F /x } G 1 /t 1 } · · · {{ F /x } G n /t n } P . W e assume here, throug h α -conv ersio n, that no t i o ccurs free in any G j . W e shall also introduce a no tational conv ention that shall play the role of abstraction: if x is an α -a ry v a riable and F a β -ary abstractio n, then [ x ] F is an ( α ) ˆ β -ary abstrac tio n, defined by [ x ][ y 1 , . . . , y n ] M ≡ [ x, y 1 , . . . , y n ] M . Finally , we define an op eration, which we shall call employment , to play the role usually taken by application. The result of employing F on G , denoted F • G , can be thought of as the normal form of the application F G . The definition is: Definition 2.3 (Em ploy me n t). Given an ( α ) ˆ β -ary a bstraction [ x ] F and an α -ary abstractio n G , the β -ary abstra ction F • G , the r esult of employing [ x ] F on G , is defined by ([ x ] F ) • G ≡ { G/x } F . W e hav e used our newly intro duced notation [ x ] M in this definition; wr itten out in full, the ab ov e equation is ([ x, y 1 , . . . , y n ] M ) • G ≡ [ y 1 , . . . , y n ] { G/x } M . W e s hall abbre viate the rep eated use of employmen t a s follows: if ~ G is the abstraction s e quence h G 1 , . . . , G n i , then F • ~ G a bbreviates F • G 1 • G 2 • · · · • G n , that is, (( · · · ( F • G 1 ) • G 2 ) • · · · ) • G n . 6 R emark. W e note that there is a stro ng cor resp ondence betw een o ur syntax and the simply-typed lambda calculus. O ur arities corres p o nd to the types o f the simply-typed lambda calculus, a nd our abstractions to the terms. Insta nt ia tion corres p o nds to the s trategy of innermost reduction. Thus, the fact that our definition of instant ia tion is total co rresp onds to the fact that the simply-typed lambda calculus is weakly normalis able. 2.4. Kinds A b ase kind in TF is e ither the sym b ol T yp e , or ha s the form El ( A ) for s ome ob ject A . The inten tion is that ea ch type T of the o b ject theo r y is repres e nted by an o b ject [ [ T ] ] of kind T yp e ; the ter ms of type T a re then r epresented by the ob jects of kind El ([ [ T ] ]). In addition to these, w e intro duce a set of α -ary pr o duct kinds for every ar ity α . These s ha ll b e used to giv e kinds to the v ariables a nd co ns tants of hig he r arity . The definition is by r e cursion on α : An ( α 1 , . . . , α n )-ary pro duct kind is an expressio n of the form ( x 1 : K 1 , . . . , x n : K n ) T (2) where the x i s ar e dis tinct v ar iables, x i being of a rity α i ; each K i is an α i -ary pro duct kind; a nd T is a ba se kind. W e ta ke each v aria ble x i to b e b ound within K i +1 , K i +2 , . . . , K n and T in this pro duct kind, and ident ify pro duct kinds up to α -conv ers ion. The in tuition is that the kind (2 ) represents the colle ction of functions that take n a r guments — namely F 1 of kind K 1 , F 2 of kind { F 1 /x 1 } K 2 , . . . , and F n of kind { F 1 /x 1 , . . . , F n − 1 /x n − 1 } K n — and returns an ob ject of kind { F 1 /x 1 , . . . , F n /x n } T . If K ≡ ( x 1 : K 1 , . . . , x n : K n ) T , then we shall write ( y : J ) K for ( y : J, x 1 : K 1 , . . . , x n : K n ) T . Just a s with abstractions, so the pro duct kinds o f non-zero arity ar e not considered first- c lass entities of TF; only the base kinds are. W e shall howev er make use of the higher pro duct kinds to g ive kinds to the v ariables a nd constants of higher a rity . W e sha ll even talk of an abstra ction b eing a mem b er of a pro duct kind; how ever, this shall not b e represented by a primitive judgement form of TF. Contexts. A c ont ext Γ in TF is a sequence o f the form: x 1 : K 1 , . . . , x n : K n where the x i s a re distinct v ariables , and each x i has the same ar it y as the corres p o nding pro duct kind K i . If each x i has arity α i , we say the context Γ has ar it y ( α 1 , . . . , α n ), and its order o (Γ) is then the o r der of ( α 1 , . . . , α n ). The v ar iable sequence h x 1 , . . . , x n i is ca lled the domain of the context Γ, dom Γ. Thu s , an α -ar y kind has the for m (Γ) T , wher e Γ is an α -ar y context and T a base kind. 7 2.5. Judgement F orms There are three primitive judgement forms in TF: Γ v alid Γ ⊢ M : T Γ ⊢ M = N : T where Γ is a con text, M and N are ob jects, and T is a ba se kind. These are int ended to expr e s s that Γ is a v alid context; tha t the ob ject M has k ind T under the cont ex t Γ; and that the ob jects M a nd N ar e e qual ob jects o f kind T under Γ, r esp ectively . W e now intro duce define d judgement forms to deal with the abstr actions and pro duct kinds of higher ar ity: Γ  K kind; Γ  K = K ′ ; Γ  F : K ; Γ  F = G : K . Each o f these judgements is defined to b e a s et o f primitive judgemen ts. W e shall alwa ys use the double turnstile  to indicate a defined judgement form. F or any base kind T , the defined judgement Γ  T kind is defined a s follows: (Γ  T yp e kind) = { Γ v alid } (Γ  El ( A ) kind) = { Γ ⊢ A : T yp e } F or any α -ar y pro duct kind K , the judgement Γ  K kind is defined by: (Γ  (∆) T kind) = (Γ , ∆  T kind) . Equality of ba s e kinds is defined by: (Γ  Type = Ty p e ) = { Γ v alid } (Γ  E l ( A ) = El ( B )) = { Γ ⊢ A = B : Ty p e } W e leav e ‘Γ  Type = E l ( B )’ and ‘Γ  El ( A ) = T yp e ’ undefined. Equality o f pro duct kinds and contexts is defined r ecursively by (Γ  (∆) T = (∆ ′ ) T ′ ) = (Γ  ∆ = ∆ ′ ) ∪ { Γ  T = T ′ } (Γ  hi = hi ) = { Γ v alid } (Γ  ∆ , x : K = ∆ ′ , x : K ′ ) = (Γ  ∆ = ∆ ′ ) ∪ (Γ , ∆  K = K ′ ) F or example, the defined judgement Γ  ( x : A ) B = ( x : C ) D is defined to be the set { Γ v a lid , Γ ⊢ A = C : T yp e , Γ , x : A ⊢ B = D : Type } . The judgement Γ  ( x : A ) B = ( x : C ) Ty p e is undefined. 8 W e int r o duce defined judgement forms Γ  F : K a nd Γ  F = G : K for the inhabita tio n o f a pro duct k ind K by an abstra ction F , and the eq ua lity o f t wo abstractions F and G of pro duct kind K ; here, F , G a nd K mu s t all have the same ar it y . (Γ  [ ~ x ] M : (∆) T ) = { Γ , ∆ ⊢ M : T } (Γ  [ ~ x ] M = [ ~ x ] N : (∆) T ) = { Γ , ∆ ⊢ M = N : T } W e assume here that w e ha ve a pplied α -c onv ersion to ensure that the same v ar iable se q uence ~ x is used in both [ ~ x ] P and [ ~ x ] Q , and is also the doma in of the context ∆. Finally , we introduce judgement forms • Γ  ~ F :: ∆, denoting that ~ F satisfies the context ∆; that is, ~ F is a sequence of a bs tractions whose kinds ar e tho se given by the context ∆; • Γ  ~ F = ~ G :: ∆, denoting that ~ F and ~ G are tw o equal a bstraction sequences that sa tisfy ∆. The judgement forms a re defined as follows: (Γ  hi :: hi ) = { Γ v alid } (Γ  ~ F , F 0 :: ∆ , x : K ) = (Γ  ~ F :: ∆) ∪ (Γ  F 0 : { ~ F / ∆ } K ) Γ  hi = hi :: hi = { Γ v alid } Γ  ( ~ F , F 0 ) = ( ~ G, G 0 ) :: (∆ , x : K ) = (Γ  ~ F = ~ G :: ∆) ∪ (Γ  F 0 = G 0 : { ~ F / ∆ } K ) 2.6. Rules of De duction W e are finally a ble to give the rules of deduction o f TF. They ar e listed in Figure 1 . They consis t o f the rules (emp) and (ctxt) determining when a context is v alid; (v ar) and (v ar eq), the typing and co ngruence rules for the applicatio n of a v ar iable; (ref ), (sy m) and (trans), which ensure that the judgemental eq uality is an equiv alence relatio n; a nd (conv) and (conv eq), which ensure that equa l kinds hav e the same o b jects. W e note in passing how few rules there a re compared to logica l fr a meworks of similar expressiveness suc h a s LF [6] and E LF [2]. In particular, the t wo rules (v ar ) and (v ar eq) do all the work norma lly done by the r ule s g ov erning typing and congruence of applications and abstr actions, and β - and η -contractions. W e hav e shifted this burden fr o m the rules of deduction to the sy nt a x. 2.6.1. T yp e The ory Sp e cific ations An ob ject theory is r epresented in TF by ex tending the log ical framework with several new r ule s of deduction, representing the forma tion of the terms and t yp es o f the ob ject theory and the computation r ule s o f the ob ject theory . 9 (emp ctxt) hi v a lid (ctxt) Γ  K kind Γ , x : K v alid ( x / ∈ dom Γ) (v ar ) Γ  ~ F :: ∆ Γ ⊢ x ~ F : { ~ F / ∆ } T ( x : (∆) T ∈ Γ) (v ar eq) Γ  ~ F = ~ G :: ∆ Γ ⊢ x ~ F = x ~ G : { ~ F / ∆ } T ( x : (∆) T ∈ Γ) (ref) Γ ⊢ M : T Γ ⊢ M = M : T (sym) Γ ⊢ M = N : T Γ ⊢ N = M : T (trans) Γ ⊢ M = N : T Γ ⊢ N = P : T Γ ⊢ M = P : T (conv ) Γ ⊢ M : El ( A ) Γ ⊢ A = B : T yp e Γ ⊢ M : El ( B ) (conv eq) Γ ⊢ M = N : El ( A ) Γ ⊢ A = B : T yp e Γ ⊢ M = N : El ( B ) Figure 1: Rules of Deduction of T F 10 F or mally , a typ e t he ory sp e cific ation in TF is a set of de clar ations , of t wo po ssible forms: • c onstant de clar ations of the form c : K where c is a constant and K a kind of the same ar it y; and • e quation de clar ations of the form (∆)( M = N : T ) where ∆ is a context, M and N ob jects and T a base kind. The int ention is that the cons ta nt declara tions re pr esent the term- and type- constructors of the ob ject theory , and the e quation declara tions represent the computation rules of the ob ject theory . Making the c o nstant declar ation c : (∆) T has the e ffect of adding the follow- ing tw o rules of deduction to the framework (c.f. the r ule s (v ar) a nd (v ar eq)): (const) Γ  ~ F :: ∆ Γ ⊢ c ~ F : { ~ F / ∆ } T (const eq) Γ  ~ F = ~ G :: ∆ Γ ⊢ c ~ F = c ~ G : { ~ F / ∆ } T Making the equation decla ration (∆)( M = N : T ) has the effect of adding the following rule to the framework: (eq) Γ  ~ F :: ∆ Γ ⊢ { ~ F / ∆ } M = { ~ F / ∆ } N : { ~ F / ∆ } T W e define the or der o ( δ ) of a declar ation as follows: the order of c : K is the order o f K , and the order of (∆)( M = N : T ) is the or der of ∆. The or der o ( T ) of a t yp e theory sp ecificatio n T is the la rgest n such that T contains a declaration of order n , or ω if ther e is no such maximum. 2.7. R epr esenting Obje ct The ories in TF TF is intended for representing typ e the ories that have judgements of the following forms: x 1 : A 1 , . . . , x n : A n ⊢ M : B (3) x 1 : A 1 , . . . , x n : A n ⊢ M = N : B (4) Given such a t yp e theory T that w e wish to represent in TF, w e b eg in by forming the a ppropria te specific a tion. There will b e one consta nt declara tio n for each constructor in the g rammar of T , a nd one equation de c laration for each computation rule in T . 11 W e make these declaratio ns in such a wa y that: • the ob jects of kind Ty p e corres po nd to the types of T ; • if the ob ject M : Ty p e c orresp o nds to the type A , then the ob jects of kind El ( M ) co r resp ond to the ter ms of type A ; • the judge ments o f T of the form (2.7) cor resp ond to the TF judgements of the for m x 1 : El ( A 1 ) , . . . , x n : El ( A n ) ⊢ M : El ( B ) ; (5) • the judge ments o f T of the form (2.7) cor resp ond to the TF judgements of the for m x 1 : El ( A 1 ) , . . . , x n : El ( A n ) ⊢ M = N : El ( B ) . (6) T o specify t yp e theo ries such as the Ca lc ulus o f Constructions [1 2], ECC [6] or Martin-L¨ o f ’s Type Theory without W-t yp es [3] r equires a second-order sp ecification. T o sp ecify Martin-L¨ o f ’s Type Theor y with W-types requires a third-order sp ecification. T o sp ecify UTT [6] re quires a spec ification of order ω . These examples ar e describ ed in mor e deta il in Adams [5]. Note that the judgements of TF tha t represe nt the judgemen ts of the ob- ject theory , those of form (5) or (6 ), ha ve first-or der contexts. This will be impo rtant in the following section. F or man y of the metatheor etic pro p er ties we in vestigate, we sha ll be able to prove that they ho ld for judge ments with first-order contexts, but they hav e not yet b een proved to hold for judgements with contexts o f order ≥ 2. 3. Metatheory W e c an now b egin to inv estiga te the metatheoretica l prop er ties of this sys- tem. Many of these prop er ties a re more difficult to pr ov e than the cor r esp ond- ing prop er ties of a traditional lo gical framework; in particular, it is o ften the case that several prop er ties need to b e established sim ultaneo usly by a single induction. This should be see n as the ‘one-time’ cost of using a lam b da-free framework. 3.1. Gr ammar W e begin by demo nstrating some prop er ties of the o p erations of instantiation and employmen t. Many of them are analog ous to prop erties o f substitution in more familiar languag es; w e shall p oint out thes e analo gies as we pro ceed. 12 Lemma 3 .1 L et FV ( X ) denote the s et of fr e e variabl es in the obje ct or ab- str action X . 1. FV ( { F /x } N ) ⊆ (FV ( N ) \ { x } ) ∪ FV ( F ) 2. FV ( F • G ) ⊆ FV ( F ) ∪ FV ( G ) . Proof. Part 1 is prov ed by induction on the ob ject N . Part 2 follows directly . The following is the analo g ue of the re s ult that, if x is not free in N , then [ M /x ] N ≡ N . Lemma 3 .2 If x do es not o c cur fr e e in M , then { F /x } M ≡ M . Proof. This is easily prov en by induction on the ob ject M . Part 1 o f the next lemma is the analo g ue of the famous Substitution Lemma. Lemma 3 .3 L et α , β and γ b e arities. L et F b e an α -ary abstr action, G a β - ary abstr action, and H a ( β ) ˆ γ -ary abstr action. L et x b e an α - ary variable and y a β -ary variable, with x 6≡ y . L et M b e an obje ct. 1. If x and y ar e distinct variables, and y do es not o c cur fr e e in M , then { F /x }{ G/y } M ≡ { { F /x } G/ y }{ F / x } M . 2. { F /x } ( H • G ) ≡ ( { F / x } H ) • { F /x } G . Proof. Both parts ar e proved simultaneously by induction on the sum of the orders of α and β . Part 1 o f the next lemma is the ana logue of the fact that [ M /x ] x ≡ M . Part 3 is the analo gue of the fact tha t [ x/x ] M ≡ M . Lemma 3 .4 L et α b e an arity. 1. F or any α -ary variable x and α -ary abstr action F , { F /x } x η ≡ F . 2. F or any α -ary variable x and α -ary abstr action se quen c e ~ F , x η • ~ F ≡ x ~ F . 3. F or any α -ary variable x and obje ct M , { x η /x } M ≡ M . Proof. The three par ts a re prov en simultaneously by induction on α . P ar t 3 requires a seconda ry induction on the ob ject M . 13 3.2. Metathe or etic Pr op erties The following re sults ar e true in TF. Theorem 3.5 1. ( Context V ali dity ) Every derivation of a judgement of the form Γ , ∆ ⊢ J has a sub derivation of Γ v alid . 2. Every derivation of Γ , x : K , ∆ ⊢ J has a sub derivation of Γ  K kind . 3. If Γ ⊢ J is derivable, then every fr e e variab le in the judgement b o dy J is in the domain of Γ . 4. If Γ , x : K, ∆ v alid , then every fr e e variable in K is in t he domain of Γ . 5. ( We akening ) If Γ ⊢ J , Γ ⊆ ∆ and ∆ v alid , then ∆ ⊢ J . 6. ( Gener ation ) If Γ ⊢ x ~ F : T , then ther e is a de clar ation x : (∆) S in Γ , wher e Γ  ~ F :: ∆ , Γ  { ~ F / ∆ } S = T . 7. ( Gener ation ) If Γ ⊢ c ~ F : T , then a c onstant de clar ation c : (∆) S has b e en made, wher e Γ  ~ F :: ∆ , Γ  { ~ F / ∆ } S = T . 8. If Γ ⊢ M : T and Γ ⊢ M : T ′ , then Γ  T = T ′ . Proof. The first 7 par ts are each prov ed by a simple induction on deriv ations . Part 8 follows easily from par ts 6 and 7. The o ther metatheoretic prop erties of TF are very difficult to esta blis h. W e hav e not been able to prov e the following pr op erties in full gener ality , but only under a set of restrictions on the type theory sp ecifica tio n and context. Definition 3.6 (Go o d Sp ecification). Let T be a type theory sp ecification in TF. 1. W e say that T is or der able iff there exis ts a well-ordering ≺ on the decla- rations of T suc h that: (a) F or every co nstant declara tio n δ ≡ ( c : (∆) T ), it is p ossible to derive ∆  T kind using only the decla rations δ ′ such that δ ′ ≺ δ . (b) F or every equation declaration δ ≡ (∆)( M = N : T ), it is p os sible to der ive ∆ ⊢ M : T , ∆ ⊢ N : T and ∆  T kind using only the declarations δ ′ such that δ ′ ≺ δ . 2. W e say that T is n -go o d iff, whenever Γ is a co nt ex t of order ≤ n and Γ ⊢ M = N : T , then Γ ⊢ M : T and Γ ⊢ N : T . 3. W e say that T is go o d iff T is n -go o d for every natural num b er n . 14 It is difficult to find ge neral conditions under which we can prove tha t a sp ecification is go o d. So far, w e are able to do so for t wo large classe s of sp ecifications: Theorem 3.7 1. If T c ontains n o e quation de clar ations, t hen T is go o d. 2. If T is or der able and o ( T ) ≤ 2 , then T is 2-go o d. Proof. 1. A s imple pr o of b y induction on deriv ations shows that, whenever Γ ⊢ M = N : T , then M ≡ N and Γ ⊢ M : T . 2. See App e ndix B. Theorem 3.8 L et T b e a typ e the ory sp e cific ation. Su pp ose T is n -go o d, and Γ , x : K , ∆ is a c ontex t of or der ≤ n . 1. ( Cut ) If Γ , x : K , ∆ ⊢ J and Γ  F : K then Γ , { F /x } ∆ ⊢ { F /x } J . 2. ( F unctional ity ) If Γ , x : K , ∆ ⊢ M : T and Γ  F = G : K then Γ , { F / x } ∆ ⊢ { F /x } M = { G/x } M : { F /x } T . 3. ( Context Conversion ) If Γ , x : K , ∆ ⊢ J and Γ  K = K ′ then Γ , x : K ′ , ∆ ⊢ J . Proof. See App endix A. Once we ha ve g o t past this hurdle, other prop er ties o f TF follow ra pidly . Theorem 3.9 (Type V alidit y) Supp ose that T is an n -go o d sp e cific ation, and • for every c onst ant de clar ation c : K in T , we have  K kind ; • for every e quation de clar ation (∆)( M = N : T ) in T , we have ∆  T kind . Then, whenever o (Γ) ≤ n , if Γ ⊢ M : El ( A ) or Γ ⊢ M = N : E l ( A ) , we have Γ ⊢ A : Type . Proof. The pro o f is b y induction o n deriv ations. The cases (const) and (const eq) use the fir st hypothesis with Cut and F unctionality resp ectively . The case (eq) uses the second hypothesis with Cut. The other cases ar e a ll trivial. Theorem 3.10 (K i nd V alidity ) Su pp ose T is n - go o d and o (Γ) ≤ n . Then the fol lowing rules ar e admissible. Γ  F : K Γ  K kind Γ  F = G : K Γ  K kind Proof. Both r ules a re prov ed admissible simult a ne o usly b y induction o n the deriv a tion of the premise. The case o f the rule (v ar eq) requir e s Equation V a- lidit y . 15 4. The Ch urc h-T yp ed TF The v er sion of TF we ha ve describ ed is Curry- t yp e d ; that is, the b ound v a ri- ables in a bstractions ar e not anno tated with their kinds. W e ca n also construct a Chur ch-t yp e d v ers ion o f TF, in which ob jects hav e the form z [[ x 11 : K 11 , . . . , x 1 r 1 : K 1 r 1 ] M 1 , . . . , [ x n 1 : K n 1 , . . . , x nr n : K nr n ] M n ] . W e sha ll ca ll the Churc h-typed version of TF b y the name TF k 2 . In this sectio n, we shall give the definitio n of TF k , pr ov e its metatheoretic prop er ties, and define mutually in verse translatio ns b etw een TF and TF k that show tha t the t wo systems are in so me se nse equiv a lent . It is very conv enient to have av a ilable tw o versions of a la mbda-free logical framework, and to b e able to switch betw een them at will. F or example, when embedding a la mbda-free fr a mework in a traditional fr amework, it is easier to define translations into the Curry-typed version, and fr om the Ch urch-t yp ed version. W e sha ll be in just this situation when we come to embed TF in LF. 4.1. Gr ammar In TF k , the sets of obje cts , abstr actions , abstr action se quenc es , c ont ex ts and kinds a re all defined s imultaneously as follows. Ob jects An obje ct has the form z ~ F , where z is a n α - ary v ariable or constant and ~ F an α -ar y abstraction sequence, for some arity α . Abstractions An α -ary abstr action ha s the for m [∆] M , where ∆ is an α -a ry context and M an ob ject. Abstraction Sequences An ( α 1 , . . . , α n ) -ary abstr action se quenc e has the form h F 1 , . . . , F n i , where each F i is an α i -ary abstractio n. Con texts An ( α 1 , . . . , α n ) -ary c ontext ha s the form x 1 : K 1 , . . . , x n : K n , where each x i is a n α i -ary v ariable and K i an α i -ary kind, with the x i s all distinct. Kinds An α -ary kind has the form (∆) T yp e o r (∆)El ( M ), where ∆ is an α -ary context and M a n ob ject. In an abstraction [ x 1 : K 1 , . . . , x n : K n ] M or a kind ( x 1 : K 1 , . . . , x n : K n ) T , each v ar iable x i is bo und wherever it o ccurs in K i +1 , K i +2 , . . . , K n , and M . W e ident ify all these expr essions up to α -conversion. The η -long form of a sy mbo l in TF k m ust be defined with refer e nce to some kind. F or z an α -a ry v a riable or constant and K an α -ary kind, w e define the 2 The ‘k’ here stands f or ‘ki nd’, as we include the kind lab el s i n abstractions. This system wa s named TF c in Adams [5], the ‘c’ standing for ‘Churc h’. I ha ve decided to abandon this name, as ‘c’ could just as w ell stand f or ‘Curr y’ ! 16 α -ary abstractio n z K , the η -lo ng form of z considered as b eing of kind K , by recursion on α a s follows. z ( x 1 : K 1 ,...,x n : K n ) T ≡ [ x 1 : K 1 , . . . , x n : K n ] z [ x K 1 1 , . . . , x K n n ] . The definitions o f instantiation and employmen t in TF k are very similar to those in TF. { F /x } z [ G 1 , . . . , G n ] ≡ z [ { F /x } G 1 , . . . , { F / x } G n ] ( z 6≡ x ) If F ≡ [ t 1 : K 1 , . . . , t n : K n ] M , { F /x } x [ G 1 , . . . , G n ] ≡ {{ F /x } G 1 /t 1 } · · · {{ F /x } G n /t n } M ([ x : K ] F ) • G ≡ { G/x } F As in TF, there are three primitive judgemen t forms in TF k : Γ v alid Γ ⊢ M : T Γ ⊢ M = N : T where Γ is a co ntext, M and N ob jects and T a ba se kind. W e de fine the judge ment forms Γ  K kind, Γ  K = K ′ and Γ  ∆ = ∆ ′ just as we did for TF. The judgement form Γ  F : K , where F is a n α -ary abstr action and K a n α -ary kind, is defined as follows. (Γ  [∆] M : (∆ ′ ) T ) = (Γ  ∆ ′ = ∆) ∪ { Γ , ∆ ′ ⊢ M : T } . The judgement form Γ  F = G : K , where F and G are α -ary abs tractions and K an α -ary kind, is defined as follows. (Γ  [∆ 1 ] M = [∆ 2 ] N : (∆ 3 ) T ) = (Γ  ∆ 3 = ∆ 1 ) ∪ (Γ  ∆ 3 = ∆ 2 ) ∪ { Γ , ∆ 3 ⊢ M = N : T } The judgement fo r m Γ  ~ F :: ∆, where ~ F is an α -ary abstraction se q uence a nd ∆ an α -ar y c ontext, is defined by recurs ion o n α as follows. (Γ  hi :: hi ) = { Γ v a lid } (Γ  ~ F , F 0 :: ∆ , x : K ) = (Γ  ~ F :: ∆) ∪ (Γ  F 0 : { ~ F / ∆ } K ) The judgement form Γ  ~ F = ~ G :: ∆, wher e ~ F and ~ G ar e α -ar y abstraction sequences and ∆ a n α -ary context, is defined by r ecursion on α as follows. (Γ  hi = hi :: hi ) = { Γ v alid } (Γ  ~ F , F 0 = ~ G, G 0 :: ∆ , x : K ) = (Γ  ~ F = ~ G :: ∆) ∪ (Γ  F 0 = G 0 : { ~ F / ∆ } K ) 17 Rules of De duction. The r ules of deduction of TF k lo ok exactly the same as those of TF, as given in Fig. 1. The rules (ctxt), (v ar ) and (v ar eq) of course use the new definitions of the defined judgement forms Γ  K kind, Γ  ~ F :: ∆ and Γ  ~ F = ~ G :: ∆. Ob ject theorie s are decla red in TF k in the same w ay as in TF: we make a nu mber of c onstant de clar ations c : (∆) T , which has the effect of introducing the rules (const) and (const eq), a nd e quation de clar ations (∆)( M = N : T ), which has the effect of intro ducing the r ule (eq), as given in Section 2.6.1. Again, in TF k these rules use the new definitions of the defined judgement for ms. Metathe ory. All the pr o p erties o f TF we proved in Section 3 hold in TF k to o. The pro ofs follow the same pattern; we ha ve indica ted in App endix A the places where the details differ. 4.2. T r anslations b et we en TF and TF k The s ystems TF and TF k are equiv alent, in the following sens e. Given any deriv a ble judgemen t in TF k , er asing the kind lab els on v aria bles gives a deriv able judgement in TF. Co nv ersely , given any deriv able judgement in TF, there is a wa y of filling in the kind lab els o n the v aria ble s to yield a deriv a ble judgement in TF; further, the choice of kind lab els is unique up to equality in TF k . This fact is v er y c o nv enient when w o r king with la mbda-free logical frame- works, a s it allows us to s witch betw een TF and TF k more or less a t will, effectively treating them as if they were the same sy stem. In this section, we shall for mally establish the equiv a lence of TF and TF k by defining tr a nslations b etw e en the tw o. The translation from TF k to TF consists simply of erasing the kind lab els: Definition 4.1. F or every ent ity (ob ject, abstraction, a bstraction sequence, kind, context, o r judgement) X in TF k , let | X | denote the entit y obtained by erasing the kind lab els on the b ound v ar iables in abstractio ns. Given a t yp e theory sp ecification T in TF k , let |T | denote the type theor y sp ecification in TF formed by erasing the k ind lab e ls on the bo und v aria bles in abstractions within the dec larations of T . It is str aightforw ar d to show that this translatio n is sound: Theorem 4.2 L et T b e a typ e the ory sp e cific ation in TF k , and let J b e a judgement that is derivable under T . Th en | J | is a derivab le ju dgement in TF under t he typ e the ory sp e cific ation |T | . Proof. The pro of cons ists of obser ving that the image of a pr imitive r ule of deduction in TF k under | | is a primitive rule of deduction in TF, and the imag e of any of the rules introduced by T under | | is a rule intro duced by |T | . 18 Defining the tr anslation in the other direction is harder. W e shall define the translation ‘ L ’ from TF to TF k , which fills in the kind la bels o n the b ound v ar i- ables. Whenever we encounter a n o b ject of the form x [ · · · , [ y 1 , . . . , y n ] M , · · · ], we discov er the kinds o f y 1 , . . . , y n by lo oking up the kind of x in the current context. Similarly , we handle ob jects of the for m c [ · · · ] by loo king up the kind of c in the sp ecification. Let us say that an ob ject, abstra ction or a bstraction s equence X in TF is define d r elative to the s pe cification T and context Γ if and only if every constant that o c c urs in X is declar ed in T , a nd every free v aria ble in X is decla red in Γ. Let us also say that a context ∆ ≡ x 1 : K 1 , . . . , x n : K n is define d r elative to Γ and T if and only if, for each i , K i is defined relative to the co ntext Γ , x 1 : K 1 , . . . , x i − 1 : K i − 1 and T . Let us say that a judgemen t Γ ⊢ J is define d relative to T if and only if Γ is de fined relative to T , every constant that o ccurs in J is decla r ed in T , and every fr ee v ariable in J is de c la red in Γ. Let us say that the sp ecificatio n T is c onsistent if and only if: • for e a ch constant declara tion c : K , the k ind K is defined relative to the empt y context and T ; • for each equation declara tion (∆)( M = N : T ), the co nt ex t ∆ is defined relative to T , and M , N a nd T a r e de fined relative to ∆ and T . Now, given a consistent sp ecification T in TF, we shall define the following. • F or ev er y context Γ defined r elative to T , and ev ery o b ject M defined relative to T and Γ, an ob ject L Γ ( M ) in TF k . • F or every abstraction F and kind K of the sa me arity defined re la tive to Γ a nd T , an abstrac tio n L K Γ ( F ) in T F k . W e think o f K a s the intended kind of F . • F or every a bstraction sequence ~ F and context ∆ of the s ame a r ity defined relative to Γ a nd T , an abstraction sequence L ∆ Γ ( ~ F ) in TF k . W e think of ∆ as giving the intended kinds o f the abstr actions ~ F . • F or every kind K defined relative to Γ and T , a kind L Γ ( K ) in TF k . • F or every context Γ defined relative to T , a context L (Γ) in TF k . • F or every judgement J defined relative to T , a judgement L ( J ) in TF k . 19 The definition is a s follows. L Γ ( c ~ F ) ≡ c [ L ∆ Γ ( ~ F )] ( c : (∆) T declare d in T ) L Γ ( x ~ F ) ≡ x [ L ∆ Γ ( ~ F )] ( x : (∆) T declar ed in Γ) L T Γ ( M ) ≡ L Γ ( M ) L ( x : K ) K ′ Γ ([ x ] F ) ≡ [ x : L Γ ( K )] L K ′ Γ ,x : K ( F ) L hi Γ ( hi ) ≡ hi L ∆ ,x : K Γ ( ~ F , G ) ≡ L ∆ Γ ( ~ F ) , L { ~ F / ∆ } K Γ ( G ) L Γ ( T yp e ) ≡ T yp e L Γ (El ( M )) ≡ El ( L Γ ( M )) L Γ (( x : K ) K ′ ) ≡ ( x : L Γ ( K )) L Γ ,x : K ( K ′ ) L ( hi ) ≡ hi L (Γ , x : K ) ≡ L (Γ) , L Γ ( K ) L (Γ v a lid) ≡ L (Γ) v alid L (Γ ⊢ M : T ) ≡ L (Γ) ⊢ L Γ ( M ) : L Γ ( T ) L (Γ ⊢ M = N : T ) ≡ L (Γ) ⊢ L Γ ( M ) = L Γ ( N ) : L Γ ( T ) Given a co nsistent sp ecificatio n S in TF, let L ( S ) b e the follo wing type theory sp ecification in TF k . • F or every constant declar ation c : K in S , declar e c : L hi ( K ). • F or every equation decla ration (∆)( M = N : T ) in S , declare ( L (∆))( L ∆ ( M ) = L ∆ ( N ) : L ∆ ( T )). W e can show that this translation is sound after proving a num b er o f lemmas. Lemma 4 .3 If M is define d r elative to b oth Γ and ∆ , and Γ and ∆ agr e e on every fr e e variable in M , then L Γ ( M ) ≡ L ∆ ( M ) . In p articular, if M is define d r elative to Γ and Γ ⊆ ∆ , t hen L Γ ( M ) ≡ L ∆ ( M ) . Proof. An e a sy induction on M . 20 Lemma 4 .4 F or e ach of t he fol lowi n g e quations, if the left-hand side is define d then so is the right-hand side, in which c ase the t wo ar e e qual. {L K Γ ( F ) /x }L Γ ,x : K, ∆ ( X ) ≡ L Γ , { F /x } ∆ ( { F /x } X ) {L K Γ ( F ) /x }L K ′ Γ ,x : K, ∆ ( G ) ≡ L { F /x } K ′ Γ , { F /x } ∆ ( { F /x } G ) {L K Γ ( F ) /x }L Θ Γ ,x : K, ∆ ( ~ G ) ≡ L { F /x } Θ Γ , { F /x } ∆ ( { F /x } ~ G ) wher e X is an obje ct, kind or c ont ex t. Proof. The fiv e equatio ns are prov ed simultaneously b y a double induction on the arity o f K , then the size of X , G or ~ G . W e give the calcula tion for one case, the case where X is an ob ject of the form x ~ G . Let K ≡ (Θ) T and F ≡ [dom Θ] N . {L ( F ) /x }L ( x ~ G ) ≡ L ( F ) • {L ( F ) /x }L ( ~ G ) ≡ L ( F ) • L ( { F /x } ~ G ) (i.h. on X ) ≡ {L ( { F / x } ~ G ) / Θ }L ( N ) ≡ L ( {{ F / x } ~ G/ Θ } N ) (i.h. on a rity) ≡ L ( { F /x } x ~ G ) The following lemma shows ho w w e can change the subscript and super script on an abstr a ction L K Γ ( F ). Roughly , it can b e rea d as: if L (Γ) = L (Γ ′ ) and L ( K ) = L ( K ′ ), then L K Γ ( F ) = L K ′ Γ ′ ( F ). Lemma 4 .5 The fol lowing ru le of de duction is admissible in T F k . L hi (Γ)  L K Γ ( F ) : L Γ ( K )  L hi (Γ) = L hi (Γ ′ ) L hi (Γ)  L Γ ( K ) = L Γ ′ ( K ′ ) L hi (Γ)  L K Γ ( F ) = L K ′ Γ ′ ( F ) : L Γ ( K ) Proof. W e prov e that this rule and the following tw o are admis s ible. L hi (Γ)  L Γ ( M ) : L Γ ( T )  L hi (Γ) = L hi (Γ ′ ) L hi (Γ)  L Γ ( M ) = L Γ ′ ( M ) : L Γ ( T ) (7) L hi (Γ)  L Θ Γ ( ~ F ) :: L Γ (Θ)  L hi (Γ , Θ) = L hi (Γ ′ , Θ ′ ) L hi (Γ)  L Θ Γ ( ~ F ) = L Θ ′ Γ ′ ( ~ F ) :: L Γ (Θ) The three r ules are proved a dmissible sim ultaneous ly by induction on the size o f L K Γ ( F ), L Γ ( M ) and L Θ Γ ( ~ F ). W e give here the details for the case for (7) where M ha s the form x ~ F . 21 Let x hav e kind (Θ) S in Γ and (Θ ′ ) S ′ in Γ ′ . W e are g iven that L (Γ) ⊢ L Γ ( M ) : L ( T ). Ther efore, by Gener ation, L (Γ)  L Θ Γ ( ~ F ) :: L (Θ) L (Γ)  {L Θ Γ ( ~ F ) / Θ }L ( S ) = L ( T ) . The induction hypothesis gives L (Γ)  L Θ Γ ( ~ F ) = L Θ ′ Γ ′ ( ~ F ) :: L (Θ) . and the desired re s ult follows by (v ar eq) and (conv eq). Lemma 4 .6 L et T b e an n -go o d de clar ation in TF k . The following rules of de duction ar e admissible in TF k . ( L seq) L (Γ  ~ F :: Θ) L hi (Γ)  L Θ Γ ( ~ F ) :: L Γ (Θ) ( L seqeq) L (Γ  ~ F = ~ G :: Θ) L hi (Γ)  L Θ Γ ( ~ F ) = L Θ Γ ( ~ G ) :: L Γ (Θ) wher e Γ , ~ F , ~ G and Θ ar e of or der ≤ n . Proof. W e first pr ov e the following tw o rules a re admissible. ( L abs) L (Γ  F : K ) L hi (Γ)  L K Γ ( F ) : L Γ ( K ) ( L abseq) L (Γ  F = G : K ) L hi (Γ)  L K Γ ( F ) = L K Γ ( G ) : L Γ ( K ) F or the first of these rules , if K ≡ (Θ) T and F ≡ [dom Θ] M , then the premise is L (Γ) , L (Θ) ⊢ L ( M ) : L ( T ), and the conclusio n is ( L (Γ)  L (Θ) = L (Θ)) ∪ { L (Γ) , L (Θ) ⊢ L ( M ) : L ( T ) } which follows using Context V alidity and (ref ). The pro of for the second rule is similar. The rules ( L seq) and ( L seqeq) are each prov ed admissible by induction on the length of ~ F . W e give the de ta ils fo r the r ule ( L seqeq) where the length of ~ F is greater than 0. Suppo se now that ~ F ≡ ~ F 0 , F 1 ; ~ G ≡ ~ G 0 , G 1 ; and Θ ≡ Θ 0 , x : K 1 . The pre mis es are L (Γ  ~ F 0 = ~ G 0 :: Θ 0 ) ∪ L (Γ  F 1 = G 1 : { ~ F 0 / Θ 0 } K 1 ) and the conclusio n is ( L (Γ)  L ( ~ F 0 ) = L ( ~ G 0 ) :: L (Θ)) ∪ ( L (Γ)  L { ~ F 0 / Θ 0 } K 1 Γ ( F 1 ) = L { ~ G 0 / Θ 0 } K 1 Γ ( G 1 ) : L Γ ( { ~ F 0 / Θ 0 } K 1 ) . 22 This follows, using the induction h yp o thesis, the rule ( L abseq) and Lemma 4.5, once we hav e shown L (Γ)  L ( { ~ F 0 / Θ 0 } K 1 ) = L ( { ~ G 0 / Θ 0 } K 1 ) . By Lemma 4.4, this is L (Γ)  {L ( ~ F 0 ) / Θ 0 }L ( K 1 ) = {L ( ~ G 0 ) / Θ 0 }L ( K 1 ) which is o bta inable using F unctionality . Theorem 4.7 L et S b e an or der able n -go o d t yp e the ory sp e cific ation in TF in which every de clar ation has or der ≤ n . Assume we have de clar e d S in TF and L ( S ) in TF k . Then, for every judgement J deriva ble in TF with c ontext of or der ≤ n , the judgement L ( J ) is derivable in TF k . Proof. Let ≺ be the given order on S . F or each declaration δ in S , let S δ be the set of declarations δ ′ such that δ ′ ≺ δ . W e pr ov e the follo wing simult a ne o usly by ≺ -induction on δ : 1. L ( S δ ) is an order able n -go o d sp ecificatio n in TF k . 2. If J is deriv able in TF under S δ , a nd J has context o f order ≤ n , then L ( J ) is deriv able under L ( S δ ) in TF k . The pro of o f 2 is b y a s traightforw a rd induction on the deriv ation o f J . The cases (v ar), (const), (eq) a ll make use of the first rule in Lemma 4.6; the cases (v ar eq) and (const eq) make use o f the second rule in that lemma. Thu s , o ur trans la tions b etw een TF and TF k are sound. It is also easy to show that the mapping | | is an exact left inv erse to L : Theorem 4.8 |L Γ ( X ) | ≡ X |L K Γ ( F ) | ≡ F |L ∆ Γ ( ~ F ) | ≡ ~ F wher e X is an obje ct, kind or c ont ex t. Proof. An e a sy induction on X , F and ~ F . The mapping L is not a left inv erse to | | up to syntactic identit y . F or example, L ( x :El( A ))El( C ) A : Type ,B : Typ e ,C : T yp e ( | [ x : El ( B )] x | ) ≡ [ x : El ( A )] x . How ever, on the well-t yp ed ob jects, abstra ctions and kinds, L is a left inv erse to | | up to e quality in TF k , in the following sense. 23 Theorem 4.9 L et T b e an n -go o d de clar ation in TF k , and Γ , F , K , ∆ have or der ≤ n . 1. If Γ ⊢ M : T then Γ ⊢ M = L | Γ | ( | M | ) : T . 2. If Γ  F : K then Γ  F = L | K | | Γ | ( | F | ) : K . 3. If Γ  ~ F :: ∆ then Γ  ~ F = L | ∆ | | Γ | ( | ~ F | ) :: ∆ . 4. If Γ  K kind then Γ  K = L | Γ | ( | K | ) . 5. If Γ , ∆ v a lid then Γ  ∆ = L | Γ | ( | ∆ | ) . Proof. Let l ( X ) denote the length of an expr ession X . The fiv e parts are prov en s imultaneously b y induction on l (Γ) + l ( M ), l (Γ) + l ( F ), l (Γ) + l ( ~ F ), l (Γ) + l ( K ), and l (Γ) + l (∆). W e g ive here the de ta ils of the fir st t wo parts. 1. Suppose M ≡ x ~ F , where x : (Θ) S ∈ Γ. By Generation, Γ  ~ F :: Θ , Γ  { ~ F / Θ } S = T . Therefore, Γ  ~ F = L | Θ | | Γ | ( | ~ F | ) :: Θ (i.h.) ∴ Γ ⊢ x ~ F = x h L | Θ | | Γ | ( | ~ F | ) i : { ~ F / Θ } S (v ar eq) ∴ Γ ⊢ x ~ F = x h L | Θ | | Γ | ( | ~ F | ) i : T (conv eq) The case M ≡ c ~ F is similar . 2. Let K ≡ (Θ) T a nd F ≡ [Θ ′ ] M . W e ar e g iven that Γ  Θ = Θ ′ , Γ , Θ ⊢ M : T . W e m ust show that Γ  [Θ ′ ] M = [ L | Γ | ( | Θ | )] L | Γ | , | Θ | ( | M | ) : (Θ) T . The induction h yp o thesis gives us that Γ , Θ ⊢ M = L | Γ | , | Θ | ( | M | ) : T ; it remains to show Γ  Θ = Θ ′ . The induction hypo thesis gives us that Γ  Θ ′ = L | Γ | ( | Θ ′ | ); and Γ  Θ = L | Γ | ( | Θ | ); it is thu s s ufficient to show Γ  L | Γ | ( | Θ | ) = L | Γ | ( | Θ ′ | ) . W ell, | Γ |  TF | Θ | = | Θ ′ | (Theorem 4.2) ∴ L hi ( | Γ | )  TF L | Γ | ( | Θ | ) = L | Γ | ( | Θ ′ | ) (Theorem 4.7)  TF Γ = L hi ( | Γ | ) (i.h.) and the r esult follows by Cont ext Co nversion. Parts 3– 5 ar e pr ov en similarly . W e hav e thus established sound translations | | and L b etw een TF and TF k which are inv er ses of one another up to the appro priate notio n of equality . 24 LF T F L ✲ ✛ | | ✛ NF TF k ✛ lift Figure 2: T ranslations b etw een Logical F rameworks 5. Em b edding TF in LF Lambda-free fra meworks can often b e embedded within existing traditiona l logical fra meworks; that is, g iven a traditional lo gical framework F , we can often construct a la mbda-free fra mework (its c or e ) that is, in so me sens e , iso morphic to a subsys tem o f F . More pre c isely , we ca n cons truct a lambda- free fra mework L and define trans lations NF : F → L, lift : L → F . These translations are sound, and NF is a left inv ers e to ‘lift ’ up to ident ity ( α -conv ersio n). That is, we hav e the following prop er ties: 1. F or every deriv able judgement J in L , lift( J ) is deriv able in F . 2. F or every deriv able judgement J in F , NF( J ) is deriv able in L . 3. F or every typable ex pression X in L , NF(lift( X )) ≡ X . In many cases (particularly when F allows η -con version) we hav e in addition that NF is a rig ht inv erse to lift up to the eq uality judgements o f F : 4. F or ev er y typable expressio n X in F , the equalit y lift(NF( X )) = X is deriv a ble in F . W e can think o f F as picking out, from each equiv alence class of the ex pressions of F mo dulo β η - conv ertibility , a unique r e pr esentativ e: the β -normal, η - long form. Establishing the a b ove prop erties of the translations is not ea sy; it usually inv olves pr oving fairly strong prop er ties of L and F . How ever, o nce this one- time cos t has b een paid, w e can then us e the transla tio ns to prov e v ar io us prop erties of F more easily . It is often the case that it is easier to establish a given metatheoretic prop erty for L than for F . Once it has b e en prov en to hold in L , the r esult can then b e ‘lifted’ to F ; that is, we can derive the cor resp onding result for F us ing the prop er ties of the transla tio ns. In this section, w e shall show ho w TF can b e embedded in this fashion within the framework LF introduced in [6 ], a Churc h-typed version of Mar tin- L¨ of ’s log ical framework. It will prove to b e very adv antageous that w e hav e tw o different versions of TF; w e shall define translations from TF k to LF, and from LF to TF, as s hown in Figure 2. 25 5.1. The F r amework LF The framework LF [6] is a Churc h-typed version of Martin-L¨ o f ’s logical framework 3 . LF deals with obje ct s and kinds , given by the following grammar: Kind K ::= T yp e | El ( k ) | ( x : K ) K Ob ject k ::= x | c | [ x : K ] k | k k where x is a v ar iable and c a constant. There a re fiv e judgement forms in LF: • Γ v a lid, which denotes that Γ is a v alid co ntext; • Γ ⊢ K kind, which denotes that K is a kind under Γ; • Γ ⊢ k : K , which denotes that k is an ob ject of kind K under Γ; • Γ ⊢ k = k ′ : K , which deno tes tha t k and k ′ are eq ual ob jects o f kind K under Γ; • Γ ⊢ K = K ′ , which denotes that K and K ′ are equal kinds under Γ. A type theory is sp ec ified in LF by giving a set of c onst ant de clar ations c : K , and a set of c omput ation rules k = k ′ : K for k 1 : K 1 , . . . , k n : K n . W e shall make use of the following abbreviations when working with LF. Let ∆ b e the context x 1 : K 1 , . . . , x n : K n , and ∆ ′ the context x 1 : K ′ 1 , . . . , x n : K ′ n . W e shall write Γ  ∆ = ∆ ′ for the n judge ment s Γ ⊢ K 1 = K ′ 1 , Γ , x 1 : K 1 ⊢ K 2 = K ′ 2 , . . . Γ , x 1 : K 1 , . . . , x n − 1 : K n − 1 ⊢ K n = K ′ n and we shall write Γ  ( k 1 , . . . , k n ) :: ∆ for the n judgements Γ ⊢ k 1 : K 1 , Γ ⊢ k 2 : [ k 1 /x 1 ] K 2 , . . . , Γ ⊢ k n : [ k 1 /x 1 , . . . , k n − 1 /x n − 1 ] K n . F or the rules of deduction of LF, and how LF may b e used to sp ecify v arious ob ject theo ries, we r e fer to Luo [6]. W e note that, as with TF, the judgemen ts of the ob ject theory ar e repre- sented by the L F- judgements o f the form x 1 : El ( A 1 ) , . . . , x n : E l ( A n ) ⊢ k : El ( B ) x 1 : El ( A 1 ) , . . . , x n : E l ( A n ) ⊢ k = k ′ : E l ( B ) and these ar e judgements with first-o rder contexts. W e shall make use of the fact that LF sa tisfies S ubje ct R e du ct ion : If Γ ⊢ k : K and k ։ β η k ′ , then Γ ⊢ k = k ′ : K . 3 The framework here called LF should not b e confused with the Edinburgh Logical F rame- wo r k [2], which is also often referred to as LF. 26 5.2. T r anslation fr om TF k to LF W e shall now define our transla tions b etw een LF and the tw o v er sions o f TF. The mapping fr o m TF k to LF, which we shall call ‘lift’, is almost trivial. W e map ob jects and abstractions to o b jects, kinds to kinds, contexts to contexts and judgements to judgements as follows. lift( x [ F 1 , . . . , F n ]) ≡ x lift( F 1 ) · · · lift( F n ) lift([∆] M ) ≡ [lift(∆)]lift( M ) lift( T yp e ) ≡ T yp e lift(El ( M )) ≡ El (lift( M )) lift(( x : K ) K ′ ) ≡ ( x : lift( K ))lift( K ′ ) lift( x 1 : K 1 , . . . , x n : K n ) ≡ x 1 : lift( K 1 ) , . . . , x n : lift( K n ) lift(Γ v alid) ≡ lift(Γ) v alid lift(Γ ⊢ M : T ) ≡ lift(Γ) ⊢ lift( M ) : lift( T ) lift(Γ ⊢ M = N : T ) ≡ lift(Γ) ⊢ lift( M ) = lift( N ) : lift( T ) It is r elatively straig htforward to establish that this translation is so und. Lemma 5 .1 [lift( F ) /x ]lift( N ) ։ β lift( { F / x } N ) Proof. The pro of is b y a double induction on the arity o f F and x , then o n the ob ject N . W e g ive her e the deta ils for the cas e N ≡ x ~ G . Let F ≡ [∆] P . [lift( F ) /x ] x lift( ~ G ) ≡ lift( F )[lift( F ) / x ]lift( ~ G ) ≡ ([lift(∆)]lift( P ))[lift( F ) / x ]lift( ~ G ) ։ [[lift( F ) /x ]lift ( ~ G ) / ∆]lift( P ) ։ [lift( { F /x } ~ G ) / ∆]lift( P ) (i.h.) ։ lift( {{ F /x } ~ G/ ∆ } P ) (i.h.) ≡ lift( { F /x } N ) 27 Theorem 5.2 Supp ose we have de clar e d a typ e the ory T in TF k , and the c or- r esp onding the ory lift( T ) in LF. If J is a derivable judgement in TF k , t hen lift( J ) is derivable in LF. Proof. W e fir s t prove that the following rules of deduction ar e admissible in LF: (lift abs) lift(Γ  F : K ) lift(Γ) ⊢ lift( F ) : lift( K ) (lift abseq) lift(Γ  F = G : K ) lift(Γ) ⊢ lift( F ) = lift( G ) : lift( K ) (lift seq) lift(Γ  ~ F :: ∆) lift(Γ , ∆ v alid) lift(Γ)  lift( ~ F ) :: lift(∆) (lift seqeq) lift(Γ  ~ F = ~ G :: ∆) lift(Γ , ∆ v alid) lift(Γ)  lift( ~ F ) = lift( ~ G ) :: lift(∆) The pro o f for (lift seq) is by inductio n on the length of ~ F . If the length is 0, b oth hyp o thesis and conclusion a re that lift(Γ) is v alid. Suppo se ~ F is o f length n + 1, and the result holds for a bstraction s equences of leng th n . Let ~ F ≡ ~ F 0 , F 1 ; and ∆ ≡ ∆ 0 , x : K 1 . W e a re given that lift(Γ  ~ F 0 :: ∆ 0 ) is deriv able, hence so is lift(Γ)  lift( ~ F 0 ) :: lift(∆ 0 ) by the induction hypothesis. W e als o hav e lift(Γ) ⊢ lift( F 1 ) : lift( { ~ F 0 / ∆ 0 } K 1 ) by part 1 and lift(Γ) , lift(∆ 0 ) ⊢ lift( K 1 ) kind by Kind V alidity in LF. This yields lift(Γ) ⊢ [lift ( ~ F 0 ) / ∆ 0 ]lift( K 1 ) kind (substitution) ∴ lift(Γ) ⊢ [lift( ~ F 0 ) / ∆ 0 ]lift( K 1 ) = lift( { ~ F 0 / ∆ 0 } K 1 ) (Sub ject Reduction, Lemma 5 .1) ∴ lift(Γ) ⊢ lift( F 1 ) : [lift ( ~ F 0 ) / ∆ 0 ]lift( K 1 ) (conv) as required. The pro of for (lift seqeq) is s imilar, and the pr o ofs for (lift abs) a nd (lift seq) are simple. The theorem now fo llows by induction on the deriv ation of J . 28 5.3. T r anslation fr om LF t o TF The tr anslation from LF to TF is more difficult to constr uct. It consists of reducing every entit y of LF to its β -normal, η -long for m. W e must first a ssign ar ities to the entities of LF, to guide us during η - expansion. W e a ssign an arity to every kind of LF as follows: Ar( T yp e ) ≡ 0 Ar(El ( k )) ≡ 0 Ar(( x : K 1 ) K 2 ) ≡ (Ar( K 1 )) ˆ Ar( K 2 ) W e now de fine an arit y Ar Γ ( k ) to some LF-contexts Γ and LF-ob jects k as follows: • If x : K is an entry in Γ, then Ar Γ ( x ) ≡ Ar( K ). • If c has b een declared with ar ity K , then Ar Γ ( c ) ≡ Ar( K ). • If Ar Γ ,x : K ( k ) is de fined, then Ar Γ ([ x : K ] k ) ≡ (Ar( K )) ˆ Ar Γ ,x : K ( k ). • If Ar Γ ( k ) and Ar Γ ( k ′ ) is defined, and Ar Γ ( k ) has the form Ar Γ ( k ) ≡ (Ar Γ ( k ′ )) ˆ β then Ar Γ ( k k ′ ) ≡ β . W e shall say that an ob ject k is wel l-aritie d if Ar Γ ( k ) is defined. W e sha ll o nly be able to map well-aritied ob jects into TF. W e can prove immediately that every ob ject t ypa ble in LF is well-aritied. Prop ositi on 5.3 In LF, 1. if Γ ⊢ k : K then Ar Γ ( k ) ≡ Ar( K ) ; 2. if Γ ⊢ k = k ′ : K then Ar Γ ( k ) ≡ Ar Γ ( k ′ ) ≡ Ar( K ) ; 3. if Γ ⊢ K = K ′ then Ar( K ) ≡ Ar( K ′ ) . Proof. The three statemen ts are prov en simultaneously by induction on the deriv a tion of the premise. W e need to ma ke use of the following tw o auxiliary facts, which a re easy to prove: 1. Ar([ k /x ] K ) ≡ Ar( K ) 2. If Ar Γ ( k ) ≡ Ar( K ) and Ar Γ ,x : K ( k ′ ) is defined, then we hav e Ar Γ ([ k /x ] k ′ ) ≡ Ar Γ ,x : K ( k ′ ). Given an ob ject k suc h tha t Ar Γ ( k ) ≡ α , w e define the α -ary a bstraction NF Γ ( k ) in TF as follows. NF Γ ( x ) ≡ x η NF Γ ( c ) ≡ c η NF Γ ([ x : K ] k ) ≡ [ x ]NF Γ ,x : K ( k ) NF Γ ( k k ′ ) ≡ NF Γ ( k ) • NF Γ ( k ′ ) where, in the firs t tw o claus es, x has arity Ar Γ ( x ) and c has arity Ar Γ ( c ). In the third cla use, x has ar ity Ar Γ ( K ). 29 W e extend the mapping NF to kinds, contexts and judgements as follows. NF Γ ( T yp e ) ≡ T yp e NF Γ (El ( k )) ≡ El (NF Γ ( k )) NF Γ (( x : K ) K ′ ) ≡ ( x : NF Γ ( K ))NF Γ ,x : K ( K ′ ) NF Γ ( hi ) ≡ hi NF Γ (∆ , x : K ) ≡ NF Γ (∆) , x : NF Γ , ∆ ( K ) NF(Γ v alid) = { NF hi (Γ) v a lid } NF(Γ ⊢ K kind) = (NF hi (Γ)  NF Γ ( K ) kind) NF(Γ ⊢ K = K ′ ) = (NF hi (Γ)  NF Γ ( K ) = NF Γ ( K ′ )) NF(Γ ⊢ k : K ) = (NF hi (Γ)  NF Γ ( k ) : NF Γ ( K )) NF(Γ ⊢ k = k ′ : K ) = (NF hi (Γ)  NF Γ ( k ) = NF Γ ( k ′ ) : NF Γ ( K )) Given a type theory sp ecification T in LF, w e define the type theory sp ecification NF( T ) in TF as follows. • F or ea ch declara tion c : K in T , the declaratio n c : NF hi ( K ) is in NF( T ). • F or eac h declar ation (∆)( k = k ′ : K ) in T , the declaratio n (NF hi (∆))(NF ∆ ( k ) = NF ∆ ( k ′ ) : NF ∆ ( K )) is in NF( T ). The following results ens ur e that this translatio n is w ell- be hav ed a nd sound. Theorem 5.4 1. L et Ar( K ) ≡ α . If NF Γ ( K ) is define d, then it is an α -ary kind. 2. L et Γ ⊆ ∆ . If NF Γ ( X ) is define d, then NF ∆ ( X ) is define d, and NF ∆ ( X ) ≡ NF Γ ( X ) . 3. Supp ose Ar Γ ( k ) ≡ Ar( K ) . L et X b e an LF-obje ct, kind or c ont ex t. If NF Γ ( k ) and NF Γ ,x : K, ∆ ( X ) ar e define d, then NF Γ , [ k/x ]∆ ([ k /x ] X ) is de- fine d, and NF Γ , [ k/x ]∆ ([ k /x ] X ) ≡ { NF Γ ( k ) /x } NF Γ ,x : K, ∆ ( X ) . 4. L et T b e a typ e-the ory sp e cific ation in LF, and s upp ose NF( T ) is an n - go o d sp e cific ation in TF. If t he judgement J is derivable in LF and has c ont ext of or der ≤ n , then NF ( J ) is define d and derivable in TF. 30 Proof. The first three par ts ar e easily prov en by an induction on K a nd X resp ectively . The fourth par t is prov en by induction on the der iv a tio n o f J . Most cases are straightforw a r d, making use of the results proven in Section 3. W e give here the details for the rule (be ta ). (beta ) Γ , x : K ⊢ k ′ : K ′ Γ ⊢ k : K Γ ⊢ ([ x : K ] k ′ ) k = [ k /x ] k ′ : [ k /x ] K ′ By the induction hypo thesis, NF hi (Γ) , x : NF Γ ( K )  NF Γ ,x : K ( k ′ ) : NF Γ ,x : K ( K ′ ); NF hi (Γ)  NF Γ ( k ) : NF Γ ( K ) . Now, NF Γ (([ x : K ] k ′ ) k ) ≡ ([ x ]NF Γ ,x : K ( k ′ )) • NF Γ ( k ) ≡ { NF Γ ( k ) /x } NF Γ ,x : K ( k ′ ) ≡ NF Γ ([ k /x ] k ′ ) (part 3) The Cut rule a nd (ref ) g ive us NF hi (Γ)  { NF Γ ( k ) /x } NF Γ ,x : K ( k ′ ) = { NF Γ ( k ) /x } NF Γ ,x : K ( k ′ ) : { NF Γ ( k ) /x } NF Γ ,x : K ( K ′ ) and, by pa rt 3, this is the s a me judgement as NF hi (Γ)  NF Γ (([ x : K ] k ′ ) k ) = NF Γ ([ k /x ] k ′ ) : NF Γ ([ k /x ] K ′ ) . The transla tions we hav e esta blis hed b etw een our three systems ar e s hown in Figur e 2. The triangles in this diagram comm ute in the sense given by the following theorem. Theorem 5.5 L et T b e a typ e the ory sp e cific ation in LF, and s u pp ose NF( T ) is an or der able n -go o d typ e the ory sp e cific ation in TF. 1. If Γ ⊢ k : K in LF, then Γ ⊢ k = lift  L NF Γ ( K ) NF hi (Γ) (NF Γ ( k ))  : K . Similar r esults hold for kinds and c ontext s. 2. If Γ ⊢ M : T in TF, then M ≡ NF lift( L hi (Γ)) (lift( L Γ ( M ))) . Similar r esults hold for kinds and c ontext s. 31 3. If Γ ⊢ M : T in TF k , then Γ ⊢ M = L NF hi (lift(Γ)) (NF lift(Γ) (lift( M ))) : T . Similar r esults hold for kinds and c ontext s. Proof. 1. W e pr ov e the statement: If Γ ⊢ k : K and  Γ = ∆ in LF, then Γ ⊢ k = lift ( L NF Γ ( K ) NF hi (Γ) (NF ∆ ( k ))) : K . W e prove the statements simultaneously with similar statements for kinds and contexts by induction on s iz e . W e give here the details for the case where k is a n abstr a ction. Let k ≡ [ x : K 0 ] k ′ , and K ≡ ( x : K 1 ) K 2 . By Gener ation, we hav e Γ ⊢ K 0 = K 1 , Γ , x : K 1 ⊢ k ′ : K 2 . Now, lift  L NF Γ ( K ) NF hi (Γ) (NF ∆ ( k ))  ≡ lift  L ( x :NF Γ ( K 1 ))NF Γ ,x : K 1 ( K 2 ) NF hi (Γ) ([ x ]NF ∆ ,x : K 0 ( k ′ ))  ≡ lift  [ x : L NF hi (Γ) (NF Γ ( K 1 ))] L NF Γ ,x : K 1 ( K 2 ) NF hi (Γ ,x : K 1 ) (NF ∆ ,x : K 0 ( k ′ ))  ≡ [ x : lift( L NF hi (Γ) (NF Γ ( K 1 )))]lift  L NF Γ ,x : K 1 ( K 2 ) NF hi (Γ ,x : K 1 ) (NF ∆ ,x : K 0 ( k ′ ))  Now, the induction hypothesis g ives the tw o judgements Γ ⊢ lift( L NF hi (Γ) (NF Γ ( K 1 ))) = K 1 Γ , x : K 1 ⊢ lift  L NF Γ ,x : K 1 ( K 2 ) NF hi (Γ ,x : K 1 ) (NF ∆ ,x : K 0 ( k ′ ))  = k ′ : K 2 from which the result follows. 2. The pro o f is by induction on the o b ject M . Let M ≡ z [ ~ F ], a nd let z have kind (∆) T relative to Γ. Then NF lift( L hi (Γ)) (lift( L Γ ( M ))) ≡ NF lift( L hi (Γ)) (lift( z [ L ∆ hi ( ~ F )])) ≡ NF lift( L hi (Γ)) ( z [lift ( L ∆ hi ( ~ F ))]) ≡ z η • NF lift( L hi (Γ)) (lift( L ∆ hi ( ~ F ))) ≡ z [NF lift( L hi (Γ)) (lift( L ∆ hi ( ~ F )))] ≡ z [ ~ F ] (i.h.) 32 3. The pro of is by induction on the o b ject M . Let M ≡ x [ ~ F ], and let Γ ≡ Γ 1 , x : (∆) S, Γ 2 . Then L NF hi (lift(Γ)) (NF lift(Γ) (lift( M ))) ≡ L NF hi (lift(Γ)) (NF lift(Γ) ( x lift( ~ F ))) ≡ L NF hi (lift(Γ)) ( x η • NF lift(Γ) (lift( ~ F ))) ≡ L NF hi (lift(Γ)) ( x [NF lift(Γ) (lift( ~ F ))]) ≡ x h L NF lift(Γ 1 ) (lift(∆)) NF hi (lift(Γ)) (NF lift(Γ) (lift( ~ F ))) i ≡ x h L NF lift(Γ) (lift(∆)) NF hi (lift(Γ)) (NF lift(Γ) (lift( ~ F ))) i Now, by Gener ation, Γ  ~ F :: ∆ and Γ  { ~ F / ∆ } S = T . Hence, the induction hypothesis g ives Γ  ~ F = L NF lift(Γ) (lift(∆)) NF hi (lift(Γ)) (NF lift(Γ) ( ~ F )) :: ∆ from which the result follows. 5.4. Lifting R esu lt s Suppo se we wish to establish a prop er ty of a framework, or of an ob ject theory in a tr aditional framework F . It is often the ca s e tha t the pro p e r ty is more easily prov en fo r a lambda-free framework L . The result can then b e ‘lifted’ to F ; that is, we can derive the res ult for F easily from L , together with the prop erties of the translatio ns b etw een L a nd F . In Luo and Adams [13], w e w ere working with a type theory declared in LF: an extension of the t yp e theory UTT [6 ] with some new reduction rules. It was found to b e necessary to prov e that type construc to rs are injectiv e; that is, whenever T : ( K ) T yp e and T A = T B , then A = B . W e were not a ble to find a wa y to prov e this res ult in LF directly; the obvious metho d r equires using the Chu r ch-Rosser prop erty for the new reduction rela tion, which is not known to hold. How ever, the corr e sp onding result in TF is almos t trivial, a nd so we made use of this fact a nd lifted the re s ult from TF to LF. As an illustration of the pro cess of lifting r esults, we rep ea t the details her e. 33 W e seek to pr ove: Theorem 5.6 (Injectivity o f T yp e Constructors) L et S b e a typ e the ory sp e cific ation in LF t hat has the pr op erty: for every e quation de clar ation (∆)( M = N : T ) in S , T has the form E l ( A ) (that is, ther e ar e no e qu ation de clar ations of the form (∆)( M = N : T yp e ) ). F urt her, su pp ose NF( S ) is an or der able n -go o d sp e cific ation in TF. L et c : (Θ) Ty p e b e a c onstant de clar ation in S . Then the fol lowing rule of de duction is admissi ble: Γ ⊢ c ~ A = c ~ B : T yp e Γ  ~ A = ~ B :: Θ wher e Γ has or der ≤ n . The corr esp onding result for TF is fair ly easy to prove: Theorem 5.7 L et S b e a typ e t he ory sp e cific ation in TF that has the pr op erty: for every e quation de clar ation (∆)( M = N : T ) in S , T has the form El ( A ) . L et c : (Θ) Type b e a c onstant de clar ation in S . Then the fol lowing rule of de duction is admissib le: Γ ⊢ c ~ F = c ~ G : Type Γ  ~ F = ~ G :: Θ Proof. W e shall prov e the following statement. If Γ ⊢ c ~ F = X : T yp e o r Γ ⊢ X = c ~ F : T yp e is der iv able, then X has the form c ~ G , and Γ  ~ F = ~ G :: Θ . The pr o of is by induction o n the deriv ation of the premise . Note that the la st step in this deriv ation ca nnot b e the use of an equation from S . All cases are straightforward. The r esult can now be ‘lifted’ to LF. W e omit the sub- and sup erscripts o n NF and L in the following pr o of. Pr o of of The or em 5.6. Let S satisfy the hypo theses of the theorem. Suppose Γ ⊢ c ~ A = c ~ B : Type is deriv a ble in LF under S . By Theorem 5.4, NF(Γ) ⊢ c NF ( ~ A ) = c NF( ~ B ) : T yp e is deriv able in TF under NF ( S ). W e no te also that NF( S ) satisfies the hypo the- ses of Theorem 5.7. Therefore, NF(Γ)  T F NF( ~ A ) = NF( ~ B ) :: NF(Θ ) (Theorem 5.7) ∴ L (NF(Γ))  T F L (NF( ~ A )) = L (NF( ~ B )) :: L (NF (Θ)) (Theo rem 4.7) ∴ lift( L (NF (Γ)))  LF lift( L (NF( ~ A ))) = lift( L (NF( ~ B ))) :: lift ( L (NF(Θ))) (Theorem 5.2) 34 W e also hav e, by Theor em 5.5,  LF Γ = lift ( L (NF(Γ))) Γ  LF ~ A = lift( L (NF( ~ A ))) :: Θ Γ  LF ~ B = lift( L (NF( ~ B ))) :: Θ Γ  LF Θ = lift ( L (NF(Θ))) It follows that Γ  LF ~ A = ~ B :: Θ as required. In co nt r ast, the a uthor ha s b een unable to find a direct pro o f of this r esult in LF. Here is a second example of how a result may be lifted fro m TF to LF. Let T b e a type theor y sp ecificatio n in LF. Ro ughly , we shall show that, if NF( T ) is strongly normalis ing in TF, then T is strongly normalising in LF. More str ictly , assume w e have decla red T in LF and NF( T ) in TF. Suppose NF( T ) is order able and 1-go o d. Let → R be a reductio n relation on the ob jects of LF, and let → Rβ η be the union of → R and fra mework-level β - a nd η - reduction: ([ x : K ] k ) k ′ → β [ k ′ /x ] k [ x : K ] kx → η k . Define the rela tion ⊲ on the ob jects of TF as follows: M ⊲ N if and only if ther e exist LF-ob jects a , b such that NF( a ) = M , NF( b ) = N , and M → R N . Then we have Theorem 5.8 Supp ose that every obj e ct typ able in TF is str ongly ⊲ -normalising. Then every obje ct typ able in LF is str ongly → Rβ η -normalising. Proof. Supp ose Γ ⊢ a : A a nd a → Rβ η a 1 → Rβ η a 2 → Rβ η · · · (8) is an infinite → R -reduction se q uence starting with a . Then NF(Γ) ⊢ T F NF( a ) : NF( A ), so NF( a ) is strongly ⊲ -nor malisable. Now, if a n → R a n +1 , then NF( a n ) ⊲ NF( a n +1 ); and if a n → β η a n +1 , then NF( a n ) ≡ NF( a n +1 ). So w e have NF( a ) D NF ( a 1 ) D NF( a 2 ) D · · · . This sequence c annot contain an infinite num b er o f ⊲ -reductions ; therefore, there must b e some n such that NF( a n ) ≡ NF( a n +1 ) ≡ NF( a n +2 ) ≡ · · · 35 and hence a n → β η a n +1 → β η a n +2 → β η · · · . This contradicts the fact that LF is s trongly → β η -normalising . It is often easier to prov e tha t NF( T ) is strong ly ⊲ -normalis ing than that T is stro ngly → Rβ η -normalising , b eca use we do not have to consider how → R and framework-level β - a nd η -reduction in ter a ct. W e hav e ma de use in this pro of o f the fact that LF is strong ly β η - normalising under a n a rbitrary type theor y sp ecification. This is not difficult to prove, but, to the b est of the a utho r ’s knowledge, a pro o f has not yet been published, and so we pres e nt one in App endix C. 6. Related W ork Several lambda-fr ee lo gical frameworks hav e app ea r ed, indep endently , since the publication of Adams [5 ]. 6.1. The Canonic al L o gic al F r amework The Canonic al L o gic al F r amework (Canonical LF) [7 , 8] is a s ubsystem of the Edinburgh Log ical F ramework (ELF) that deals only with ob jects in β - normal, η -long for ms. This framework uses a n op eration of her e ditary substitu- tion [ M /x ] m α N which b ehaves similarly to TF’s instantiation. Their op er a tion m ust b e given a simple type α , which plays a simila r role to the a rity in TF. The Canonica l LF is essentially the same sys tem a s the following subsystem of TF k . Let us say that a pr o duct kind ( x 1 : K 1 , . . . , x n : K n ) T is smal l iff the symbol Type does not o ccur in it, and lar ge other wise. W e imp os e the following restrictio ns on TF: • every v a riable that app ea rs in a judgement o r constant declara tion mu s t hav e a small kind; • no equation decla rations may b e made. This subsystem was the system named SP ar ( ω ) − in [5]. W e ca n prov e that TF k is conserv ative ov er this s ubs y stem in a very str ong sense: Theorem 6.1 L et T b e a typ e the ory sp e cific ation c ontaining no e quation de c- lar ations, such t hat every variable in a c onstant de clar ation has a smal l kind. L et J b e a judgement in which every variable has a smal l kind. If J is deriv- able in TF k under T , t hen J is derivable u nder T in SP ar ( ω ) − . In fact, every derivation of J in TF k is a derivation of J in SP ar ( ω ) − . 36 Canonical LF SP ar ( ω ) − Kinds Pro duct kinds o f the form (∆) T yp e Canonical Type F a milies Pro duct kinds of the form (∆)El ( A ) A tomic Type F amilies Ob jects of kind Ty p e Canonical T er ms Abstractions of small kind A tomic T erms Ob jects of small kind T able 1: Corresp ondence b etw een the syn tactic categories of Canonical LF and SPar ( ω ) − . Proof. By insp ectio n of the rules of TF k , we see the following tw o facts. 1. If a v aria ble of larg e kind o ccur s in a der iv a ble judgement, then a v ariable of larg e k ind o ccurs in the c ontext o f that judgement. 2. If a v ar iable of la rge kind o ccurs in the context o f a judgemen t a t some po int in a deriv ation, then a v ar iable of large kind o ccurs in the co ntext of every judgement b elow that p o int . Therefore, if the co nclusion contains no v ariable with larg e kind, then no v ariable with large kind occ ur s anywhere in the deriv ation, and the der iv atio n is v alid in SP ar ( ω ) − . There is a close cor resp ondence b etw een Canonical LF and SP ar ( ω ) − . It is po ssible to define a bijective translation b etw een Canonica l LF and SPar ( ω ) − that ma ps ea ch class o f entit y in the left-hand column of T able 1 to the corr e- sp onding class of entit y in the rig ht -ha nd co lumn. The embedding of TF in LF given in this pap er can b e a da pted in a straig ht- forward w ay to pr ovide an embedding of Canonical LF in ELF. This embedding prov es that the tw o systems a re equiv a lent; tha t is, the der iv able judgemen ts of Canonical LF are exa ctly the de r iv a ble judgements of ELF that a re in β -normal, η -long form. T o the b est of the a utho r ’s knowledge, a pro of o f this fact has not yet b een published. F o r further details, we refer to Adams [5], where a n explicit embedding of SP ar ( ω ) − in ELF is de fined. 6.2. DMBEL Plotkin has pro duced several ‘algebra ic frameworks’ for logics and t yp e theo- ries, including DMBEL (Dep endent Multi-Sorted Binding Equa tio nal Logic) [9, 1 0]. This is a framew o rk that allows the decla ration of theories in- volving second-or der constants, a nd eq ua tions betw een ob jects. It is intended to b e used for studying the theo ry o f the sy ntax and seman tics of logic a nd progra mming languages . The framework DMBEL uses op er ations o f first -or der substitution and se c ond-or der substitution , which are similar to TF’s o p e ration of insta ntiation { M /x } N restricted to the cases where x is of o r der 0 or 1 resp ectively . The fra mework DMBEL is essen tia lly the same as the subsystem of TF k obtained by imp osing the following r estriction: • In every constant decla r ation, equation declaration and judgement, every v ar iable that app ear s m ust have a small k ind of order 0 or 1 . 37 DMBEL SP ar (2) Type consta nt constant of kind (∆) T yp e , where ∆ is small and of or der ≤ 2 T er m constant constant of kind (∆)El ( A ), where ∆ is small and of or der ≤ 2 T er m v a riable v a r iable of small k ind and order 0 Abstraction v ariable v ar iable of small kind and order ≤ 1 Type ob ject of kind T yp e Abstraction type small pro duct kind of order ≤ 1 T er m ob ject of kind El ( A ) Abstraction term abstraction of sma ll kind and order ≤ 1 Context context o f or der ≤ 1 Abstraction context context o f order ≤ 2 Signature constant declar ations in a sp ecificatio n T able 2: Corresp ondence b etw een the syn tactic categories of DMBEL and SP ar (2). It follows that every co nstant that is declared must hav e order at most 2. This subsystem was named SPar (2) in Adams [5]. It ca n be prov en that TF k is conserv ative ov er this subsystem: Theorem 6.2 L et T b e a sp e cific ation in SPar (2) , and let J b e a judgement in which every variable has a smal l kind of or der 0 or 1. Th en any derivation of J u nder T in TF k is a derivation of J un der T in SP ar (2) . Proof. By insp ectio n of the rules of TF k , we see the following four facts. 1. If a v aria ble of larg e kind o ccur s in a der iv a ble judgement, then a v ariable of larg e k ind o ccurs in the c ontext o f that judgement. 2. If a v ar iable of order > 1 o ccur s in a der iv able judgemen t, then a v a riable of order > 1 o ccurs in the c o ntext o f that judgement. 3. If a v ar iable of la rge kind o ccurs in the context o f a judgemen t a t some po int in a deriv ation, then a v ar iable of large kind o ccurs in the co ntext of every judgement b elow that p o int . 4. If a v ariable of or de r > 1 o ccur s in the context of a judgement at some po int in a deriv atio n, then a v aria ble of order > 1 o ccurs in the context of every judgement below that p oint. Therefore, if the conclusion contains no v ar ia ble with la rge kind, and no v aria ble of order > 1 , then no v ar iable with large kind or of o rder > 1 o ccur s anywhere in the deriv ation, and the deriv a tion is v a lid in SPa r (2). There is a close corre s po ndence b etw een DMBE L and SP ar (2). It is p o ssible to define a bijective transla tion betw ee n DMBE L a nd SP ar (2) that maps ea ch class o f entit y in the left-hand co lumn o f T able 2 to the cor resp onding cla s s of ent ity in the right-hand column. The results in this pap er thus show tha t the prop er ties Cut, F unctionality , Equation V alidity and Context Conv ers io n hold for DMBEL, and that DMBEL 38 can b e conser v atively embedded in LF. F urther, if w e remov e equa tio n decla ra- tions fr om DMBEL, then the resulting system can b e conserv atively embedded in b oth Cano nical LF and ELF. 6.3. P AL + The phras e ‘lambda-free lo gical framework’ was o riginally coined to describ e the framework P AL + [1]. This framework do es not use lambda-abstr action, instead taking par ametrisatio n and lo cal definition as primitive. P AL + do es not allow pa rtial application; an n - ary function must b e applied to all n arg umen ts at o nce. It do es still hav e a mechanism for for ming abstractions , howev er; the ob ject let v [ x 1 : K 1 ] = k : K in v in P AL + behaves very similarly to the lambda- abstraction [ x 1 : K 1 ] k . The system TF thus in volves e ven fewer pr imitive co ncepts than P AL + . It can b e pr ov ed that TF can be em b edded in P AL + , in a similar manner to the embedding in LF. W e refer to Adams [5 ] for the details. 7. Conclusion W e hav e pres ented the forma l definition of tw o la mbda-free lo gical fr ame- works, TF and TF k , and prov en several of their metatheoretic prop erties. W e hav e defined translations betw een these tw o frameworks a nd the framework LF, and shown how these can b e used to lift results proven in TF to LF. The idea of a lambda-fr ee framework has now b een inv ented indepe ndent ly by several resear chers, including Aczel (who in ven ted TF), Harp er and Pfen- ing (Ca nonical LF) and Plotkin (DMBEL). These frameworks are pow er ful in many ways. They repres ent ob ject theor ies mor e faithfully than do traditional frameworks; each expres s ion in the ob ject theo ry corresp o nds to a unique o b ject in the framework, rather than a β η - conv ertibility class . Many r esults, suc h as the injectivity of type co nstructors or strong nor malisation, ar e often ea s ier to prov e using a lambda-free fr amework than a tra ditional framework. The cost is that the metatheoretic prop er ties o f a lambda-free framework are muc h more difficult to establish. This should b e seen as a o ne-time cost, how ever; thes e prop erties need only b e esta blished for a framework o nce, and the framework can then b e use d fo r many o b ject theories and the lifting of many results. W e hav e b een able to establish these prop erties for tw o large cla s ses of ob ject theories : those with no equation declarations, and those with only declarations of order ≤ 2. It follows that these results hold for Cano nical LF and DMBE L, as these s ystems ar e isomo r phic to c o nserv ative subsystems of TF, one o f which do es not allow e quation declara tions, and o ne of which do es not allow sp ecifica tions of order > 2. F or the future, the mos t immediate need is to remove this restr ic tion on the sp ecifications. W e would dea r ly lo ve to be able to prov e that every o rderable sp ecification is go o d, as we would then b e able to remov e the h yp othes e s ab out the n -go o dness of specific a tions and the o rder of c o ntexts in each of the results 39 in this pap er. F urther work should also include constr ucting ne w lambda-fre e logical fra meworks with features such as s ubt yping , co ercive subt yping, or meta- logical reasoning, so that res ults ca n b e lifted to traditiona l fr a meworks that hav e these features. Ac kno wle d g ements Thanks to Zhaohui Luo for helpful commen ts and pro ofrea ding. Man y thanks to Randy Pollac k for bringing the systems CLF and DMBEL to m y attent io n. References [1] Z. Luo, P AL+: A lam b da-free logical fr a mework, Jo urnal of F unctiona l Progr amming 13 (2) (200 3) 3 17–33 8. [2] R. Har pe r , F. Hons ell, G. P lotkin, A fra mework for defining log ic s , Jo ur nal of the Asso cia tion fo r Computing Machinery 40 (1) (1993) 1 43–18 4, a pre- liminary version app eared in the Pr o c e e dings of the Symp osium on L o gic in Computer Scienc e , pag es 194–20 4, June 19 87. [3] B. Nordstr¨ om, K. Petersson, J. Smith, Pro gramming in Martin-L¨ o f ’s Type Theory: An Introduction, O xford Univ er sity Pr ess, 1990. [4] P . Aczel, Y et another log ic a l framework, unpublished. [5] R. Adams, A mo dular hierar ch y of logical frameworks, Ph.D. thesis, Uni- versit y of Manchester (2004). [6] Z. Luo, Co mputatio n and Reasoning : A Type Theory for Co mputer Sci- ence, no. 11 in Int er national Series of Monographs on Computer Scienc e , Oxford Universit y P ress, 1994 . [7] R. Harp er, D. R. Lica ta, Mec hanizing metatheo ry in a logical frame- work, J ournal of F unctional P rogr amming 17 (4–5) (20 07) 6 13–6 7 3. doi:10 .1017 /S095 6796807006430 . [8] W. Lov as, F. P fenning, A bidirectio nal r efinement t yp e sys tem for LF, Electr o n. No tes Theo r. Comput. Sci. 1 96 (2008 ) 1 13–12 8. doi:ht tp:// ds.do i.org/10.1016/j.entcs.2007.09.021 . [9] G. Plo tkin, An algebra ic framework for logics a nd type theories, T alk given at LFMTP’06 (August 2 006). [10] R. Pollac k, Some recent log ical frameworks, T a lk given at ProgLog, slides av a ilable a t homepa ges.i nf.ed .ac.uk/rpollack/export/canonicalLF talk.p df (F ebrua ry 200 7 ). 40 [11] R. Adams, A mo dula r hie r arch y of logical fr ameworks, in: S. Berardi, M. Copp o, F. Damiani (Eds.), Types for Pro ofs and Progra ms, Interna- tional W or k shop, TYPES 20 03, T orino, Italy , April 30 - Ma y 4, 2003, Revised Selected Papers , V ol. 3085 of LNCS, Spr inger, 2004 , pp. 1– 16. [12] T. Co quand, G. Huet, The calculus of constructions, Information and Com- putation 76 (1 9 88) 95–12 0. [13] Z. Luo, R. Adams, Structur a l subtyping for inductive types with functorial equality rules, Mathematica l Structures in C o mputer Science 18 (5) (2008) 931–9 72. A. M e tatheory o f TF W e present her e the pro of of the basic metatheor etic prop er ties of TF and TF k . The pro o fs for each sy stem are very simila r ; we shall work in TF for most of this section, a nd mar k with the symbol § the changes tha t need to be made to obtain a pro of for TF k . These c ha nges are all very minor. The most substantial is in Lemma A.7. Fix a na tur al num b er n , and let T b e a type theor y sp ecificatio n in TF ( § or TF k ) that is n - go o d. Throug hout this section, we assume tha t every kind, context, v ar ia ble, co nstant and abstraction that app ea r s is of order ≤ n . W e shall b egin by proving the following tw o prop erties: Cut. W e s ay that the prop erty Cut holds for a kind K if and only if, whenever Γ , x : K , ∆ ⊢ J , and Γ  F : K , then Γ , { F /x } ∆ ⊢ { F / x }J . F unctionality. W e say that the prop erty F unctionality holds for a kind K if and only if, whenever Γ , x : K , ∆ ⊢ M : T and Γ  F = G : K , then Γ , { F /x } ∆ ⊢ { F /x } M = { G/ x } M : { F / x } T . W e first note: Lemma A. 1 L et K b e a kind. Supp ose the pr op erties Cut and F unctionality hold for K . Then so do es t he fol lowing: if Γ , x : K, ∆ ⊢ M = N : T and Γ  F = G : K , then Γ , { F /x } ∆ ⊢ { F /x } M = { G/x } N : { F /x } T . Proof. Supp ose Γ , x : K , ∆ ⊢ M = N : T and Γ  F = G : K . Since the sp ecification is go o d, we hav e Γ  F : K , and s o F unctiona lity gives Γ , { F / x } ∆ ⊢ { F /x } M = { F /x } N : { F /x } T . The go o dness of the s pe c ific a tion als o gives us Γ ⊢ N : T , and so Γ , { F / x } ∆ ⊢ { F /x } N = { G/x } N : { F /x } T . The result follows by (trans). Theorem A.2 The pr op erties Cut and F u nctionality hold for every kind K . Proof. The pro of is by double induction, first on the kind K , s econd on the deriv a tion of the judgement Γ , x : K, ∆ ⊢ J or Γ , x : K, ∆ ⊢ M : T . 41 Cut. Let K ≡ (Θ) T and F ≡ [dom Θ] P . ( § In TF k , F will hav e the form [Θ ′ ] P .) W e deal here with the c ase where the la st step in the deriv a tion is (v ar e q) Γ , x : (Θ ) T , ∆  ~ H 1 = ~ H 2 :: Θ Γ , x : (Θ ) T , ∆ ⊢ x ~ H 1 = x ~ H 2 : { ~ H 1 / Θ } T By the induction hypothesis, we have Γ , { F / x } ∆  { F /x } ~ H 1 = { F /x } ~ H 2 :: Θ . W e are also given that Γ , Θ ⊢ P : T . By W eakening and (ref ), Γ , { F / x } ∆ , Θ ⊢ P = P : T . By rep eatedly applying Lemma A.1 with each of the kinds in Θ, we have the desired conclusio n Γ , { F / x } ∆ ⊢ {{ F /x } ~ H 1 / Θ } P = {{ F /x } ~ H 2 / Θ } P : {{ F /x } ~ H 1 / Θ } T . F unctionality. Let K ≡ (Θ) T , F ≡ [dom Θ] P and G ≡ [dom Θ] Q . ( § In TF k , F will hav e the form [Θ ′ ] P and G the form [Θ ′′ ] Q .) W e deal here with the case where the last step in the der iv ation is (v ar ) Γ , x : (Θ ) T , ∆  ~ H :: Θ Γ , x : (Θ) T , ∆ ⊢ x ~ H : { ~ H / Θ } T By the induction hypothesis, we have Γ , { F / x } ∆  { F /x } ~ H = { G/x } ~ H :: Θ . W e are also given that Γ , Θ ⊢ P = Q : T . By rep eatedly applying Lemma A.1 with each of the kinds in Θ, we have the desired conclusio n Γ , { F / x } ∆ ⊢ {{ F /x } ~ H / Θ } P = {{ G/x } ~ H / Θ } Q : {{ F / x } ~ H / Θ } T . W e also deal with the case where the last step in the deriv ation is (conv) Γ , x : K, ∆ ⊢ M : El ( A ) Γ , x : K, ∆ ⊢ A = B : T yp e Γ , x : K , ∆ ⊢ M : El ( B ) W e are given Γ  F = G : K ; by the go odness of the sp ecification, we als o hav e Γ  F : K . By the induction hypothesis , we may apply F unctionality to the first premise and C ut to the second to give Γ , { F / x } ∆ ⊢ { F /x } M = { G/x } M : El ( { F /x } A ) Γ , { F / x } ∆ ⊢ { F /x } A = { F /x } B : Type . The result follows by (conv eq). 42 Our next ob jective is to prove the following prop er ty: Context Conversion. W e say that the pro p e rty Con text Conv ersio n holds fo r a kind K if and only if, whenever Γ , x : K, ∆ ⊢ J and Γ  K = K ′ , then Γ , x : K ′ , ∆ ⊢ J . Once again, we need some auxilia r y lemmas: Lemma A. 3 L et K b e a kind, and supp ose Context Conversion holds for every kind of smal ler arity than K . If o (Γ) ≤ n and Γ  K = K ′ then Γ  K ′ = K . Proof. The pro of is by induction o n K . If K ≡ T yp e , there is no thing to prove. If K has the form El ( A ), w e simply apply (sym). Suppo se K ≡ ( x : K 1 ) K 2 and K ′ ≡ ( x : K ′ 1 ) K ′ 2 . W e ar e given Γ  K 1 = K ′ 1 , Γ , x : K 1  K 2 = K ′ 2 . Applying Co ntext Conv ers ion gives Γ , x : K ′ 1  K 2 = K ′ 2 . The desired judge- men ts Γ  K ′ 1 = K 1 , Γ , x : K ′ 1  K ′ 2 = K 2 follow by the induction hypothesis . Lemma A. 4 L et ∆ b e a c ontext, and supp ose Context Conversion holds for every kind of sm al ler arity than ∆ . If Γ  ∆ = ∆ ′ then Γ  ∆ ′ = ∆ . Proof. The pro of is by induction on the length of ∆. The case o f leng th 0 is trivial. F or the inductiv e step, let ∆ ≡ ∆ 0 , x : K and ∆ ′ ≡ ∆ ′ 0 , x : K ′ . W e are g iven Γ  ∆ 0 = ∆ ′ 0 Γ , ∆ 0  K = K ′ . By the induction hypo thesis, Γ  ∆ ′ 0 = ∆ 0 . Applying Context Conv ersio n with each of the kinds in ∆ 0 gives Γ , ∆ ′ 0  K = K ′ , and so Γ , ∆ ′ 0  K ′ = K by the previous lemma. Lemma A. 5 Supp ose Context Conversion holds for every kind of lower arity than K 1 . If Γ  K 1 = K 2 and Γ  K 2 = K 3 then Γ  K 1 = K 3 . Proof. The pro of is by induction on K 1 . The case K 1 ≡ T yp e is trivial. If K 1 has the form El ( A ), we s imply a pply (trans). Suppo se K 1 ≡ ( x : J 1 ) L 1 , K 2 ≡ ( x : J 2 ) L 2 , and K 3 ≡ ( x : J 3 ) L 3 . W e ar e given Γ  J 1 = J 2 Γ  J 2 = J 3 Γ , x : J 1  L 1 = L 2 Γ , x : J 2  L 2 = L 3 By Le mma A.3, we have Γ  J 2 = J 1 ; applying Cont ex t Conv ers ion gives Γ , x : J 1  L 2 = L 3 . The des ired judgements Γ  J 1 = J 3 and Γ , x : J 1  L 1 = L 3 follow by the induction hypothesis . 43 Lemma A. 6 Supp ose Context Conversion holds for every kind of lower arity than ∆ 1 . If Γ  ∆ 1 = ∆ 2 and Γ  ∆ 2 = ∆ 3 , then Γ  ∆ 1 = ∆ 3 . Proof. The pro of is by induction on the length of ∆ 1 . The case of length 0 is trivial. F or the inductiv e step, let ∆ 1 ≡ Θ 1 , x : K 1 ; ∆ 2 ≡ Θ 2 , x : K 2 ; a nd ∆ 3 ≡ Θ 3 , x : K 3 . W e ar e g iven Γ  Θ 1 = Θ 2 Γ  Θ 2 = Θ 3 Γ , Θ 1  K 1 = K 2 Γ , Θ 2  K 2 = K 3 By Lemma A.4, we have Γ  Θ 2 = Θ 1 . Rep ea tedly applying Co ntext Co nv er- sion gives us Γ , Θ 1  K 2 = K 3 . The desir ed judgements Γ  Θ 1 = Θ 3 , Γ , Θ 1  K 1 = K 3 follow by the induction hypothesis . Lemma A. 7 Supp ose Context Conversion holds for every kind of lower arity than K . If Γ  F : K and Γ  K = K ′ , then Γ  F : K ′ . Proof. Let K ≡ (Θ ) T , K ′ ≡ (Θ ′ ) T ′ and F ≡ [dom Θ] M . W e are g iven Γ , Θ ⊢ M : T , Γ  Θ = Θ ′ , Γ , Θ  T = T ′ . By (conv), we hav e Γ , Θ ⊢ M : T ′ . Applying Context C o nv ersion with e a ch of the kinds in Θ yie lds Γ , Θ ′ ⊢ M : T ′ as required. § In TF k , let F ≡ [Θ 1 ] M . In addition to the ab ov e, we a re given Γ  Θ = Θ 1 and mu s t prov e Γ  Θ ′ = Θ 1 . This follows from Lemmas A.4 and A.6. Lemma A. 8 Supp ose Context Conversion holds for e ach of the kinds in ∆ . If Γ  ~ F :: ∆ and Γ  ∆ = ∆ ′ , then Γ  ~ F :: ∆ ′ . Proof. The pro of is by induction o n the length of ∆ and ∆ ′ . The cas e of length 0 is trivia l. F or the induction step, let ∆ ≡ ∆ 0 , x : K , let ∆ ′ ≡ ∆ ′ 0 , x : K ′ , and let ~ F ≡ ~ F 0 , F 1 . Then we are given Γ  ~ F 0 :: ∆ 0 Γ  F 1 : { ~ F 0 / ∆ 0 } K Γ  ∆ 0 = ∆ ′ 0 Γ , ∆ 0  K = K ′ By the induction hypo thesis, Γ  ~ F 0 :: ∆ ′ 0 . 44 Applying Cut r e p ea tedly gives Γ  { ~ F 0 / ∆ 0 } K = { ~ F 0 / ∆ 0 } K ′ and the desired judgement Γ  F 1 : { ~ F 0 / ∆ 0 } K ′ follows by the previous lemma. Theorem A.9 The pr op erty Context Conversion holds for every kind K . Proof. Let K ≡ (Θ) T and K ′ ≡ (Θ ′ ) T ′ , so we are given Γ  Θ = Θ ′ and Γ , Θ  K = K ′ . The pro o f is by double induction, first on the kind K , seco nd on the deriv ation of Γ , x : K , ∆ ⊢ J . W e deal here with the case where the last step in the deriv a tion is (v ar) Γ , x : (Θ) T , ∆  ~ F :: Θ Γ , x : (Θ) T , ∆  x ~ F : { ~ F / Θ } T By the induction hypothesis, we have Γ , x : (Θ ′ ) T ′ , ∆  ~ F :: Θ . Applying Lemma A.8, we hav e Γ , x : (Θ ′ ) T ′ , ∆  ~ F :: Θ ′ ∴ Γ , x : (Θ ′ ) T ′ , ∆  x ~ F : { ~ F / Θ } T ′ (v ar ) Applying Cut yields Γ , x : (Θ ′ ) T ′ , ∆ ⊢ { ~ F / Θ } T = { ~ F / Θ } T ′ and the result follows b y (sy m) and (conv). The ca se where the last step is (v are q) is similar, and the o ther cases are all straightforward. This completes the pro of of Theo rem 3.8. Note. The a s sumption of n -go o dness is essential for this pr o of. T o remov e the need for it, one sug gestion would b e to add the following as primitive rules of TF: (Leq) Γ ⊢ M = N : T Γ ⊢ M : T (Req) Γ ⊢ M = N : T Γ ⊢ N : T This would not work, how ever. The pro o f o f Theorem A.2 would then fail, as we would not be able to complete the inductive step for the pro of of F unctionality in the cas e that the last step in the deriv ation is the rule (Req). 45 B. 2 -go o d Sp ecifications Our aim in this section is to show that, if T is an orde r able t yp e theory sp ecification in which every declara tion is of order ≤ 2, then T is 2-go o d. In order to prov e this, w e must prov e four pr op erties hold simultaneously . The following pro of holds whether we ar e working in TF or TF k . Theorem B.1 Supp ose T is an or der able sp e cific ation, and every de clar ation in T has or der ≤ 2 . Then: 1. Whenever Γ ⊢ M = N : T and Γ has or der ≤ 2 then Γ ⊢ M : T and Γ ⊢ N : T . 2. Whenever Γ , x : K, ∆ ⊢ J , Γ  F : K and Γ , x : K , ∆ is of or der ≤ 2 , then Γ , { F /x } ∆ ⊢ { F /x }J . 3. Whenever Γ , x : K , ∆ ⊢ M : T , Γ  F = G : K and Γ , x : K , ∆ is of or der ≤ 2 , then Γ , { F /x } ∆ ⊢ { F /x } M = { G/x } M : { F /x } T . 4. Whenever Γ , x : K , ∆ ⊢ J , Γ  K = K ′ and Γ , x : K, ∆ is of or der ≤ 2 , then Γ , x : K ′ , ∆ ⊢ J . Proof. By the or derability o f T , we may replace the rules (const), (const eq) and (eq ) with the following rules without changing the set of deriv a ble judge - men ts. F o r each constant dec laration c : (∆) T , (const ′ ) Γ  ~ F :: ∆ ∆  T kind Γ ⊢ c ~ F : { ~ F / ∆ } T (const eq ′ ) Γ  ~ F = ~ G :: ∆ ∆ ⊢ T kind Γ ⊢ c ~ F = c ~ G : { ~ F / ∆ } T F or each equatio n declaration (∆)( M = N : T ), (eq ′ ) Γ  ~ F :: ∆ ∆ ⊢ M : T ∆ ⊢ N : T Γ ⊢ { ~ F / ∆ } M = { ~ F / ∆ } N : { ~ F / ∆ } T Given a finite seq ue nce of decla rations s , let us write Γ ⊢ s J to mean that there e x ists a deriv ation of the judgemen t Γ ⊢ J such that, for ev er y br anch in the deriv ation, the declar ations used at the (const), (const eq) and (eq ) no des , taken in or der from leaf to ro o t, form a subsequence of s . F or defined judgement forms, w e write (e.g.) Γ  s ( x : E l ( A ))El ( B ) = ( x : El ( A ′ ))El ( B ′ ) to mean Γ ⊢ s A = A ′ : T yp e and Γ , x : A ⊢ s B = B ′ bo th hold. W e write s ⊏ t to deno te that s is a prop er initial segment of t . W e wr ite Γ ⊢ ⊏ s J to deno te that there exists t ⊏ s such that Γ ⊢ t J . Define the or der of a sequence s by o ( s ) = max { o ( δ ) | δ ∈ s } . 46 W e define the following pr op erties fo r natural num b ers m , n with n < m and sequences s . • CUT ( m, n, s ) is the statement: whenever Γ , x : K , ∆ has order m , K has order n , and Γ , x : K , ∆ ⊢ s J and Γ  s F : K , then Γ , { F /x } ∆ ⊢ s { F /x }J . • FUNC ( m, n, s ) is the statement: whenever Γ , x : K , ∆ ha s o rder m , K has or der n , and Γ , x : K, ∆ ⊢ s M : T and Γ  s F = G : K , then Γ , { F / x } ∆ ⊢ s { F /x } M = { G/ x } M : { F /x } T . • CC ( m, n, s ) is the statemen t: whenever Γ , x : K , ∆ has o rder m , K has order n , and Γ , x : K, ∆ ⊢ s J and Γ  s K = K ′ , then Γ , x : K ′ , ∆ ⊢ s J . • EQV AL ( m, s ) is the statemen t: whenever Γ ha s order m and Γ ⊢ s M = N : T , then Γ ⊢ s M : T and Γ ⊢ s N : T . (EQV AL stands for ‘equation v alidity’.) • FUNCEQ ( m, n, s ) is the sta temen t: whenev er Γ , x : K , ∆ has order m , K has order n , and Γ , x : K, ∆ ⊢ s M = N : T and Γ  s F = G : K , then Γ , { F / x } ∆ ⊢ s { F /x } M = { G/ x } N : { F /x } T . • GFUNC ( m, n, s ) is the statement: whenev er Γ , x : K , ∆ has order m , K has order n , and Γ , x : K, ∆ ⊢ s M : T , Γ  s F = G : K , Γ  s F : K and Γ  s G : K , then Γ , { F / x } ∆ ⊢ s { F /x } M = { G/ x } M : { F /x } T . (GFUNC stands for ‘g uarded functionality’.) W e shall emplo y the fo llowing abbreviations: CUT ( ≤ a, < b , s ), for example, shall mean that CUT ( m, n, s ) holds for all m ≤ a and all n < b . Another example: CC ( m, n, ⋖ s ) shall mean CUT ( m, n, t ) holds for a ll t ⋖ s . Our aim is to show EQV AL (2 , s ) for all seq uences s of decla rations from T . By pro o fs s imilar to the ones in the App endix A, we can prove the following results for all m and s : (1) FUNCEQ ( m, < n, s ) ∧ CUT ( m, < n, s ) ⇒ GFUNC ( m , n, s ) (2) CUT ( m, < n, s ) ∧ FUNCEQ ( m, < n, s ) ⇒ CUT ( m, n, s ) (3) CUT ( m, < n, s ) ∧ CC ( m, < n − 1 , s ) ∧ EQV AL ( m, s ) ⇒ CC ( m, n, s ) (4) GFUNC ( m, n, s ) ∧ CUT ( m, n, s ) ⇒ GFUNCEQ ( m, n, s ) The following re sults are trivia l: (5) GFUNC ( m, n, s ) ∧ E QV AL ( m, s ) ⇒ FUNC ( m, n, s ) (6) GFUNCEQ ( m, n, s ) ∧ E QV AL ( m, s ) ⇒ FUNCEQ ( m, n, s ) 47 Claim. (7) The prop erties GFUNCEQ ( m, < m − 1 , s ) CC ( m, < m − 2 , s ) GFUNCEQ ( ≤ ma x( m, o ( s )) , < o ( s ) , ⊏ s ) CC ( ≤ max( m, o ( s ) − 1) , < o ( s ) − 1 , ⊏ s ) CUT ( ≤ max( m, o ( s )) , < o ( s ) , ⊏ s ) ent a il EQV AL ( m, s ). Pr o of. W e prov e that, whenever Γ has or der ≤ m and Γ ⊢ s M = N : T , then Γ ⊢ s M : T and Γ ⊢ s N : T , by induction o n the deriv a tion o f Γ ⊢ s M = N : T . Suppo se the la st step in the deriv a tion is (const eq ′ ) Γ  s ~ F = ~ G :: ∆ ∆  T kind Γ ⊢ s c ~ F = c ~ G : { ~ F / ∆ } T where we have ( c : (∆) T ) ∈ s . Let s = s 1 , c : (∆) T , s 2 , where c : (∆) T does not o ccur in s 2 . The induction h yp othes is g ives Γ  s 1 ~ F :: ∆, and so Γ ⊢ s c ~ F : { ~ F / ∆ } T b y (const). The induction hypothesis also gives Γ ⊢ s 1 G i : { ~ F / ∆ } K i , where K i is the i th kind in ∆. By Context V alidity , we also hav e x 1 : K 1 , . . . , x i − 1 : K i − 1  s 1 K i kind . Using GFUNCEQ ( m, < o ( s ) , ⊏ s ), we have Γ  s 1 { ~ F / ∆ } K i = { ~ G/ ∆ } K i , and so, using CC ( m, < o ( s ) − 1 , ⊏ s ), Γ ⊢ s 1 G i : { ~ G/ ∆ } K i , that is, Γ  s 1 ~ G :: ∆. Ther efore, Γ ⊢ s c ~ G : { ~ G/ ∆ } T b y (const). The case (v areq) is similar, using GFUNCEQ ( m, < m − 1 , s ) a nd CC ( m, < m − 2 , s ). Suppo se s = s 1 , (∆)( M = N : T ) , s 2 , and the las t step in the der iv atio n is (eq ′ ) Γ  s 1 ~ F :: ∆ ∆ ⊢ s 1 M : T ∆ ⊢ s 1 N : T Γ ⊢ s { ~ F / ∆ } M = { ~ F / ∆ } N : { ~ F / ∆ } T By CUT ( ≤ max ( m, o ( s )) , < o ( s ) , ⊏ s ), we hav e Γ ⊢ s 1 { ~ F / ∆ } M : { ~ F / ∆ } T and Γ ⊢ s 1 { ~ F / ∆ } N : { ~ F / ∆ } T . 48 W e can now use these seven results to prov e Theorem B.1. Firstly , note that (1) and (2) imply GFUNC ( m, 0 , s ) ∧ CUT ( m, 0 , s ) for every m a nd s . Therefo r e, b y (4), GFUNCEQ ( m, 0 , s ) holds for every m and s . Our goa l is to prov e the following: EQV AL (2 , s ) ∧ FUNC ( 2 , 1 , s ) ∧ CUT (2 , 1 , s ) ∧ CC (2 , 1 , s ) . The pr o of is by induction on the length o f s . Suppose, as induction hypothesis, EQV AL (2 , ⊏ s ) ∧ FUNC (2 , 1 , ⊏ s ) ∧ CUT (2 , 1 , ⊏ s ) ∧ CC (2 , 1 , ⊏ s ) . Then the following ho ld: CC ( 2 , ≤ 1 , ⊏ s ) (b y (3)) EQV AL ( 2 , s ) (b y (7)) FUNC (2 , 0 , s ) (b y (5)) FUNCEQ (2 , 0 , s ) (b y (6)) GFUNC (2 , 1 , s ) (b y (1)) FUNC (2 , 1 , s ) (b y (5)) CUT (2 , 1 , s ) (b y (2)) GFUNCEQ (2 , 1 , s ) (by (4)) FUNCEQ (2 , 1 , s ) (b y (6)) This completes the induction. It do es not seem pos sible to us e the same method to prove that, if every declaration in T is of or der ≤ 3, then T is 3 -go o d. As noted in the pro o f, we ha ve GFUNC ( m, 0 , s ), CUT ( m, 0 , s ) and GFUNCEQ ( m, 0 , s ). It is a lso p os s ible to prov e dir ectly , by an induction on deriv ations, that CC ( m, 0 , s ) holds for all m and s . W e ar e then stuck: for o ( s ) = 2, we have the cir cle of implications EQV AL (3 , s ) ⇒ FUNCEQ (3 , 0 , s ) ⇒ GFUNC (3 , 1 , s ) ∧ CUT (3 , 1 , s ) ⇒ GFUNCEQ (3 , 1 , s ) ⇒ EQV AL (3 , s ) without any immedia te way to prove any of thes e dir ectly . W e a re thus una ble to pr ov e the following statement yet, and present it here as a conjecture: Conjecture B.2 Eve ry or der able t yp e t he ory sp e cific ation is go o d. C. The Strong Normali sability of LF Consider the simply t yp ed lambda-ca lc ulus (STLC), with the follo wing gra m- mar: Type A ::= ∗ | A → A T er m M ::= x | λx : A.M | M M 49 W e shall use the fact that every term t ypa ble in STLC is strongly β η -no rmalising to prov e that every o b ject typable in LF is str ongly β η -normalising. Define a tr a nslation [ [ ] ] that ma ps every kind of LF to a type of STLC, every ob ject of LF to a term of STLC, and e very context of LF to a context o f STLC, as follows: [ [ T yp e ] ] ≡ ∗ [ [El ( k )] ] ≡ ∗ [ [( x : K ) K ′ ] ] ≡ [ [ K ] ] → [ [ K ′ ] ] [ [[ x : K ] k ] ] ≡ λx : [ [ K ] ] . [ [ k ] ] [ [ k k ′ ] ] ≡ [ [ k ] ] [ [ k ′ ] ] [ [ x 1 : K 1 , . . . , x n : K n ] ] ≡ x 1 : [ [ K 1 ] ] , . . . , x n : [ [ K n ] ] The key step in this pr o of is to realise the following fact ab out this trans lation: Lemma C. 1 Under an arbitr ary typ e t he ory sp e cific ation in LF, if Γ ⊢ K = K ′ , then [ [ K ] ] ≡ [ [ K ′ ] ] . Proof. The pro of is a simple induction on deriv ations. Using this le mma , w e ca n establish the following: Lemma C. 2 Supp ose Γ ⊢ k : K . L et c 1 , . . . , c m b e the c onstant s that o c cur in k , and let them b e de clar e d with kinds c 1 : K 1 , . . . , c m : K m . Then c 1 : [ [ K 1 ] ] , . . . , c m : [ [ K m ] ] , [ [Γ] ] ⊢ [ [ k ] ] : [ [ K ] ] in STLC. Proof. The pro of is by induction o n the deriv ation of Γ ⊢ k : K . Lemma C. 3 If k and k ′ ar e LF- obje cts and k → β η k ′ , then [ [ k ] ] → β η [ [ k ′ ] ] . Proof. W e first e s tablish the fact that [ [[ k /x ] k ′ ] ] ≡ [[ [ k ] ] / x ] [ [ k ′ ] ] by induction on k ′ . Now, if k ≡ ([ x : K ] k 1 ) k 2 and k ′ ≡ [ k 2 /x ] k 1 , then [ [ k ] ] ≡ ( λx : [ [ K ] ] . [ [ k 1 ] ]) [ [ k 2 ] ] → β [[ [ k 2 ] ] /x ] [ [ k 1 ] ] ≡ [ [ k ′ ] ] . The other cases a r e s imilar. 50 These allow us to prov e the theor em w e want: Theorem C.4 Under an arbitr ary typ e the ory s p e cific ation in LF, if Γ ⊢ k : K , then k is st ro ngly β η -normalising. Proof. Supp ose k → β η k 1 → β η k 2 → β η · · · is an infinite reduction sequence. By Lemma C.2, we ha ve that [ [ k ] ] is typable in STL C under some context; a nd by Lemma C.3, we hav e that [ [ k ] ] → β η [ [ k 1 ] ] → β η [ [ k 2 ] ] → β η · · · is an infinite reduction sequence. This contradicts the fact that STLC is stro ngly normalising. 51

Original Paper

Loading high-quality paper...

Comments & Academic Discussion

Loading comments...

Leave a Comment