ebook img

Higher-Order Termination: from Kruskal to Computability PDF

0.13 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Higher-Order Termination: from Kruskal to Computability

Higher-Order Termination: From Kruskal to Computability Fre´de´ricBlanqui1,Jean-PierreJouannaud2⋆,andAlbertRubio3 1 INRIA&LORIA,BP101,54602Villiers-le´s-NancyCEDEX,France 7 2 LIX,E´colePolytechnique,91400Palaiseau,France 0 3 TechnicalUniversityofCatalonia,PauGargallo5,08028Barcelona,Spain 0 2 n 1 Introduction a J 5 Terminationisamajorquestioninbothlogicandcomputerscience.Inlogic,termina- tionisattheheartofprooftheorywhereitisusuallycalledstrongnormalization(ofcut ] elimination).Incomputerscience,terminationhasalwaysbeenanimportantissuefor O showingprogramscorrect.Intheearlydaysoflogic,strongnormalizationwasusually L shownbyassigningordinalstoexpressionsinsuchawaythateliminatingacutwould . s yieldan expressionwith a smallerordinal.Inthe earlydaysofverification,computer c scientists used similar ideas, interpreting the arguments of a program call by a natu- [ ralnumber,suchastheirsize.Showingthesizeoftheargumentstodecreaseforeach 2 recursivecallgivesaterminationproofoftheprogram,whichishoweverratherweak v sinceitcanonlyyieldquitesmallordinals.Inthesixties,Taitinventedanewmethod 9 forshowingcuteliminationofnaturaldeduction,basedona predicateovertheset of 3 0 terms, such that the membership of an expression to the predicate implied the strong 9 normalizationpropertyforthatexpression.Thepredicatebeingdefinedbyinductionon 0 types,orevenasafixpoint,thismethodcouldyieldmuchlargerordinals.Latergener- 6 alizedbyGirardunderthenameofreducibilityorcomputabilitycandidates,itshowed 0 very effective in proving the strong normalization property of typed lambda-calculi / s withpolymorphictypes,dependenttypes,inductivetypes,andfinallyacumulativehi- c : erarchyof universes. On the programmingside, research on termination shifted from v programming to executable specification languages based on rewriting, and concen- i X tratedonautomatablemethodsbasedontheconstructiononwell-foundedorderingsof r thesetofterms.ThemilestonehereisDershowitz’srecursivepathordering(RPO),in a thelateseventies,whosewell-foundednessproofisbasedonapowerfulcombinatorial argument, Kruskal’s tree theorem, which also yields rather large ordinals. While the computabilitypredicatesmustbedefinedforeachparticularcase,andtheirproperties provedbyhand,therecursivepathorderingcanbeeffectivelyautomated. These two methods are completely different. Computability arguments show ter- mination, that is, infinite decreasing sequences of expressions e0 ≻ e1 ≻ ...en ≻ en+1...donotexist.Kruskal’sbasedargumentsshowwell-orderedness:foranyinfi- nitesequenceofexpressions{e } ,thereisapairj <ksuchthate (cid:22)e .Itiseasyto i i j k seethatwell-orderednessimpliestermination,buttheconverseisnottrue. ⋆ProjectLogiCal,PoˆleCommundeRechercheenInformatiqueduPlateaudeSaclay,CNRS, E´colePolytechnique,INRIA,Universite´Paris-Sud. In the late eighties, a new question arose: termination of a simply-typed lambda- calculus language in which beta-reduction would be supplemented with terminating first-orderrewriterules.Breazu-TannenandGallierontheonehand[12],andOkada[23] ontheotherhand,showedthatterminationwassatisfied bythecombinationbyusing computability arguments. Indeed, when rewriting operates at basic types and is gen- eratedbyfirst-orderrewriterules, beta-reductionandrewritingdonotinterfere.Their result, proved for a polymorphic λ-calculus, was later generalized to the calculus of constructions[1].Thesituationbecomesradicallydifferentwithhigher-orderrewriting generatedby rulesoperatingonarrow-types,or involvinglambda-bindingsor higher- order variables. Such an example is providedby Go¨del’s system T, in which higher- orderprimitiverecursionfornaturalnumbersgeneratedbyPeano’sconstructors0and sisdescribedbythefollowingtwohigher-orderrules: rec(0,U,V)→U rec(s(X),U,V)→@(V,X,rec(X,U,V)) whererecisafunctionsymboloftypeN→T →(N→T →T)→T,U isahigher- ordervariableoftypeT andV ahigher-ordervariableoftypeN→T →T,foralltype T.JouannaudandOkadainventedtheso-calledgeneral-schema[17],apowerfulgener- alizationofGo¨del’shigher-orderprimitiverecursionofhighertypes.Followingthepath initiatedbyBreazu-TannenandGallierontheonehand,andOkadaontheotherhand, terminationofcalculibasedonthegeneralschemawasprovedbyusingcomputability argumentsas well [2,17,18].The generalschema was then reformulatedby Blanqui, JouannaudandOkada[3,4]inordertoincorporatecomputabilityargumentsdirectlyin its definition,openingthe way to new generalizations.Go¨del’ssystem T can be gen- eralized in two ways, by introducingtype constructorsand dependenttypes, yielding theCalculusofConstructions,andbyintroducingstrictlypositiveinductivetypes.Both togetheryield theCalculusofInductiveConstructions[24],thetheoryunderlyingthe Coqsystem[14],inwhichrewriteruleslikestrongeliminationoperateontypes,raising newdifficulties.Blanquigaveageneralizationofthegeneralschemawhichincludesthe CalculusofInductiveConstructionsasaparticularcaseunderthenameofCalculusof AlgebraicConstructions[6,7]. Thegeneralschema,however,istoosimpletoanalyzecomplexcalculidefinedby higher-order rewrite rules such as encodings of logics. For that purpose, Jouannaud and Rubio generalized the recursive path ordering to the higher-order case, yielding the higher-order recursive path ordering (HORPO) [19]. The RPO well-foundedness prooffollowsfromKruskal’stree theorem,butno such theoremexistsin presenceof a binding construct, and it is not at all clear that such a theorem may exist. What is remarkable is that computability argumentsfit with RPO’s recursive structure. When applied to RPO, these arguments result in a new, simple, well-foundedness proof of RPO.Onecouldevenarguethatthisisthefirstwell-foundednessproofofRPO,since Dershowitzshowedmore:well-orderedness. Combining the general schema and the HORPO is indeed easy because their ter- minationpropertiesarebothbasedoncomputabilityarguments.Theresultingrelation, HORPO withclosure,combinesanorderingrelationwitha membershippredicate.In thispaper,wereformulateandimprovearecentideaofBlanqui[9]bydefininganew versionoftheHORPOwithclosurewhichintegratessmoothlytheideaofthegeneral schemaintoHORPOintheformofaneworderingdefinition. Sofar,wehaveconsideredthekindofhigher-orderrewritingdefinedbyusingfirst- order pattern matching as in the calculus of constructions. These orderings need to containβ-andη-reductions.Showingterminationofhigher-orderrewriterulesbasedon higher-orderpatternmatching,thatis,rewritingmoduloβandηnowusedasequalities, turnsouttorequiresimplemodificationsofHORPO[20].Wewillthereforeconcentrate hereonhigher-orderorderingscontainingβ-andη-reductions. We introducehigher-orderalgebrasin Section 2. In Section 3, we recallthe com- putability argument for this variation of the simply typed lambda calculus. Using a computability argument again, we show in Section 4 that RPO is well-founded. We introducethegeneralschemainsection5,andtheHORPOinSection6beforetocom- binebothinSection7.Weendupwithrelatedworkandopenproblemsinthelasttwo sections. 2 Higher-Order Algebras The notion of a higher-order algebra given here is the monomorphic version of the notion of polymorphic higher-order algebra defined in [21]. Polymorphism has been ruledoutforsimplicity. 2.1 Types,SignaturesandTerms GivenasetSofsortsymbolsofafixedarity,denotedbys:∗n ⇒∗,thesetT oftypes S isgeneratedfromthesesetsbythearrowconstructor: T :=s(Tn)|(T →T ) S S S S fors:∗n ⇒∗ ∈S Typesheadedby→arearrowtypeswhiletheothersarebasictypes.Typedeclarations are expressions of the form σ1 × ··· × σn → σ, where n is the arity of the type declaration,andσ1,...,σn,σaretypes.Atypedeclarationisfirst-orderifitusesonly sorts,otherwisehigher-order. Weassumegivenasetoffunctionsymbolswhicharemeanttobealgebraicopera- tors.Eachfunctionsymbolf isequippedwithatypedeclarationf:σ1×···×σn →σ. WeuseF forthesetoffunctionsymbolsofarityn.F isafirst-ordersignatureifall n itstypedeclarationsarefirst-order,andahigher-ordersignatureotherwise. ThesetofrawtermsisgeneratedfromthesignatureF andadenumerablesetX of variablesaccordingtothegrammar: T :=X |(λX.T)|@(T,T)|F(T,...,T). Termsgeneratedbythefirsttwogrammarrulesarecalledalgebraic.Termsoftheform λx.u are called abstractionswhile terms of the form @(u,v) are called applications. Theterm@(u,v)iscalleda(partial)left-flatteningof@(...@(@(u,v1),v2),...,vn), withubeingpossiblyanapplicationitself.Termsotherthanabstractionsaresaidtobe neutral.WedenotebyVar(t)(BVar(t))thesetoffree(bound)variablesoft.Wemay assumeforconvenience(andwithoutfurthernotice)thatboundvariablesinatermare alldifferent,andaredifferentfromthefreeones. Termsareidentifiedwithfinitelabeledtreesbyconsideringλx.,foreachvariablex, asaunaryfunctionsymbol.Positionsarestringsofpositiveintegers,theemptystring Λ denotingthe rootposition.Thesubterm of t at positionp is denotedby t| , andby p t[u] the result of replacingt| at positionp in t by u. We write s(cid:3)u if u is a strict p p subtermofs.We uset[] foratermwithahole,calledacontext.Thenotationswill p beambiguouslyusedtodenotealist,amultiset,orasetoftermss1,...,sn. 2.2 TypingRules Typingrulesrestrictthesetoftermsbyconstrainingthemtofollowaprecisediscipline. Environmentsaresetsofpairswrittenx : σ,wherexisavariableandσ isatype.Let Dom(Γ) = {x | x : σ ∈ Γ forsometypeσ}. We assume there is a unique pair of the formx : σ for everyvariablex ∈ Dom(Γ). Ourtypingjudgmentsare written as Γ ⊢ M : σ ifthetermM canbeprovedtohavethetypeσ intheenvironmentΓ.A termM hastypeσ in theenvironmentΓ if Γ ⊢ M : σ isprovablein theinference system of Figure 1. A term M is typable in the environmentΓ if there exists a type σ such that M has type σ in the environmentΓ. A term M is typable if it is typable in some environmentΓ. Note that function symbols are uncurried,hence must come alongwithalltheirarguments. Functions: Variables: f :σ1×...×σn→σ x:σ∈Γ Γ ⊢ t1 :σ1 ... Γ ⊢ tn :σn Γ ⊢ x:σ Γ ⊢ f(t1,...,tn):σ Abstraction: Application: Γ ∪{x:σ} ⊢ t:τ Γ ∪{x:σ} ⊢ s:σ→τ Γ ⊢ t:σ Γ ⊢ (λx:σ.t):σ→τ Γ ⊢ @(s,t):τ Fig.1.Typingjudgmentsinhigher-orderalgebras 2.3 Higher-OrderRewriteRules Substitutionsarewrittenasin{x1 : σ1 7→ (Γ1,t1),...,xn : σn 7→ (Γn,tn)}where, foreveryi ∈ [1..n],t isassumeddifferentfromx andΓ ⊢ t :σ .Wealsoassume i i i i i that S Γ is an environment. We often write x 7→ t instead of x : σ 7→ (Γ,t), in i i particular when t is ground.We use the letter γ for substitutionsand postfix notation fortheirapplication.Substitutionsbehaveasendomorphismsdefinedonfreevariables. A(possiblyhigher-order)termrewritingsystemisasetofrewriterulesR={Γ ⊢ l → i i r : σ } ,wherel andr arehigher-ordertermssuchthatl andr havethesametype i i i i i i i σ intheenvironmentΓ .GivenatermrewritingsystemR,atermsrewritestoaterm i i p t at position p with the rule l → r and the substitution γ, written s−→t, or simply l→r s→ t,ifs| =lγandt=s[rγ] . R p p p Atermssuchthats−→tiscalledR-reducible.Thesubterms| isaredexins,and p R tisthereductofs.IrreducibletermsaresaidtobeinR-normalform.Asubstitutionγ ∗ isinR-normalformifxγisinR-normalformforallx.Wedenoteby−→thereflexive, R transitiveclosureoftherewriterelation−→. R Givenarewriterelation−→,atermsisstronglynormalizingifthereisnoinfinite sequence of rewrites issuing from s. The rewrite relation itself is strongly normaliz- ing, or terminating, if all terms are strongly normalizing, in which case it is called a reduction. Threeparticular higher-orderequation schemasoriginate fromthe λ-calculus, α-, β-andη-equality: λx.v = λy.v{x7→y}ify 6∈BVar(v) ∪ (Var(v)\{x}) α @(λx.v,u)−→ v{x7→u} β λx.@(u,x) −→ u ifx6∈Var(u) η Asusual,wedonotdistinguishα-convertibleterms.β-andη-equalitiesareusedas reductions,whichisindicatedbythelong-arrowsymbolinsteadoftheequalitysymbol. The above rule-schemasdefine a rewrite system which is known to be terminating,a resultprovedinSection3. 2.4 Higher-OrderReductionOrderings Wewillmakeintensiveuseofwell-foundedorderings,usingthevocabularyofrewrite systemsfororderings,forprovingstrongnormalizationproperties.Forourpurpose,an ordering,usuallydenotedby≥,isareflexive,symmetric,transitiverelationcompatible withα-conversion,thatis,s= t≥u= vimpliess≥v,whosestrictpart>isitself α α compatible.We will essentially use strictorderings,and hence,the wordorderingfor them too. We will also make use of order-preservingoperationson relations, namely multisetandlexicographicextensions,see[15]. Rewrite orderings are monotonic and stable orderings,reduction orderings are in addition well-founded, while higher-order reduction orderings must also contain β- andη-reductions.Monotonicityof>isdefinedasu > v impliess[u] > s[v] forall p p contextss[] .Stabilityof>isdefinedasu > v impliessγ > tγ forallsubstitutions p γ. Higher-orderreduction orderingsare used to prove termination of rewrite systems includingβ-andη-reductionsbysimplycomparingthelefthandandrighthandsides oftheremainingrules. 3 Computability Simplymindedargumentsdonotworkforshowingthestrongnormalizationproperty ofthesimplytypedlambda-calculus,forβ-reductionincreasesthesizeofterms,which precludesaninductionontheirsize,andpreservestheirtypes,whichseemstopreclude aninductionontypes. Tait’sideais togeneralizethe strongnormalizationpropertyinorderto enablean inductionontypes.Toeachtypeσ,weassociateasubset[[σ]]ofthesetofterms,called the computabilitypredicateof type σ, orset of computableterms of typeσ. Whether [[σ]]containsonlytypabletermsoftypeσ isnotreallyimportant,althoughitcanhelp intuition.Whatisessentialarethepropertiesthatthefamilyofpredicatesshouldsatisfy: (i) computabletermsarestronglynormalizing; (ii) reductsofcomputabletermsarecomputable; (iii) aneutraltermuiscomputableiffallitsreductsarecomputable; (iv) u:σ →τ iscomputableiffsois@(u,v)forallcomputablev. A(non-trivial)consequenceofallthesepropertiescanbeaddedtosmooththeproof ofthecomingMainLemma: (v) λx.uiscomputableiffsoisu{x7→v}forallcomputablev. Apartfrom(v),theabovepropertiesrefertoβ-reductionviathenotionsofreduct and strong normalization only. Indeed, various computability predicates found in the literatureusethesamedefinitionparametrizedbytheconsideredreductionrelation. Thereare severalwaysto define a computabilitypredicate bytaking as its defini- tion some of the propertiesthat it should satisfy. For example, a simple definition by inductionontypesisthis: s:σ ∈[[σ]]forσbasiciffsisstronglynormalizing; s:θ →τ ∈[[σ →τ]]iff@(s,u):τ ∈[[τ]]foreveryu:θ ∈[[θ]]. Analternativeforthecaseofbasictypeis: s:σ ∈[[σ]]iff∀t:τ .s−→tthent∈[[τ]]. This formulation defines the predicate as a fixpoint of a monotonic functional. Once the predicate is defined, it becomes necessary to show the computability properties. Thisusesaninductionontypesinthefirstcaseoraninductiononthedefinitionofthe predicateinthefixpointcase. Tait’sstrongnormalizationproofisbasedonthefollowingkeylemma: Lemma1 (Main Lemma). Let s be an arbitrary term and γ be an arbitrary com- putablesubstitution.Thensγiscomputable. Proof. Byinductiononthestructureofterms. 1. sisavariable:sγiscomputablebyassumptiononγ. 2. s = @(u,v). Since uγ and vγ are computable by induction hypothesis, sγ = @(uγ,vγ)iscomputablebycomputabilityproperty(iv). 3. s = λx.u.Bycomputabilityproperty(v),sγ = λx.uγ iscomputableiffuγ{x 7→ v} iscomputableforan arbitrarycomputablev. Letnowγ′ = γ ∪{x 7→ v}.By definition of substitutions for abstractions, uγ{x 7→ v} = uγ′, which is usually ensuredbyα-conversion.Byassumptionsonγandv,γ′iscomputable,anduγ′is thereforecomputablebythemaininductionhypothesis. ⊓⊔ Sinceanarbitrarytermscanbeseenasitsowninstancebytheidentitysubstitution, which is computable by computabilityproperty (iii), all terms are computableby the MainLemma,hencestronglynormalizingbycomputabilityproperty(i). 4 The Recursive PathOrdering and Computability Inthissection,werestrictourselvestofirst-orderalgebraicterms.Assumingthattheset offunctionsymbolsisequippedwithanorderingrelation≥ ,calledprecedence,anda F statusfunctionstat,writingstat forstat(f),werecallthedefinitionoftherecursive f pathordering: Definition1. s≻ tiff rpo 1. s=f(s)withf ∈F,andu(cid:23)tforsomeu∈s rpo 2. s=f(s)withf ∈F,andt=g(t)withf > g,andA F 3. s=f(s)andt=g(t)withf = g ∈Mul,ands(≻) t F mul rpo 4. s=f(s)andt=g(t)withf = g ∈Lex,ands(≻) tandA F lex rpo whereA=∀v ∈t.s ≻ v and s (cid:23) tiffs ≻ tors=t rpo rpo rpo Wenowshowthewell-foundednessof≻ byusingTait’smethod.Computability rpo isdefinedhereasstrongnormalization,implyingcomputabilityproperty(i).Weprove thecomputabilityproperty: (vii)Letf ∈F andsbecomputableterms.Thenf(s)iscomputable. n Proof. Therestrictionof≻ totermssmallerthanorequaltothetermsinsw.r.t.≻ rpo rpo is a well-foundedorderingwhich we use for building an outer induction on the pairs (f,s)orderedby(> ,(≻ ) ) .Thisorderingiswell-founded,sinceitisbuilt F rpo statf lex fromwell-foundedorderingsbyusingmappingsthatpreservewell-foundedorderings. Wenowshowthatf(s)iscomputablebyprovingthattiscomputableforalltsuch thatf(s) ≻ t. Thispropertyis itself provedbyan (inner)inductionon |t|, and by rpo caseanalysisupontheproofthatf(s)≻ t. rpo 1. subtermcase:∃u ∈ ssuchthatu ≻ t.Byassumption,uiscomputable,hence rpo soisitsreductt. 2. precedencecase:t=g(t),f > g,and∀v ∈t,s≻ v.Byinnerinduction,vis F rpo computable,hencesoist.Byouterinduction,g(t)=tiscomputable. 3. multiset case: t = f(t) with f ∈ Mul, and s(≻ ) t. By definition of the rpo mul multisetextension,∀v ∈t, ∃u∈ssuchthatu(cid:23) v.Sincesisavectorofcom- rpo putabletermsbyassumption,soist.Weconcludebyouterinductionthatf(t)=t iscomputable. 4. lexicographiccase:t=f(t)withf ∈Lex,s(≻ ) t,and∀v ∈t, s≻ v.By rpo lex rpo innerinduction,tisstronglynormalizing,andbyouterinduction,soisf(t)=t. ⊓⊔ Thewell-foundednessof≻ followsfromcomputabilityproperty(vii). rpo 5 The General Schema and Computability Asintheprevioussection,weassumethatthesetoffunctionsymbolsisequippedwith aprecedencerelation≥ andastatusfunctionstat. F Definition2. ThecomputabilityclosureCC(t = f(t)),withf∈F,isthesetCC(t,∅), s.t. CC(t,V), withV ∩Var(t) = ∅,isthesmallestsetoftypabletermscontainingall variablesinV andtermsint,closedunder: 1. subterm of basic type: let s ∈ CC(t,V), and u be a subterm of s of basic type σ suchthatVar(u)⊆Var(t);thenu∈CC(t,V); 2. precedence:letf > g,ands∈CC(t,V);theng(s)∈CC(t,V); F 3. recursive call: let f(s) be a term such that terms in s belong to CC(t,V) and t(−→ ∪(cid:3)) s;theng(s)∈CC(t,V)foreveryg = f; β statf F 4. application:lets : σ1 → ... → σn → σ ∈ CC(t,V)andui : σi ∈ CC(t,V)for everyi∈[1..n];then@(s,u1,...,un)∈CC(t,V); 5. abstraction:lets∈CC(t,V∪{x})forsomex∈/ Var(t)∪V;thenλx.s∈CC(t,V); 6. reduction:letu∈CC(t,V),andu−→ v;thenv ∈CC(t,V). β∪(cid:3) WesaythatarewritesystemRsatisfiesthegeneralschemaiff r ∈CC(f(l))forallf(l)→r ∈R We now considercomputabilitywith respectto the rewrite relation−→ ∪−→ , R β and add the computability property(vii) whose proof can be easily adapted from the previousone.WecanthenaddanewcaseinTait’sMainLemma,fortermsheadedby analgebraicfunctionsymbol.Asaconsequence,therelation−→ ∪−→ isstrongly β R normalizing. Example1 (System T). We show the strong normalization of Go¨del’s system T by showingthatitsrulessatisfy thegeneralschema.Thisisclear forthefirstrulebythe baseCaseofthedefinition.Forthesecondrule,wehave:V ∈CC(rec(s(X),U,V))by baseCase;s(X)∈CC(rec(s(X),U,V))bybaseCaseagain,andX ∈CC(rec(s(X),U,V)) byCase2,assumingrec > s;U ∈ CC(rec(s(X),U,V))bybaseCase,henceallar- F gumentsoftherecursivecallareinCC(rec(s(X),U,V)).Sinces(X)(cid:3)X holds,we haverec(X,U,V)∈CC(rec(s(X),U,V)).Therefore,weconcludewith@(V,X,rec(X,U,V))∈CC(rec(s(X),U,V)) byCase4. 6 The Higher-Order Recursive PathOrdering 6.1 TheIngredients – A quasi-ordering on types ≥ called the type ordering satisfying the following TS properties: 1. Well-foundedness:> iswell-founded; TS 2. Arrowpreservation:τ →σ = αiffα=τ′ →σ′, τ′ = τ andσ = σ′; TS TS TS 3. Arrow decreasingness: τ → σ > α implies σ ≥ αorα = τ′ → TS TS σ′,τ′ = τ andσ > σ′; TS TS 4. Arrowmonotonicity:τ ≥ σ impliesα → τ ≥ α → σ andτ → α ≥ TS TS TS σ →α; Aconvenienttypeorderingisobtainedbyrestrictingthesubtermpropertyforthe arrowintheRPOdefinition. – Aquasi-ordering≥ onF,calledtheprecedence,suchthat> iswell-founded. F F – Astatusstat ∈{Mul,Lex}foreverysymbolf ∈F. f Thehigher-orderrecursivepathordering(HORPO)operatesontypingjudgments. Toeasethereading,wewillhoweverforgettheenvironmentandtypeunlessnecessary. Let A=∀v ∈t s ≻ voru ≻ vforsomeu∈s horpo horpo Definition3. GiventwojudgmentsΓ ⊢ s:σandΣ ⊢ t:τ, Σ Σ s ≻ tiffσ ≥ τ and TS horpo 1. s=f(s)withf ∈F,andu (cid:23) tforsomeu∈s horpo 2. s=f(s)withf ∈F,andt=g(t)withf > g,andA F 3. s=f(s)andt=g(t)withf = g ∈Mul,ands( ≻ ) t F mul horpo 4. s=f(s)andt=g(t)withf = g ∈Lex,ands( ≻ ) tandA F lex horpo 5. s=@(s1,s2),ands1 (cid:23) tors2 (cid:23) t horpo horpo 6. s=λx:α.uwithx6∈Var(t),andu (cid:23) t horpo 7. s=f(s)withf ∈F,t=@(t)isapartialleft-flatteningoft,andA 8. s=f(s)withf ∈F,t=λx:α.vwithx6∈Var(v)ands ≻ v horpo 9. s=@(s1,s2),t=@(t),and{s1,s2}( ≻ )mul t horpo 10. s=λx:α.u, t=λx:β.v,α= β,andu ≻ v TS horpo 11. s=@(λx:α.u,v)andu{x7→v} (cid:23) t horpo 12. s=λx:α.@(u,x), x6∈Var(u)andu (cid:23) t horpo Example2 (System T). The new proof of strong normalization of System T is even simpler.Forthefirstrule,weapplyCase1.Forthesecond,weapplyCase7,andshow recursively that rec(s(X),U,V)≻ V by Case 1, rec(s(X),U,V)≻ X by horpo horpo Case1appliedtwice,andrec(s(X),U,V)≻ rec(X,U,V)byCase3,assuminga horpo multisetstatusforrec,whichfollowsfromthecomparisons(X)≻ X byCase1. horpo The strong normalization proof of HORPO is in the same style as the previous strongnormalizationproofs,althoughtechnicallymorecomplex[21].Thisproofshows that HORPO and the general schema can be combined by replacing the membership u∈susedincase1bythemoregeneralmembershipu∈CC(f(s)).Itfollowsthatthe HORPOmechanismisinherentlymoreexpressivethantheclosuremechanism. BecauseofCases11and12,HORPO isnottransitive.Indeed,thereareexamples forwhichtheproofofs≻+ trequiresguessingamiddletermusuchthats≻ u horpo horpo andu≻ t.Guessingamiddletermwhennecessaryisautomatedintheimplemen- horpo tations of HORPO and HORPO with closure available fromthe web page of the first twoauthors. 7 Unifying HORPOandthe Computability Closure A major advantage of HORPO over the general schema is its recursive structure. In contrast,themembershiptothecomputabilityclosureisundecidableduetoitsCase3, butdoesnotinvolveanytypecomparison.Tocombinetheadvantagesofboth,wenow incorporatetheclosureconstructionintotheHORPOasanordering.Besides,wealso incorporatethepropertythatargumentsofatypeconstructorarecomputablewhenthe positivity condition is satisfied as it is the case for inductive types in the Calculus of InductiveConstructions[7,24]. s:σ ≻ t:τ iff X horpo s=f(s) ≻ t iff Var(t)⊆Var(s) and comp ∅ 1.t∈X 1.s=f(s)ands ≻ t comp 2.∃si ∈Acc(s): si(cid:23)Xcompt 2.s=f(s)andσ ≥TS τ and 3.t=g(t), f >TS gand (a)t=g(t), f > gandA F X (b) t=g(t), f = g, ∀v ∈t: s ≻ v F comp s(ho≻rpo)statftandA 4.t=g(t), f =TS g, (c) t=@(t1,t2)andA ∀v ∈t :s ≻X vand 3.s=@(s1,s2),σ ≥TS τ and comp (a)t=@(t1,t2)and Acc(s)(ho≻rpo)statfλX.t {s1,s2}( ≻ )mul{t1,t2} 5.t=@(u,v), horpo (b) s1 (cid:23) tors2 (cid:23) t s ≻X uands ≻X v horpo horpo comp comp (c) s1 =λx.uand 6.t=λx:α.uand u{x7→s2} (cid:23) t X·{x:α} horpo s ≻ u 4.s=λx:α.u,σ ≥ τ and comp TS (a)t=λx:β.v,α= β TS wheres ∈Acc(f(s)) andu ≻ v i horpo (siisaccessibleins) (b) x6∈Var(t)andu (cid:23) t iff horpo 1.sisthelefthandsideof (c) u=@(v,x),x6∈Var(v) anancestorgoals≻ u andv (cid:23) t horpo horpo 2.sisthelefthandsideofthe currentgoals≻ u, and, comp whereA=∀v ∈t: eitherf :σ →σand s ≻ vor∃u∈s: u ≻ v σoccursonlypositivelyinσ . i horpo horpo Example3. We considernowthetypeofBrouwer’sordinalsdefinedfromthetypeN bytheequationOrd=0⊎s(Ord)⊎lim(N→Ord).NotethatOrdoccurspositively

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.