• Aucun résultat trouvé

Strong normalization of lambda-bar-mu-mu-tilde-calculus with explicit substitutions

N/A
N/A
Protected

Academic year: 2021

Partager "Strong normalization of lambda-bar-mu-mu-tilde-calculus with explicit substitutions"

Copied!
16
0
0

Texte intégral

(1)

HAL Id: hal-00004321

https://hal.archives-ouvertes.fr/hal-00004321

Submitted on 22 Feb 2005

HAL is a multi-disciplinary open access

archive for the deposit and dissemination of

sci-entific research documents, whether they are

pub-lished or not. The documents may come from

teaching and research institutions in France or

abroad, or from public or private research centers.

L’archive ouverte pluridisciplinaire HAL, est

destinée au dépôt et à la diffusion de documents

scientifiques de niveau recherche, publiés ou non,

émanant des établissements d’enseignement et de

recherche français ou étrangers, des laboratoires

publics ou privés.

Strong normalization of

lambda-bar-mu-mu-tilde-calculus with explicit

substitutions

Emmanuel Polonovski

To cite this version:

Emmanuel Polonovski. Strong normalization of lambda-bar-mu-mu-tilde-calculus with explicit

sub-stitutions. FOSSACS, 2004, Barcelona, Spain. pp.423-437. �hal-00004321�

(2)

with Expli it Substitutions

EmmanuelPolonovski

PPS,CNRS-UniversiteParis7 Emmanuel.Polonovskipps.jussieu.fr

