• Aucun résultat trouvé

Strong Normalization (SN) of Simply Typed Lambda Calculus

N/A
N/A
Protected

Academic year: 2022

Partager "Strong Normalization (SN) of Simply Typed Lambda Calculus"

Copied!
22
0
0

Texte intégral

(1)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Strong Normalization (SN) of Simply Typed

Lambda Calculus

(2)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Typed Properties

[Strong Normalization] Everysimply typedterm is normalising:

ifΓ`λt:A, thent∈S Nβ.

(3)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Defining Strongly Normalizing Terms

Non-inductivedefinition:

t∈S Nβiff there is no infiniteβ-reduction sequence starting att. Equivalentnon-inductivedefinition:

t∈S Nβiff everyβ-reduction sequence starting attis finite.

First inductivealternative definition ofS Nβ(setS N1):

Iftis aβ-normal form, thent∈S N1

If∀t0[(t→β t0)impliest0∈S N1], thent∈S N1

(the first line is a special case of the second one) Second inductivealternative definition ofS Nβ(setS N2):

t1, . . . ,tn∈S N2impliesx~t=x t1 . . .tn∈S N2. t∈S N2impliesλx.t∈S N2.

t{x\u}~r∈S N2andu∈S N2implies(λx.t)u~r∈S N2.

All these notions are equivalent: t∈S N1ifft∈S N2ifft∈S Nβ .

Definition (Measuring

S Nβ

-terms)

Givent∈S Nβ, we define themeasureµβ(t)asmax{n∈IN| t→nβt0}.

Note thatt→β t0impliesµβ(t0)< µβ(t), so thatt∈S Nβandt→β t0impliest0∈S Nβ.

(4)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Some General Remarks About S N

β

-Terms

u∈S Nβiffλy.u∈S Nβ.

u1, . . . ,un∈S Nβiffx u1. . .un∈S Nβ.

In general, ift∈S Nβ, then every subterm oftis alsoS Nβ. but the converse is not true, e.g.(λxx.x)(λxx.x).

This is becauseS Nβis not stable by substitution. Example:x x∈S Nβ,λy.y y∈S Nβ, but(x x){x\λy.y y}= ∆ ∆<S Nβ.

(5)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

First Proof of the SN property

This first proof is due to Tait.

Uses thefirst inductivedefinition ofS Nβ(S Nβ=S N1)

It is based on a predicateS Ccharacterizingstrong computableterms.

Definition

Lettbe of typeA=A1→. . .→An→τ. Thent∈S Ciff forallui∈S Cof typeAiwe havet~u=t u1. . .un∈S Nβ.

The previous definition implies

1 S C⊆S Nβ.

2 S Cis closed underβ(i.e.t∈S Candt→β t0impliest0∈S C).

3 x∈S Cfor every variablex(using 1).

(6)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Lemma

Ifu,u1, . . . ,un(n≥1)∈S Nβandu{x\u1}u2. . .un∈S Nβ, thent=(λx.u)u1u2. . .un∈S Nβ.

Proof.

By the first inductive definition ofS Nβ, to showt∈S Nβit is sufficient to show thatallthe reducts oft=(λx.u)u1. . .unare int∈S Nβ. By the first hypothesis of the lemma we can proceed byinductiononµβ(u)+ Σiµβ(ui). We reason by case analysis on the reducts of t, which are:

(λx.u0)u1. . .un, whereu→ u0. Thenµβ(u0)< µβ(u), we conclude by thei.h.

(λx.u)u1. . .u0i. . .un, whereui→ u0i. Thenµβ(u0i)< µβ(ui), we conclude by thei.h.

u{x\u1}u2. . .un. We conclude by the second hypothesis.

Remark:The base case of the induction is whenµβ(u)+ Σiµβ(ui)=0,i.e.when u,u1, . . . ,unareβ-normal forms. The only reduct oftin this case is of the form u{x\u1}u2. . .un, as in the third item.

(7)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Lemma

Lettbe a typed term and letσbe a type preserving substitution mapping all the free variables oftto terms inSC. Thentσ∈S C.

Proof.

We proceed byinductionon the typed termt.

t=x. Thenxσ=σ(x)∈S Cby the second hypothesis.

t=uv. ThenvσinS Cby thei.h.Considerri∈S Cso thatvσ,r1, . . . ,rn∈S C. Then (uv)σ~r=uσvσ ~r∈S Nβby definition ofuσ∈S C, which also holds by thei.h.

t=λx.u, then(λx.u)σ=αλx.uσ. Sinceσ∪ {x\x}verifies the second hypothesis of the lemma, then by thei.h.u(σ∪ {x\x})=uσ∈S C. To showλx.uσ∈S Cwe considerr1, . . . ,rn∈S Cand we show(λx.uσ)r1. . .rn∈S Nβ. This follows from the previous lemma since

1 uσ∈S Nβ: sinceuσ∈S CandS C⊆S Nβ.

2 r1, . . . ,rn∈S Nβ: sincer1, . . . ,rn∈S CandS C⊆S Nβ.

3 (uσ){x\r1}r2. . .rn∈S Nβ: since(uσ){x\r1}=u(σ∪ {x\r1})andσ∪ {x\r1}verifies the second hypothesis of the lemma, then(uσ){x\r1} ∈S Cholds by thei.h., and thus (uσ){x\r1}r2. . .rn∈S Nβholds by definition ofS C.

(8)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Lemma

Every typed term is inS C.

Proof.

Using the previous lemma with the identity substitutioniddefined byid(x)=xfor all x.

Remark thatidis a type preserving substitution and maps variables to variables, which

are terms inS Cas previously remarked.

(9)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Theorem

Every typed term is inS Nβ.

Proof.

Using the previous lemma and the fact theS C⊆S Nβ.

(10)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Second proof of the SN property

Can be found in Femke van Raamsdonk’s Thesis.

Uses thesecond inductivedefinition ofS Nβ(S Nβ=S N2)

1 DefineΛA(terms of typeA) inductively:

Ifxis a variable of typeA, thenx∈ΛA.

Ift∈ΛCandxis a variable of typeB, thenλx.t∈ΛB→C. Ift∈ΛB→Aandu∈ΛB, thent u∈ΛA.

2 DefineS NA:=S N2∩ΛA.

3 DefineX⇒Y:={t| ∀u.(u∈Ximpliestu∈Y)}.

4 ShowΛAB= ΛA⇒ΛB.

5 ShowS NA⇒S NB⊆S NA→B(easy).

6 Ifu∈S NA1⇒S NA2⇒. . .⇒S NAmwithAma base type andt∈S NB, then t{x\u} ∈S NB(induction on SN using 5).

7 ShowS NA→B⊆S NA⇒S NB(using 6).

8 Show thatΛA⊆S NA(by induction using 7).

9 SinceS NA⊆S N2=S Nβwe conclude.

(11)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Third Proof of the SN property

This first proof is due to Gandy, later rediscovered by Ren ´e David.

Uses thefirst inductivedefinition ofS Nβ(S Nβ=S N1)

Lemma

Iftanduare typed and belong toS Nβ, thent{x\u} ∈S Nβ.

Proof.

Byinductiononhtype(u), µβ(t),size(t)i, using the standard lexicographic order. We reason by case analysis ont.

t=z. Ift=x, thenx{x\u}=u∈S Nβby hypothesis, whereast=z,ximplies z{x\u}=zwhich is trivially inS Nβ.

t=z c1. . .cn(z,x). By thei.h.onci(type(u)is equal,µβ( )decreases andsize( ) strictly decreases.).

t=x c1. . .cn. By thei.h.Ci=ci{x\u} ∈S Nβ. It is sufficient to show that all the reducts ofT=t{x\u}=u C1. . .Cnare inS Nβ. We reason byinductionon µβ(u)+ Σiµβ(Ci). The reducts ofT are:

u0C1. . .Cn, whereu→ u0. Apply thei.h.

u C1. . .C0i. . .Cn, whereCi→ C0i. Apply thei.h.

v{y\C1}C2. . .Cn, whereu=λy.v. Butv{y\C1}C2. . .Cn=(zC2. . .Cn){z\v{y\C1}}and type(v{y\C1})<type(u). We thus conclude by thei.h.sincezC2. . .Cnandv{y\C1}are typed and belong toS Nβby thei.h.

(12)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

t=λy.v. By thei.h.onv(type(u)andµβ( )are equal,size( )strictly decreases).

t=(λy.b)c1. . .cn. By thei.h.B=b{x\u}, andCi=ci{x\u}are inS Nβ. It is sufficient to show that all the reducts ofT =t{x\u}=(λy.B)C1. . .Cnare inS Nβ. We proceed byinductiononµβ(u)+µβ(B)+ Σiµβ(Ci). The reducts ofTare:

(λy.B0)C1. . .Cn, whereB→ B0. Apply thei.h.

(λy.B)C1. . .C0i. . .Cn, whereCi→ C0i. Apply thei.h.

B{y\C1}C2. . .Cn. ButB{y\C1}C2. . .Cn=(b{y\c1}c2. . .cn){x\u}and µβ(b{y\c1}c2. . .cn)< µβ(t). ThusB{y\C1}C2. . .Cn∈S Nβby thei.h.

Remark:The base casehbase type, 0, 1inecessarily corresponds to a variable of base type, which is a particular case of the already detailed caset=z.

(13)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Theorem

Iftis typable, thent∈S Nβ.

Proof.

By induction on the typed termt. Caset=xis trivial.

Caset=λy.uholds by the i.h.

For the caset=u v, we use the fact thatt=(z v){z\u}, wherezis a fresh variable, and then apply previous lemma (verification of the hypothesis is easy).

(14)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Fourth proof of the SN property

See for example Gandy’s proof by Alexandre Miquel.

A combinatorial proof of strong normalisation for the simply typed lambda-calculus.

http://www.pps.univ-paris-diderot.fr/˜miquel/publis/snlam.pdf

(15)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Strong Normalization of Girard’s System F

(16)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Reducibility Candidates

Remind the relationF:

(λx:A.t)u → t{x\u}

(Λαt)[A] → t{α\A}

Strongly Normalizing Terms:t∈S NFiff there is no infinite→F reduction sequence starting att.

Neutral Terms:Terms that are not abstractions.

Definition

Areducibility candidateof typeAis a setRof terms of typeAsuch that (CR1) Ift∈ R, thent∈S NF

(CR2) Ift∈ Randt→F t0, thent0∈ R

(CR3) Iftis a neutral term and (t→F t0impliest0∈ R), thent∈ R.

Definition

IfRandSare reducibility candidates of typeAandBrespectively, thenR ⇒ Sis a set of terms of typeA→Bdefined by

t∈ R ⇒ Siff∀u.(u∈ Rimpliestu∈ S)

(17)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Remarks

A consequence of(CR3): Iftis a neutral andF-normal term, thent∈ R. Rof typeAis never empty, it contains at least the variables of typeA. The set{t∈S NFandtof typeA}is a reducibility candidate.

The setR ⇒ Sis a reducibility candidate.

(18)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Reducibility with Parameters

Definition

LetTbe a type wheretfv(T)⊆~α. We writeT{~α\A}~ for the simultaneous substitution of

~αbyA~. Given~Ra sequence of reducibility candidates, we define a setREDT(~α, ~R)of terms of typeT{~α\A}~.

IfT=αi, thenREDαi(~α, ~R)isRi

IfT=A→B, thenREDA→B(~α, ~R)isREDA(~α, ~R)⇒REDB(~α, ~R)

IfT =∀γ.B, thenRED∀γ.B(~α, ~R)is the set of termstof typeT{~α\A}~ such that for every typeCand reducibility candidateSof this type, thent[C]∈REDB(~αγ, ~RS)

(19)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Properties

Lemma

REDT(~α, ~R)is a reducibility candidate of typeT{~α\A~}.

Lemma

REDT{γ\B}(~α, ~R)=REDT(~αγ, ~RREDB(~α, ~R)).

Lemma

If for every typeBand candidateS,t{γ\B} ∈REDA(~αγ, ~RS), thenΛγt∈RED∀γ.A(~α, ~R).

Lemma

Ift∈RED∀γ.A(~α, ~R),t[B]∈REDA{γ\B}(~α, ~R). for every typeB.

(20)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Reducible Terms

Definition

A termtof typeAisreducibleift∈REDA(~α, ~S N)where~α=α1. . . αnare the free type variables ofA, andS N~ isS N1. . .S Nn, whereS Niis the set of terms ofS NFof typeαi.

(21)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Final Theorem

Theorem

All typed terms of systemFare reducible.

Corollary (by CR1)

Corollary

All typed terms of systemFare inS NF.

(22)

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner

Key Lemma for Final Theorem

Lemma

Lettbe a term of typeA. Supposefv(t)⊆ {x1, . . . ,xn}andxiis of typeBi. Suppose tfv(A,B1, . . . ,Bn)⊆ {α1, . . . , αm}. If{R1, . . . ,Rm}are reducibility candidates of types {C1, . . . ,Cm}, andv1, . . . ,vnare terms of typesB1{~α\C}, . . . ,~ Bn{~α\C}~ which are in REDB1(~α, ~~R), . . . ,REDBn(~α, ~~R)resp., thent{~α\C}{~~ x\~v} ∈REDA(~α, ~R).

Références

Documents relatifs

Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner.. Typed

Since the proofs in the implicative propositional classical logic can be coded by Parigot’s λµ-terms and the cut elimination corresponds to the λµ-reduction, the result can be seen as

In particular, they have constructed many minimal surfaces in H 2 × R , such as the catenoid with the vertical axis of revolution, ruled minimal surfaces, the Riemann type

In the mid-1980s the second author observed that for a connected reductive complex algebraic group G the singular support of any character sheaf on G is contained in a fixed

Suppose that G is a finitely generated semi- group such that every action by Lipschitz transformations (resp.. First it must be checked that the action is well-defined. The first one

Stop considering anything can be applied to anything A function and its argument have different

Stop considering anything can be applied to anything A function and its argument have different behaviors.. Demaille Simply Typed λ-Calculus 12

Denote by H 0 (X, L) the vector space of global sections of L, and suppose that this space has