Abstra t. The~ - al ulus, de ned by Curienand Herbelin [7℄, isa variantofthe- al ulusthatexhibitssymmetriessu hasterm/ ontext and all-by-name/ all-by-value. Sin e it is a symmetri , and hen e a non-deterministi al ulus,usualproofte hniquesofnormalizationneeds someadjustmentstobemadetoworkinthissetting.Hereweprovethe strong normalization (SN) of simply typed- al ulus~ with expli it substitutions.Forthatpurpose,we rstproveSNofsimplytyped-~ al ulus(byavariant oftheredu ibilityte hniquefromBarbaneraand Berardi[2℄),thenweformalizeaproofte hniqueofSNviaPSN (preser-vationofstrongnormalization),andweprovePSNbythe perpetuality te hnique,asformalizedbyBonelli[5℄.

1 Introdu tion

1.1 ~- al ulus and Expli itSubstitutions

The ~- al ulus, de ned by Curien and Herbelin [7℄, is asymmetri variant ofParigot's- al ulus[11℄ thatprovidesatermnotationfor lassi alsequent al ulus. Itexhibits symmetriessu h asterms/ ontextsand all-by-name/ all-by-value. Its two main redu tion rules form a symmetri riti al pair, whi h makes the al ulus non-deterministi (non- on uent) and raises diÆ ulties in normalizationproofs:anaivede nitionofredu ibility andidateswouldfallin asymmetri loopofmutualindu tion.

On the other hand, al uli with expli it substitutions were introdu ed [1℄ as a bridge between - al ulus [6℄ and on rete implementations of fun tion-nal programminglanguages.Those al uliintend to re ne the evaluation pro- ess byproposingredu tion rulesto dealwith thesubstitution me hanism{a meta-operationin the traditionnal - al ulus.In thestudy ofthose al uli,an importanttaskwastoestablishgoodpropertiessu has:

 Simulation of redu tion,whi h says that aterm that an be redu ed to anotherin thetraditionnal - al ulus analso beredu ed tothe sameone inthe al uluswithexpli itsubstitutions.

(3)

-stronglynormalizing(i.e. annotbein nitelyredu ed),itisalsostrongly normalizingwithrespe ttothe al uluswithexpli itsubstitutions.

 Strong normalization (SN), whi h says that, with respe t to a typing sys-tem,everytyped termis stronglynormalizingin the al uluswith expli it substitutions.

Itwasremarked,at on e, that expli itsubstitutions raisesmorediÆ ulties in normalization proofs, due to the fa t that redu tions an now take pla e in an argument substituted in a term to a variable whi h is not free in that term. Su h redu tions produ e no tra e in the original al ulus, be ause the substitution is bounded to disappear. Therefore we annot easily inferSN for expli itsubstitutionsfromstrongnormalizationoftheoriginal al ulus.

1.2 The ~- al ulus with Expli itSubstitutions:x~

Here we work on  ~x, an expli it substitutions version \a la" x [4℄ of the ~ - al ulus. Its syntax was introdu ed in [9℄ and, in the same paper, there wasanattempttoprovestrongnormalizationofthedeterministi all-by-name fragmentdire tlybytheredu ibilityte hnique.Unfortunately,thete hniquedid notworksoni ely,andtheproofofakeylemma(Weakeninglemma)turnedout tobebugged...Wekeepthiste hniqueforthepure al ulus(i.e.withoutexpli it substitutions),and,inordertoliftittothesymmetri al ulus,weadjustitlike Barbanera andBerardididfor theirsymmetri - al ulus [2℄.Wewill see that redu ibilitysets onstru tedby xedpointensurethat theirde nition willnot fall inthesymmetri in niteloopoftermsde ned by ontextsandvi e versa.

ToproveSN,weformalizeate hniqueinitiallysuggestedbyHerbelin,whi h onsists inexpanding substitutionsinto pure~-redexesand toinherit SN of thewhole al ulusbySNofthepure al ulusandbyPSN.

Finally, to provePSN, we usethe perpetualityte hnique, asformalizedby Bonelli[5℄. Themain point ofthis te hniqueis to exhibita strategywi h pre-servesin niteredu tions.Thistogetherwithsomematerialto tra ethe substi-tutionsba kwards,allowsusto establishPSNby ontradi tion.

Inthesequel,wewillnoteSN R

forthesetofstronglynormalizingtermsin the al ulusR .WewilluseFV(t)todenotethesetoffreevariablesoft,de ned in theusualway.

1.3 Organization

We rst present the (simply typed) ~- al ulus and we prove SN bythe re-du ibilityte hnique(se tion2).Inse tion3,weusetheperpetualityte hnique to establishPSN.Se tion4formalizestheproofte hniqueofSN via PSN,and givesthematerial to useitfor  ~x. Finally,we givetheproofof SN of~x

(4)

We rstre allthede nitionofthe ~- al ulus,thenwede neredu ibilitysets and nallyweestablishstrongnormalizationofthepure al ulus.

2.1 De nition

Therearethreesynta ti ategories:terms, ontextsand ommands,respe tively noted v, e and . We take twovariable sets: Var is the set of term variables, notedx,y,z et .;Var

?

isthesetof ontextvariables,noted , ,et .Wewill notet anobje t,i.e.oneofv,eor .Thesyntaxofthe~- al ulusis:

::=hvjei

v::=x jx:v jevj  : e::= j :ejvejx: e

Redu tionrulesaregivenbelow.Therules()and(e )form a riti alpair:

( ) hx:vjv 0 ei!hv 0 jex:hvjeii ( e ) he 0 vj :ei!h :hvjeije 0 i () h : jei! [e= ℄ (e ) hvje x: i! [v=x℄ (sv)  :hvj i!v if 62FV(v) (se) x:hxjeie !e ifx62FV(e)

Typesareusual simpletypesplus theminus typeA B whi his the sym-metri ounterpartof thearrow typeA!B, itsmeaningis Aand notB.We workherein lassi alsequent al ulus,withanotationtoexhibitaformulaina sequent: `Ajisthesamesequentas `A;buttheformulaAisexhibited asa tiveformula.Forfurtherdetailsaboutthisframeworkandtheisomorphism withobje tsofthe~- al ulus,see [7℄.

Threesequentformsareusedtotypethesynta ti ategories:the ommands are typed by ( ` ), the termsby ` Ajand the ontexts by jA ` . Herearethetypingrules:

:( ;x:A`) jex: :A` `v:Aj je:A` hvjei:( `) :( ` :A;) ` : :Aj j :A`; :A ;x:A`jx:A je:B` :A; j :e:A B` ;x:A`v:Bj `x:v:A!Bj `v:Aj je:B` `v:Bj je:A`

(5)

Wesimultaneouslyde ne, byindu tion ofthetypestru ture: { theoperators: Lambda (X 1 ;X 2 )= Def fx:v j 8v 0 2X 1 ;e2X 2 hv[v 0 =x℄jei2[[`℄℄ g Cons (X 1 ;X 2 ) = Def fve j v2X 1 ande2X 2 g ^ Lambda (X 1 ;X 2 )= Def f :e j 8e 0 2X 1 ;v2X 2 hvje[e 0 = ℄i2[[`℄℄g ℄ Cons (X 1 ;X 2 ) = Def fev j e2X 1 andv2X 2 g Mu(X) = Def f : j 8e2X [e= ℄2[[`℄℄ g f Mu(X) = Def fex: j 8v2X [v=x℄2[[`℄℄g Remark1. Muand f

Muarede reasingoperators:thegreaterX is,thelesser one an nd : 's (resp.x: 's)e that normalizeagainstalleinX.

Then  ifAisatomi Neg [[`A℄℄ (Y)=Var[Mu(Y) Neg [[A`℄℄ (X)=Var ? [ f Mu(X)  ifA=A 1 !A 2 Neg [[`A℄℄ (Y)=Var[Mu(Y)[Lambda ([[`A 1 ℄℄ ;[[A 2 `℄℄) Neg [[A`℄℄ (X)=Var ? [ f Mu(X)[Cons([[`A 1 ℄℄;[[A 2 `℄℄)  ifA=A 1 A 2 Neg [[`A℄℄ (Y)=Var[Mu(Y)[ ℄ Cons([[A 1 `℄℄;[[`A 2 ℄℄) Neg [[A`℄℄ (X)=Var ? [ f Mu(X)[ ^ Lambda ([[A 1 `℄℄;[[`A 2 ℄℄) Sin eMuand f

Muarede reasingoperators,Negisalsoade reasingoperator. SoNeg

[[`A℄℄ ÆNeg

[[A`℄℄

is anin reasing operator,and byTarski'stheorem it hasa xedpointX

0 ; { theredu ibilitysets:

[[`℄℄=SN ~ and [[`A℄℄=X 0 and [[A`℄℄=Neg (X 0 ):

(6)

(i) Var[[`A℄℄ (ii) Var

?

[[A`℄℄

(iii)v2[[`A℄℄ () eitherv=x orv=ev 0 with A=A 1 A 2 ; e2[[A 1 `℄℄ andv 0 2[[`A 2 ℄℄ orv= : and 8e2[[A`℄℄ [e= ℄2[[`℄℄ orv=x:v 0 withA=A 1 !A 2 and 8v 00 2[[`A 1 ℄℄ ;e2[[A 2 `℄℄ hv 0 [v 00 =x℄jei2[[`℄℄ (iv) e2[[A`℄℄ () eithere= ore=ve 0 with A=A 1 !A 2 ; v2[[`A 1 ℄℄ ande 0 2[[A 2 `℄℄ ore=x: e and 8v2[[`A℄℄ [v=x℄2[[`℄℄ ore= :e 0 with A=A 1 A 2 and 8e 00 2[[A 1 `℄℄;v2[[`A 2 ℄℄ hvje 0 [e 00 = ℄i2[[`℄℄

Proof. From the de nition of the redu ibility sets, we have[[`℄℄ =SN  ~

and thepoints(i)and(ii).Weprovethepoints(iii)and(iv).Duetothesymmetry, itsuÆ estoprove(iii).

v2[[`A℄℄ () v2Neg [[`A℄℄

ÆNeg [[A`℄℄

([[`A℄℄ ):

We then onsider the di erent shapes of A and we inline the orresponding de nition ofNeg [[`A℄℄ ÆNeg [[A`℄℄ ([[`A℄℄). 2.3 Strong Normalization

Herearethetwotraditionnallemmasofstrongnormalizationoftheredu ibility sets(RS)and losurebyredu tion.

Lemma1 (SN of RS). Let A be a type. Then [[`A℄℄ SN ~ (1), [[A`℄℄ SN ~ (2)and[[`℄℄SN ~ (3).

Proof. Byindu tion onthestru tureofA.

1. We onsider thedi erentformsofv2[[`A℄℄: { v=x:thenv2SN ~ . { v = ev 0 : then A =A 1 A 2

and we on lude by using the indu tion hypothesis twi e.

{ v= : :bythepoint(ii)ofproposition1, 2[[A`℄℄,then,bythepoint (iii)ofproposition1, [ = ℄2[[`℄℄,that givesus 2[[`℄℄(=SN

~ ).We thenhave : 2SN .

(7)

{ v=x:v,thenA=A 1 !A 2 :togetv2SN ~ ,weneedv 2SN ~ . Byredu ibilityofx:v 0 ,wehave8v 00 2[[`A 1 ℄℄;e2[[A 2 `℄℄ hv 0 [v 00 =x℄jei2 [[`℄℄ (=SN  ~

).Bythepoints(i)and(ii) ofproposition1,we antake xforv

00

and fore,andthatgivesushv 0 [x=x℄j i2SN  ~ .Wededu e v 0 2SN  ~ and on lude.

2. Theproofforeissimilarto theproofforv bysymmetry. 3. Byde nition[[`℄℄=SN

 ~ .

Lemma2 (Closure byredu tion). 1. v2[[`A℄℄ ; v!v 0 =) v 0 2[[`A℄℄ . 2. e2[[A`℄℄; e!e 0 =) e 0 2[[A`℄℄. 3. 2[[`℄℄; ! 0 =) 0 2[[`℄℄ .

Proof. Byindu tion onA, onsideringthedi erentshapesofv, e,and . 1.1. v=x:thennomoreredu tion ano ur.

1.2. v = e 1

v 1

: we must onsider two possible redu tions e 1 v 1 ! e 2 v 1 or e 1 v 1 !e 1 v 2

.Ineither ase,we on ludebyindu tionhypothesis. 1.3. v= : : we onsiderthefollowingtwo ases.

 The redu tionis  : ! : 0

. Byde nition of  : 2 [[`A℄℄ wehave 8e2[[A`℄℄ [e= ℄2SN ~ .Then weget 0 [e= ℄2SN  ~ (alwaysfor anye2[[A`℄℄)andwe on ludewiththepoint(iii)ofproposition1.  The redu tionis  :hvj i ! v with 62 FV(v). Weknowby

hypoth-esis that  :hvj i 2 [[`A℄℄ , then, by the point (iii) of proposition 1, 8e 2 [[A`℄℄ hvj i[e= ℄ 2 SN

~

, i.e. hvjei 2 SN ~

. If v is a vari-able, then we on lude immediately. if v =  : , h : jei 2 SN

~ implies that [e= ℄ 2 SN

 ~

, whi h gives us  : 2 [[`A℄℄ by the point (iii) of proposition 1. If v = x:v

0 , hx:v 0 jei 2 SN ~ gives us, for e = v 1 e 1 , hv 1 jex:hv 0 je 1 ii 2 SN  ~ then hv 0 je 1 i[v 1 =x℄ 2 SN ~ and hv 0 [v 1 =x℄je 1 [v 1 =x℄i 2 SN  ~

and nally, sin e x is not free in e 1 , hv 0 [v 1 =x℄je 1 i2 SN  ~

, whi h is enough,by thepoints (iv)and (iii) of proposition 1,to on lude. 1.4. v=x:v 0 :A=A 1 !A 2

and theredu tionisx:v 0

!x:v 00

. Bythepoint (iii)ofproposition1,weknowthat8v

000 2[[`A 1 ℄℄;e2[[A 2 `℄℄ hv 0 [v 000 =x℄jei2 [[`℄℄ =SN ~ ,so8v 000 2[[`A 1 ℄℄;e2[[A 2 `℄℄ hv 00 [v 000 =x℄jei2 [[`℄℄ =SN ~ , andwearedone.

2.x. Sameas1.x.bysymmetry(wherexrangesfrom1to 4). 3. 2[[`℄℄:then 2SN ~ and ! 0 impliesthat 0 2SN  ~ =[[`℄℄. Herearenowsomelemmas to\indu tivelybuild"themembershipofaRS. Lemma3.

v2[[`A℄℄; e2[[A`℄℄ =) hvjei2[[`℄℄:

Proof. Toshowthat hvjei2[[`℄℄is, byde nition,to showthat hvjei2SN ~

. Wetakeallpossiblepairsforv andeandwereasonbyindu tiononthestrong normalisationofvande(whi hwegetbylemma1)andonthelengthofv and e. We onsider allthe possible redu tionsof hvjei.If theredu tiono urs in v

(8)

of : 2[[`A℄℄,

 ife=ex: ,we on ludesymmetri allytothelastpoint,  ifv=x:v 0 ande=v 00 e 0 (withA=A 1 !A 2 ),theredu tionishx:vjv 00  e 0 i!hv 00 jex:hv 0 je 0

ii.We onsiderthepossibleredu tionsofhv 00 jex:hv 0 je 0 ii. Byredu ibilityofvande,wehavev

00 2SN ~ andhv 0 [v 00 =x℄je 0 i2SN ~ . Consequently,sin etheredu tions annoto urin nitelyinthoseterms,we willgettoredu eoneofthefollowing(wherev

00 !  v 1 ,hv 0 je 0 i!  hv 2 je 2 i): { hv 1 jex:hxje 2 ii ! hv 1 je 2

i : by indu tion hypothesis, we have hv 00 je 0 i 2 SN  ~ andhv 1 je 2

iisoneofitsredu ts. { hv 1 jex:hv 2 je 2 ii ! hv 2 [v 1 =x℄je 2 [v 1

=x℄i : this term is also a redu t of hv 0 [v 00 =x℄je 0 [v 00 =x℄i whi h is in SN ~

by redu ibility of v, due to the fa tthat sin ex isnotfreein e

0 ,hen ein e 2 ,e 2 [v 1 =x℄=e 2 . { h : 1 jex:hv 2 je 2 ii! 1 [ex:hv 2 je 2 i= ℄ with v 1 = : 1 . Byredu ibility of e and by the lemma 2 we have  :

1

2 [[`A 1

℄℄, that gives us, by de nition,that 1 [ex:hv 2 je 2 i= ℄ belongs to [[`℄℄ ifx:hve 2 je 2 i belongs to [[A 1

`℄℄. Andthis last onditionis satis ed,byde nition, ifand onlyif 8v 3 2[[`A 1 ℄℄ wehavehv 2 [v 3 =x℄je 2 [v 3

=x℄i2[[`℄℄, whi his a onsequen e of the redu ibility of v (with e

2 [v

3

=x℄ = e 2

, by the sameargument as above).  Ife= :e 0 andv=e 00 v 0

,we on ludesymmetri allytothelastpoint.  Inallother ases,noredu tion ano ur.

Lemma4. If v[v 0 =x℄ 2 [[`B℄℄ for all v 0 2 [[`A℄℄ then x:v 2 [[`A!B℄℄ . If e[e 0 = ℄2[[B`℄℄for all e 0 22[[A`℄℄then :e2[[`A B℄℄ .

Proof. Bysymmetry,weneedonlyto proveoneof theimpli ations,letus take the rst one. To prove that x:v 2 [[`A!B℄℄ , we need, by the point (iii) of proposition1,to provethat for allv

0 2[[`A℄℄ ;e2[[B`℄℄, hv[v 0 =x℄jei2[[`℄℄.By hypothesis,wehavev[v 0

=x℄2[[`B℄℄ . We on ludewiththelemma3.

Hereistheadequa ylemma.

Lemma5 (Adequa y). Let A be a type and t an obje t su h that FV(t)  X 1 [X 2 (X 1 VarandX 2 Var ?

)and thevariables x i

2X 1

are oftype B i and the variables

j 2X

2

are of typeC j

. For all set of obje tsv i ;e j su h that 8i v i 2[[`A i ℄℄ and8j e j 2[[B j

`℄℄ wehave, a ordingly tothe shapeof t,

1. ifX 1 :B`v:AjX 2 :C then v[v 1 =x 1 ;:::;v n =x n ;e 1 = 1 ;:::;e m = m ℄2[[`A℄℄ 2. ifX 1 :Bje:A`X 2 :C then e[v 1 =x 1 ;:::;v n =x n ;e 1 = 1 ;:::;e m = m ℄2[[A`℄℄ 3. if :(X 1 :B `X 2 :C)then [v 1 =x 1 ;:::;v n =x n ;e 1 = 1 ;:::;e m = m ℄2[[`℄℄ Remark 2. We note X 1 : B theenumerationfx i : B i

ji 2 [1;n℄g(the samefor X

2 :C).

Proof. Wenote[==℄thesubstitution[v 1 =x 1 ;:::;v n =x n ;e 1 = 1 ;:::;e m = m ℄.We

(9)

rea-i i i { v =ev

0

: by indu tion hypothesis on e and v 0

, and by the point (iii) of proposition1,we on ludeimmediately.

{ v=x:v 0 :wethenhaveA=A 0 !A 00

.Sin ewe anrenameboundvariables, we ansupposethatx62fx

1 ;:::;x n g,whi hgivesus(x:v 0 )[==℄=x:(v 0 [==℄). Byindu tion hypothesis, for all v

00 2[[`A 0 ℄℄ wehavev 0 [v 00 =x;==℄ 2[[`A 00 ℄℄ andbythelemma4,wearedone.

{ v =  : : sin e we an rename bound variables, we an suppose that 62 f

1 ;:::;

m

g. Now, by the point (iii) of proposition 1, to prove that ( : )[==℄= :( [==℄)2[[`A℄℄weneedonlytoprovethat,foralle2[[A`℄℄, [e= ;==℄2[[`℄℄whi h isdonebyindu tion hypothesis.

{ e:the asesforearesimilartothoseforv bysymmetry.

{ = hvjei. By indu tion hypothesis on v and e, and by the lemma 3, we on ludeimmediately.

We an nowestablishthemaintheorem ofthisse tion.

Theorem1. Every typed ~obje tisstronglynormalizing.

Proof. Let t be an obje t of the  ~- al ul typed by and ,i.e. su h that the on lusion of itstyping judgement is either ` t : Aj, or jt : A ` , or t : ( `). Suppose that its freevariables are f

1 ;:::; m ;x 1 ;:::;x n g,ea h one typed x i : A i and i : B i

. By the points (i) and (ii) of proposition 1, we get that for all i, x

i 2 [[`A i ℄℄ and i 2 [[B i

`℄℄. Then, by the lemma 5, t[x 1 =x 1 ;:::;x n =x n ; 1 = 1 ;:::; m = m

℄=tisinaredu ibilityset.Bythelemma1, wegett2SN

~ .

3 PSN of ~- al ulus with Expli it Substitutions

We rstde nethe ~- al uluswithexpli itsubstitutions.Thenweshowsome usefulresultsonthesubstitution al ulus.And nally,weestablishtheproperty ofpreservationofstrongnormalization.

3.1 De nition

Tothethreesynta ti ategoriespresentedin thelast se tion,weaddafourth, regardingexpli itsubstitutions, noted. Inthesequel,willstandforeithera termora ontextvariable.Thesyntaxofthe ~x- al ulusis:

::= hvjeij 

v ::= x jx:v jevj  : jv e ::= j :ej vejx: e je  ::=[x v℄j[ e℄

Thesour eDom() of isx if =[x v℄and if =[ e℄.Thebody S()of isvinthe rst aseandeinthese ond.Wewillsaythatasubstitution belongstoSN ifitssubstituenditselfbelongstoSN .

(10)

( 0

` 0

).Herearethetypingrulesforexpli itsubstitutions:

`v:Aj [x v℄:( ;x:A`))( `) je:A` [ e℄:( `; :A))( `) je:A`  :( `))( 0 ` 0 ) 0 je:A` 0 `v:Aj  :( `))( 0 ` 0 ) 0 `v :Aj 0 :( `)  :( `))( 0 ` 0 )  :( 0 ` 0 ) Theredu tionrulesarethefollowing:

( ) hx:vjv 0 ei!hv 0 jex:hvjeii ( e ) he 0 vj :ei!h :hvjeije 0 i (mu) h : jei! [ e℄ (gmu) hvjex: i! [x v℄

(sv)  :hvj i!v if 62FV(v) (se) x:hxjeie !e ifx62FV(e)

( ) hvjei !hvjei (x1) x !S() ifx2Dom() (x2) x !x ifx62Dom() ( 1)  !S() if 2Dom() ( 2)  ! if 62Dom() () (ve) !(v)(e) (e) (ev) !(e)(v) () (x:v) !x:(v) ( e  ) ( :e) ! :(e) () ( : ) ! :( ) (e) (ex: ) !x:( e )

Wereasonmodulo - onversionontheboundvariableintherules(),(e), ()and(

e  ).

3.2 Substitution Cal ulus

Wewillnote:

 x the set of rules on erning the propagation of substitutions, namely , x1,x2, 1, 2,,e,,

e

 , ande,

 :xthesetofrulesnotinx,namelythose on erningredu tionsoftheoriginal al ulus: ,

e

(11)

normalforms arepure obje ts(i.e. withoutsubstitutions). Proof. Wede nethefollowingmeasureh:

h() =1 h(hvjei)=h(v)+h(e)+1 h(ve) =h(v)+h(e)+1 h(ev) =h(v)+h(e)+1 h(x:v) =h(v)+1 h( :e) =h(e)+1 h( : ) =h( )+1 h(ex: ) =h( )+1 h(t[ t 0 ℄)=h(t)(h(t 0 )+1)

Weeasily he kthatea hx-redu tionstri tlyde reasesh.Weproveby ontra-di tionthatthenormalformsarepureobje ts:ifthereisasubstitution,welook to theobje tto whi hitisapplied andwe ndaredu tiontoperform.

Wewillnote x(t)thex-normalformofanobje tt. Lemma7 (Con uen e of x). xis on uent.

Proof. All riti alpairs have disjoint redexes, whi h gives us lo al on uen e. ByNewmanlemma andlemma6weget on uen e.

Lemma8 (Substitution). x(t[ t 0

℄)=x(t)f x(t 0

)g. Proof. Weprove,byindu tionontheheightoftand ofthet

i ,that x(t[ 1 t 1 ℄:::[ n t n ℄)=x(t)f 1 x(t 1 )g:::f n x(t n )g:

Lemma9 (Simulation of the ~- al ulus). For all t and upure obje ts, if t! ~ uthent!  ~ x u.

Proof. Byindu tion onthestru ture of t.Theonlyinteresting asesare those in whi htheredu tiono ursattheroot.

{ h : jei!  f eg:wehave h : jei! mu [ e℄! x x( [ e℄) lemma8 = x( )f x(e)g:

Sin eh : jeiis apureobje t,x( )= ,x(e)=eandwearedone. { hvje x: i!



f vg:this aseissimilar tothepreviousbysymmetry. { Theotherrulesaresimulatedinonestepbytheirhomonymesin ~x.

We say that a redu tion is void if it o urs in the body of a substitution t[ t

0

℄su hthat62x(t).Wenoteit v !. Lemma10 (Proje tion). 1. Ift!  ~ x uthenx(t)!  ~ x(u). 2. Ift! :x

uisnot avoid redu tion,thenx(t)! + ~

x(u).

Proof. We onsiderthree ases: { theredu tionist! x u.Thenx(t)=x(u). { theredu tionist v ! :x u.Thenx(t)=x(u). { theredu tionist! :x

(12)

We use the perpetuality te hnique, formalised by Bonelli [5℄. In fa t, we use only the rst part of the te hnique, whi h is enough to prove preservation of strongnormalisation.Wegivesomelemmastoextra t avoidsubstitutionwith anin nitederivationinside,andto tra ethissubstitutionba kwards.

Lemma11. Let t 0 ! ~ x t 1 !  ~x t 2 ! ~ x ::: be an in nite redu tion. If x(t 0 )2SN ~

, thenthere exists an integer k su h that for all i >k,we have t i v ! ~ t i+1 .

Proof. Sin e x is strongly normalizing, the redu tionmust be t 0 !  x t 1 ! :x t 2 !  x t 3 ! :x t 4 ::: Bylemma 10,wehavex(t 0 )!   ~ x(t 1 )!  ~ x(t 2 ) !  ~ x(t 3 )!   ~ x(t 4

)::: Furthermore,for all even i, if t i+1 ! :x t i+2 isnot a void redu tion,then x(t i )! + ~ x(t i+2 ).From x(t 0 )2SN  ~

wededu ethat there existsksu hthatforallevenigreaterthankwehavet

i+1 v ! :x t i+2 .Wemust now provethat from a ertain point, both :x and x redu tions are void. For that,wede nethefollowingmeasure:

h() =1 h(hvjei)=h(v)+h(e)+1 h( : ) =h( )+1 h(x: )e =h( )+1 h(t[ t 0 ℄)=  h(t)(h(t 0 )+1)if2FV(x(t)) h(t)2 else

Thelast lauseguaranteesthatavoidredu tionleavesthemeasureun hanged. Weeasily satis es that allother redu tions stri tlyde raese this measure,and we on lude.

Thenextnotionisusefultoisolateavoidsubstitution.

De nition1 (Skeleton). The skeleton of an obje t, noted SK(t), is indu -tively de nedasfollows:

SK() = SK(hvjei)=hSK(v)jSK(e)i SK( : ) = :SK( ) SK(ex: ) =x:SK( )e SK(t[ u℄)=SK(t)[ ℄ Weremark thatif t v !u, thenSK(t)=SK(u).

Thefollowinglemma says that ifthere isan in nite derivation, then there existsasubstitutioninwhi hthereis anin nitederivation.

Lemma12. Let an in nite derivation be t 0 ! ~ x t 1 !  ~x t 2 ! ~ x ::: If x(t 0 )2SN ~

,thenthereexistsanintegerk,anobje tt,avariable,a ontext C andan obje tsequen eu

i su hthat t 0 !   x~ t k = C[t[ u k ℄℄ v !   x~ C[t[ u k +1 ℄℄ v !   x~ C[t[ u k +2 ℄℄::: with u k ! u k +1 ! u k +2 ! u k +3 :::

(13)

Proof. Bylemma11,thereexistsksu hthatforalli>k,t i ! ~ x t i+1 .Then, wehaveSK(t k )=SK(t i

)forallik. Thederivationtreeoft k

beingin nite, bythepigeon holeprin iple,anin nitederivation musttakepla e inthesame substitutionofSK(t

k

),andwearedone.

Lemma13 (Substitutiontra ing-1step). Lettandubetwoobje tssu h that t! ~ x uandu=C[u 1 [ u 2 ℄℄.Then 1. eithert=C 0 [u 0 1 [ u 2 ℄℄, 2. ort=C 0 [u 0 1 [ u 0 2 ℄℄with u 2 !u 0 2 , 3. oru 1 is a ommandand if= then t=C[h :u 1 ju 2

i℄elset=C[hu 2

je x:u 1

i℄.

Proof. Wereasonbyindu tionont andwe onsiderthefollowingtwo ases:

 Theredu tiontakespla eattheroot.Firstnotethatifu 1

[ u 2

℄appears inasub-termofu,whi hisalso asub-term oft,then fora ontextC

0 and u 0 1 =u 1

the rstitemholds.Thisappliesalsowhentheruleusedtoredu e attheroot isoneofx or .Elseiftherule ismuorgmu, thenthethird itemholds, elseifitisanotherrule,thenthe rstitemholds,inboth ases, weusetheempty ontext.

 Theredu tionisinternal.

{ t=.Theresultholdstrivially. { t = hvjei with either v !

~ x v 0 ore ! ~ x e 0 . We onsider the rst ase,sin ethese ondoneissimilar.Wehaveu=hv

0 jeiand: ? if thesub-term u 1 [ u 2 ℄ o urs in v 0

, then weuse indu tion hy-pothesis.

? else thesub-term u 1

[ u 2

℄o ursin e;thenthe rstitemholds. { t=veort=ev witheither v !  x~ v 0 ore! ~ x e 0 .We on lude similarlytothepreviouspoint.

{ t= : orx: e orx:v or :e.Weuseindu tionhypothesis. { t=t

1 [ t

2

℄. Therearetwo ases: ? t 1 !  ~ x t 0 1 and u = t 0 1 [ t 2 ℄. Then if u 1 [ u 2 ℄ o urs in t 0 1 we use indu tion hypothesis. If it o urs in t

2

the rst item holds trivially.Finally,ifu=u

1 [ u

2

℄then wetaketheempty ontext forC 0 ,u 0 1 =t 1

andthe rstitemholds. ? t 2 !  ~x t 0 2 and u=t 1 [ t 0 2 ℄. Thenifu 1 [ u 2 ℄o ursin t 1 the rstitemholdstrivially.Ifito ursint

0 2

weuseindu tionhypothesis. Finally, if u=u

1 [ u

2

℄ then wetake theempty ontext for C 0 , u 0 1 =t 1 andu 0 2 =t 2

andthese onditemholds.

Thisresultisnaturallyextendedto many-stepsredu tions.

Lemma14 (Substitutiontra ing). Let t 1

;:::;t n

beobje ts su hthat,for all i,t i !  ~ x t i+1 andt n =C[u 1 [ u 2 ℄℄. Then

1. either= andthere isisu hthat t i =C 0 [h :u 0 1 ju 0 2 i℄ withu 2 !  ~ x u 0 2 , 2. or=x andthereisi su hthatt

i =C 0 [hu 0 2 jex:u 0 1 i℄with u 2 !  u 0 2 ,

(14)

3. ort 1 =C[u 1 [ u 2 ℄℄ withu 2 !  ~x u 2 .

Proof. Byindu tion onthenumberofredu tionsteps,usinglemma13. Weformalisethenotionofderivationordering.

De nition2. Let  and be two in nite derivations starting form an obje t t

1

.Then is alled smallerthan if theyredu ethe same redexes for the rst n 1steps, andthe nthredex redu edby isastri tsubterm ofthe nth redex redu edby .

Hereisthemaintheoremofthisse tion. Theorem2 (PSN). t2SN

~

)t2SN  ~x

.

Proof. By ontradi tion.Supposethat there existsapure termtwhi h anbe in nitely redu ed in the ~x- al ulus. We take a minimal derivation of this term. Bylemma 12, at a ertain point,we an exhibit a in nitederivation in a void substitution. By lemma 14, we an go ba kwards until we rea h the redu tionwhi h reatesthissubstitutionwhilekeepingthein niteredu tionin it. This reationpoint ( hosenby theminimalderivation) isaproperpre x of theredu tionpointofthein nitederivation insidethe futurebodyofthe void substitution.This ontradi tstheminimalityofthederivation.

4 PSN Implies SN

4.1 Proof Te hnique

Thete hniquewepresenthereisverygeneraland anbeappliedtomany al uli withexpli itsubstitutions. Theideaof thiste hniqueis thefollowing:lett be atypedtermwithexpli itsubstitutions,with itstypingjudgement,webuilda typedtermt

0

ofthepure al ulusbyexpandingthesubstitutionsoftinredexes. We allthisexpansionAteb.Werequirethefollowingtwoproperties,whi hare enoughtoestablishtheorem3.

Property 1 (Preservation of typability). Ift is typable in the al uluswith ex-pli itsubstitution, thenAteb(t)istypablein thepure al ulus.

Property 2 (Initialization).Ateb(t)redu estotin0ormorestepsinthe al ulus withexpli itsubstitutions.

We annowestablishthetheorem.

Theorem3. Foralltypingsystemsu hthatalltypabletermsarestrongly nor-malizing,if thereexistsafun tionAteb fromexpli it substitutiontermstopure termssatisfying properties1and2thenPSNimpliesSN.

Proof. For all typed term t of the al ulus with expli it substitution, Ateb(t) isapuretyped term(byproperty1).Byhypothesis ofstrongnormalizationof the pure typed al ulus, we haveAteb(t) 2SN (in the present ase SN

 ~ ). By hypothesis of PSN we obtain that Ateb(t) is in SN (in the present ase SN

~ x

).Byproperty2,we getAteb(t) ! 

t, whi h givesus dire tly t2SN (inthepresent aseSN ).

(15)

Here is the de nition of Ateb. It is obvious that for all t, Ateb(t) ontains no substitutions. We then he k that this fun tion satis es the twoproperties we mentionabove.

De nition3.

Ateb(x) =x Ateb( ) =

Ateb(x:v) =x:Ateb(v) Ateb( :e)= :Ateb(e) Ateb( : ) = :Ateb( ) Ateb(ex: )=x:Ateb( )e Ateb(ev) =Ateb(e)Ateb(v) Ateb(ve) =Ateb(v)Ateb(e) Ateb(hvjei) =hAteb(v)jAteb(e)i

Ateb( [x v℄) =hAteb(v)jex:Ateb( )i Ateb( [ e℄) =h :Ateb( )jAteb(e)i Ateb(v[x v

0

℄)= :hx:Ateb(v)jAteb(v 0

) i With freshvariable Ateb(v[ e℄) = :h :hAteb(v)j ijAteb(e)i With freshvariable Ateb(e[x v℄) =y:hAteb(v)jee  x:hyjAteb(e)ii With y freshvariable Ateb(e[ e

0

℄)=x:hAteb(ee 0

)xj :Ateb(e)i Withx freshvariable

Proof. (ofproperty1) Easybyindu tionontheproofofthetyping judgement oft.

Proof. (ofproperty2)Wepro eedbyindu tionont.Onlythe asesfor substi-tutionsarenoteasy.Bythesymmetryofthesystem,we onsideronlyonehalf ofit.

{ WehaveAteb( [x v℄)=hAteb(v)jex:Ateb( )iand

hAteb(v)je x:Ateb( )i!  Ateb( )[x Ateb(v)℄: { WehaveAteb(v[x v 0 ℄)= :hx:Ateb(v)jAteb(v 0 ) i and  :hx:Ateb(v)jAteb(v 0 ) i !  :hAteb(v 0 )jex:hAteb(v)j ii ! e   :(hAteb(v)j i[x Ateb(v 0 )℄) !   :hAteb(v)[x Ateb(v 0 )℄j [x Ateb(v 0 )℄i ! 2  :hAteb(v)[x Ateb(v 0 )℄j i! sv Ateb(v)[x Ateb(v 0 )℄:

{ WehaveAteb(v[ e℄)= :h :hAteb(v)j ijAteb(e)iand

 :h :hAteb(v)j ijAteb(e)i ! 

 :(hAteb(v)j i[ Ateb(e)℄) !



 :hAteb(v)[ Ateb(e)℄j [ Ateb(e)℄i !

2

 :hAteb(v)[ Ateb(e)℄j i! sv

Ateb(v)[ Ateb(e)℄:

(16)

We olle ttogetherourresultstoprovethemaintheoremofthiswork. Theorem 4. The typed ~x- al ulusisstronglynormalizing.

Proof. ByTheorem1(SNforpure al ulus),Theorem2(PSN) andTheorem3 (PSN impliesSN).

5 A hievements and Perspe tives

Using various proof te hniques, we haveestablished that the ~x- al ulus is stronglynormalizing.Forthatpurpose,wehaveformalizedaproofte hniqueof SN via PSN. Let us mentionthat wehave su essfullyapplied this te hnique, with some adjustments, to proveSN of the - al ulus(introdu ed in [3℄) for the rsttime,asfarasweknow.Wealsoused ittoestablishthatPSNimplies SNforthe- al ulus[1℄,forwhi hPSNisknowntofail[10℄,showingthat,for this al ulus,theonlyproblem ofSNisin PSN.

Itremainsanopenproblemtobuildadire tproof,bytheredu ibility te h-nique, of SN forasymmetri non-deterministi al uluswithexpli it substitu-tions.Anotherdire tion ofwork ouldbetorepla esubstitutions \ala"xby substitutions\ala"

ws

[8℄,whi hyields,throughtheadditionofexpli it weak-enings,amorepowerfulsubstitutionsystem.Itmayevenhelpusto ndadire t proofofSN.Atlast,weplantoworkonase ondorderversionof~x.

Referen es

1. Abadi,M., Cardelli,L.,Curien,P.-L.,Levy,J.-J.:Expli it Substitutions.Journal ofFun tionalProgramming(1991).

2. Barbanera, F., Berardi, S.: A symmetri lambda- al ulus for lassi al program extra tion.Pro eedingsofTACS'94(1994),Springer-VerlagLNCS789,495{515. 3. Benaissa, Z.-E.-A., Briaud, D., Les anne,P., Rouyer-Degli,J.:  , a al ulus of expli itsubstitutionswhi hpreservesstrongnormalisation.JournalofFun tional Programming(1996).

4. Bloo,R.,Geuvers,H.:Expli itSubstitution:ontheEdgeofStrongNormalisation. Theoreti alComputerS ien e(1999),211,375{395.

5. Bonelli,E.:Substitutionsexpli itesetree rituredetermes.PhDthesis,Universite ParisXIOrsay(2001).

6. Chur h,A.:TheCal uliofLambdaConversion.Prin etonUniv.Press(1941). 7. Curien, P.-L.,Herbelin, H.:Thedualityof omputation.Pro eedings ofICFP'00

(2000),ACMPress, 233{243.

8. Guillaume, B.: Un al ul desubstitution ave etiquettes.PhDthesis, Universite deSavoie(1999).

9. Herbelin,H.:Expli itsubstitutionsandredu ibility.JournalofLogi and Compu-tation(2001),11,429{449.

10. Mellies,P.-A.:Typed- al uliwithexpli itsubstitutionsmaynotterminate. Pro- eedingsofTLCA'95(1995),SpringerLNCS,902,328{334.

11. Parigot,M.:- al ulus:Analgorithmi interpretationof lassi alnatural dedu -tion.Pro eedingsofLICS'93(1993),ComputerSo ietyPress,39{46.

Références

Documents relatifs

Terms in η-long form present several advantages (see [JG95]) and every simply-typed term M can be put in η-long form with respect to a derivation of a judgement [Hue76].

In this paper we give an arithmetical proof of the strong normalization of λ Sym Prop of Berardi and Barbanera [1], which can be considered as a formulae- as-types translation

De Groote introduced in [7] the typed λµ ∧∨ -calculus to code the classical natural deduction system, and showed that it enjoys the main important prop- erties: the strong

The (search) rule asserts that the type of the extracted method body of n is a func- tion that accept as input argument an object, which will contains the methods m, n, together

The strong normalization theorem of second order classical natural deduction [20] is based on a lemma known as the correctness result, which stipulates that each term is in

The strong normalization of a typed λµ-calculus can be deduced from the one of the corresponding typed λ-calculus by using CPS translations. See, for example, [14] for such

In section 5, we give an example showing that the proofs of strong normalization using candidates of reducibility must somehow be different from the usual ones and we show that, in

This follows immediately from the strong normalization of the calculus of substitution (i.e. all the rules except b) which is proved in [4]2. We have stated the previous lemma in