• 検索結果がありません。

Light Affine Lambda Calculus and Polynomial Time Strong Normalization

N/A
N/A
Protected

Academic year: 2022

シェア "Light Affine Lambda Calculus and Polynomial Time Strong Normalization"

Copied!
28
0
0

読み込み中.... (全文を見る)

全文

(1)

(will be inserted by the editor)

Kazushige Terui

Light Affine Lambda Calculus and Polynomial Time Strong Normalization

Received: date / Revised version: date – cSpringer-Verlag 2004

Abstract. Light Linear Logic(LLL) andIntuitionistic Light Affine Logic(ILAL) are logics that capture polynomial time computation. It is known that every poly- nomial time function can be represented by a proof of these logics via the proofs- as-programs correspondence. Furthermore, there is a reduction strategy which normalizes a given proof in polynomial time. Given the latter polynomial time

“weak” normalization theorem, it is natural to ask whether a “strong” form of polynomial time normalization theorem holds or not.

In this paper, we introduce an untyped term calculus, called Light Affine Lambda Calculus(λla), which corresponds toILAL.λlais a bi-modalλ-calculus with certain constraints, endowed with very simple reduction rules. The main property ofλlais the polynomial time strong normalization:anyreduction strat- egy normalizes a givenλlaterm in a polynomial number of reduction steps, and indeed in polynomial time. Since proofs ofILAL are structurally representable by terms ofλla, we conclude that the same holds forILAL.

1. Introduction

In [9], Girard introducedLight Linear Logic(LLL) as an intrinsically poly- time logical system: every polynomial time function is representable by an LLL proof, and every LLL proof (of lazy conclusions) is normalizable in polynomial time. Later on, Asperti [1] introduced a simplified system, called Light Affine Logic, by adding the full (unrestricted) weakening rule toLLL.

Its intuitionistic fragment (ILAL) has been particularly well investigated (see [2]), because it allows a compact term notation for proofs and has clear relevance to functional programming issues.

Light Logics provide animplicitcharacterization of polynomial time; in contrast with their precursor,Bounded Linear Logic[10], the syntax of Light Logics do not contain any polynomials. Moreover, the characterization is purely logical; in contrast with those implicit characterizations of polynomial time which are mostly based on safe recursion or data ramification (see [6, Kazushige Terui: National Institute of Informatics, 2-1-2 Hitotsubashi, Chiyoda- ku, 101-8430 Tokyo, Japan. e-mail:terui@nii.ac.jp

This is a full version of the paper [21] presented at LICS 2001.

Key words or phrases:Light logics – Lambda calculus – Polynomial time

(2)

14, 13, 11, 7]), Light Logics do not contain any built-in data types, and the characterization result is about the complexity of cut-elimination, which is of purely logical nature. It naturally extends to a consistent naive set theory, in which one can reason about polynomial time concepts [9, 23].

Also notably, Light Logics are endowed with various semantics [12, 3, 16], which could lead to a semantic understanding of polynomial time.

An important problem remains to be settled, however. By inspecting the normalization theorem given by [9], one observes that what is actually shown is the polynomial timeweak normalization, namely, that there is a specific reduction strategy which normalizes a givenLLLproof in polynomial time.

The same is true of ILAL [1, 2]. It has been left unsettled whether the polynomial timestrongnormalization holds for these Light Logics, namely, whetheranyreduction strategy normalizes a given proof in polynomial time.

The primary purpose of this paper is to give a solution to this problem.

Having such a property will be theoretically important in that it gives further credence to Light Logics as intrinsically polytime systems. It will be practically important, too. Through the Curry-Howard correspondence, the proofs of Light Logics may be considered asfeasible programs. In this context, the property will ensure that the programs can be executed in polynomial timeindependent ofevaluation strategies.

For our purpose, it is reasonable to begin with ILAL, because it is simpler than LLL as a logical system. However, the existing term calculi proposed for ILAL either have a complicated notion of reduction defined by more than 20 rewriting rules [1, 20], or involve notational ambiguity [19, 2]1. Therefore, it is desirable to have a simple and accurate term calculus for ILAL. Such a simple calculus will provide a clearer intuition on the computational aspect of Light Logics. That is our secondary purpose2.

In this paper, we introduce a new term calculus, called Light Affine Lambda Calculus(λla) (in Section 2). It amounts to a simple modification ofλ-calculus with modal and let operators. The main advantage of λla is operational simplicity; it has only five reduction rules and each rule has a clear meaning. Although λla is untyped, all the well-formed terms are normalizing. We then re-introduceILALas a Curry-style type assignment system for λla and prove the subject reduction theorem (in Section 3).

There are a number of reasons for adopting a Curry-style presentation:

1. First of all, to design a truly polytime (rather than just polystep) poly- morphic calculus, one has to give up a Church-style term syntax with embedded types: a universal quantifier may bind an arbitrary number

1 See the remark in Section 9.1 of [2]. To compensate this ambiguity, the latter paper presents a proofnet syntax forILAL.

2 Another approach is to identify a well-behaved fragment ofILALfor which the ordinary lambda calculus works perfectly well. This line of research is pursued by [4].

(3)

of type variable occurrences, and thus iterated type instantiations (Λ reductions) may easily cause exponential growth in the size of types.3 2. An untyped polytime calculus deserves investigation in its own right.

3. The notion of well-formedness, rather than typability, neatly captures the syntactic condition for polynomial time normalizability.

4. Last but not least, typability inILALis presumably intractable4, while well-formedness can be checked very easily (in quadratic time).

In this setting, we prove our main theorems (in Sections 4 and 5):

The Polystep Strong Normalization Theorem: every reduction sequence in λla has a length bounded by a polynomial in the size of the initial term (when the term depth is fixed).

The Polytime Strong Normalization Theorem: every reduction strategy (given as a function oracle) induces a normalization procedure which terminates in polynomial time.

Since proofs of ILAL are structurally representable by terms of ILAL (where formulas are erased), we can conclude that the same theorem holds forILAL.

We finally discuss some related issues, such as the relationship with the safe recursion approach, polynomial time strong normalization for LLL, a lowerbound for normalization and decision problems for type inference (in Section 6).

2. Light Affine Lambda Calculus

In this section, we presentλla. We begin by introducing the pseudo-terms and several basic notions in 2.1, then move on to the well-formed terms in 2.2. Finally, the reduction rules are given in 2.3.

2.1. Pseudo-Terms

Letx, y, z . . .range over term variables.

Definition 1.The setPT ofpseudo-termsis defined by the following gram- mar:

t, u::=x|λx.t| tu|!t| let!x=uint | §t |let§x=uint.

In addition toλ-abstraction and application, we have two modal opera- tors (!,§) and twoletoperators (let-!,let-§). Pseudo-terms !tand§tare called

!-boxand§-boxrespectively. It is suggestive to think of them as “boxes” in the literal sense:

3 Proofnets (ofLLL) contain formulas. Hence proofnets themselves are not nor- malizable in polynomial time. A solution suggested by [9] is to work with untyped proofnets (with formulas erased) in the actual computation. When the conclusion is lazy, the formulas can be automatically recovered after normalization, and such formulas are not exponentially large. Our approach is essentially the same, but we start by a type-free setting, then consider typing afterwards.

4 The problem is undecidable for System F in the Curry style [24].

(4)

x.let !x be !y in yy

let !x be !y in yy

!x λ

yy

x y y

ε 0

00 01

011 010 000

Fig. 1.Term Tree and Addresses

! t § t.

With boxes thus drawn, each pseudo-term is stratified into layers. For in- stance, (let!x=!y in§!(λz.zx))zis stratified into three layers as follows:

(let!x=! y in§ ! λz.zx )w.

In the sequel, symbol stands for either ! or §. Pseudo-terms (λx.t) and (let †x = uint) bind each occurrence of x in t. As usual, pseudo-terms are considered up toα-equivalence, and subject to thevariable convention;

namely, the bound variables are chosen to be different from the free vari- ables, so that variable clash is never caused by substitution. The notation t[u/x] denotes the pseudo-term obtained by substituting ufor the free oc- currences of x in t. F V(t) denotes the set of free variables in t. F O(x, t) denotes the number of free occurrences of x in t, and F O(t) denotes the number of all free variable occurrences int.

Each pseudo-termtcan be represented as aterm tree, and each subterm occurrence u in t can be pointed by its address, i.e., a word w ∈ {0,1} which describes the path from the root to the node corresponding to uin the term tree. For example, the term tree for (λx.let!y=!xin yy) and the addresses in it are illustrated in Figure 1. We writewvwhenwis a prefix ofv.

Thesize|t| of a pseudo-termtis the number of nodes in its term tree.

Since pseudo-terms are untyped, |t| is not significantly different from the length of the string representation oft. Given a pseudo-termtand an address w, the depthof w in t is the number of !-boxes and§-boxes enclosing the subexpression atw. The depthof tis the maximum depth of all addresses in it.

AcontextΦis a pseudo-term with a hole •. If Φis a context andt is a pseudo-term, thenΦ[t] denotes the pseudo-term obtained by substitutingt forin Φ.

2.2. Well-Formed Terms

The well-formed terms are obtained by imposing certain conditions on the pseudo-terms. To begin with, let us give an informal description.

(5)

First, the base of our calculus isaffine: eachλmay bind at most one free variable. That is to say,λis in charge of abstraction and cancellation, but not of duplication. Moreover, theλ-binding relation may not cross a box.

For instance, the binding below is not allowed:

λx. ! xt

The effect is thatλ- and !-components do not interleave each other.

Second, let operators must respect stratification: for each pair of a let operator and a variable it binds, the binding relation must crossexactly one box, as follows:

let!x=t in§ xxy ! xu

To see why this condition is needed, define ω1≡λx.(let!y=xin y!y), ω2≡λx.(let!y=xin !(y(!y)).

These pseudo-terms clearly violate the above condition; in ω1 the binding relation indicated below does not cross a box, while inω2 the one indicated below crosses two boxes.

λx.(let!y =xiny! y ) λx.(let!y=xin! y! y )

These terms causes non-termination of reductions. In fact, anticipating the reduction rules in Figure 2, we see that the following pseudo-terms are not normalizing:

ω11−→(β) let!y=!ω1 iny!y

−→(!) ω11−→ · · · ω22−→(β) let!y=!ω2 in!(y!y))

−→(!) !(ω22)−→ · · ·

Note that the above condition reflects the lack of the dereliction and diggingprinciples in Light Logics:

Dereliction: !A−◦A, Digging: !A−◦!!A.

Third, a !-box may contain at most one free variable. This is to rule out a pseudo-term like

2≡λx.(let!y=xin ! yy ),

(6)

which causes an exponential explosion:

2n(!z) −→(β) 2n−1(let!y=!zin !yy)

−→(!) 2n−1(!zz)

−→(β) 2n−2(let!y=!zzin!yy)

−→(!) 2n−2(!(zz)(zz))

−→!(zz · · · ·z

2n times

).

This condition intuitively means that a !-box is to be duplicated, but not to duplicate another !-box. It reflects the lack of themonoidalnessin Light Logics (which distinguishes Light Logics fromElementary Logics[9, 8]):

Monoidalness: !A⊗!B−◦!(A⊗B).

Since the last condition is too severe, we need another modal operator

§ as a compensation. A §-box may contain an arbitrary number of free variables. Instead,let-§may not bind more than one free variable. In other words, a §-box is to duplicate something, but not to be duplicated. Two modalities ! and §are related by the following conditions: a let-! operator may bind a free variable in a §-box (corresponding to the weak dereliction principle !A−◦ §Athat holds in Light Logics), whereas alet-§operator may not bind a free variable in a !-box.

Let us now give a formal definition. Here, it is convenient to classify variables into three groups:undischarged, !-discharged, and§-dischargedvari- ables. These are to be bound byλ-abstraction,let-! operator and let-§op- erator, respectively. In the sequel,stands for disjoint union.

Definition 2.Let X, Y, Zrange over the finite sets of variables. The 4-ary relation t ∈ TX,Y,Z (saying that t is a well-formed term with undischarged variables from X, !-discharged variables from Y and§-discharged variables from Z) is defined as follows (in writing t∈ TX,Y,Z, we implicitly assume that X,Y andZ are mutually disjoint):

1.x∈ TX,Y,Z ⇐⇒ x∈X.

2.λx.t∈ TX,Y,Z ⇐⇒t∈ TX{x},Y,Z, F O(x, t)≤1.

3.tu∈ TX,Y,Z ⇐⇒ t∈ TX,Y,Z, u∈ TX,Y,Z. 4.!t∈ TX,Y,Z ⇐⇒ t∈ TY,∅,∅, F O(t)≤1.

5.§t∈ TX,Y,Z ⇐⇒ t∈ TYZ,∅,∅.

6.let!x=tin u∈ TX,Y,Z ⇐⇒ t∈ TX,Y,Z, u∈ TX,Y{x},Z.

7.let§x=t inu∈ TX,Y,Z ⇐⇒t∈ TX,Y,Z, u∈ TX,Y,Z{x}, F O(x, u)≤1.

We say thattis a well-formed term, or simply aterm, ift∈ TX,Y,Z for someX, Y andZ.

Note that clause 2 above embodies the affinity ofλ-abstraction, clause 4 embodies the no-more-than-one-variable condition on !-boxes. In the mean- time, the statement 3 of the next lemma ensures that the stratification condition on !- and§- boxes is satisfied.

(7)

Lemma 1.Let t∈ TX,Y,Z.

1. IfX ⊆X,Y ⊆Y andZ⊆Z, then t∈ TX,Y,Z. 2. Ifx∈F V(t), then t∈ TX\{x},Y\{x},Z\{x}.

3. Letx∈F V(t). Thenxoccurs at depth 0 iff x∈X.xoccurs at depth 1 iffx∈Y ∪Z.xnever occurs at depth>1.

Proof. By induction ont.

Lemma 2. (Substitution)

1.t∈ TX{x},Y,Z andu∈ TX,Y,Z =⇒t[u/x]∈ TX,Y,Z.

2.t∈ TX,Y{x},Z,u∈ TY,∅,∅ andF O(u)≤1 =⇒t[u/x]∈ TX,Y,Z. 3.t∈ TX,Y,Z{x} andu∈ TY∪Z,∅,∅ =⇒t[u/x]∈ TX,Y,Z.

Proof. By induction ont.

Example 1.We writeλ!x.tto denoteλx.let!y=xint[y/x] withy fresh.

1. While ω1 and ω2 in the previous subsection are not well-formed,ω3 λx.(let!y=xin§yy) is well-formed.

2. For each natural number n, we haveChurch numeral n∈ T defined by n≡λ!x.§λz.(x· · ·(x

n times

z)· · ·).

3. For each wordw≡i0· · ·in ∈ {0,1}, we havew∈ T defined by w≡λ!x0!x1.§λz.(xi0· · ·(xinz)· · ·).

Observe thatn’s andw’s are of depth 1.

4.Suc≡λn.λ!f.let§h=n!f in§λy.f(hy)∈ T.

Remark 1.As discussed in Section 3 of [1], a naive use of box notation causes ambiguity, and in conjunction with naive substitution, it causes a disastrous effect on complexity.

While Asperti solved this problem by using a more sophisticated box notation§(t)[u1/x1, . . . , un/xn], our solution is more implicit and based on a conceptual distinction between discharged and undischarged variables.

Asperti’s box§(tx1x2)[y/x1, y/x2] (withy of !-type) corresponds to (let!x=y in§(txx)) in our syntax. Observe that variabley, which is exter- nal to the§-box, is shared in the former, while variablex, which is internal to the §-box, is shared in the latter. This is parallel to the difference be- tween the contraction inference rule of Asperti’sILALand that of Girard’s LLL; the former contracts !-formulas, while the latter contracts discharged formulas.

Remark 2.There is a quadratic time algorithm for well-formedness checking.

Let t be a pseudo-term, and X and Y be the sets of its free variables at depth 0 and at depth 1, respectively. Thentis well-formed ifft∈ TX,Y,∅(by Lemma 1 and the fact thatt∈ TX,Y,Z impliest∈ TX,Y∪Z,∅). The latter can be recursively checked with at most|t|recursive calls, and each call involves a variable occurrence check at most once (corresponding to Clauses 2, 4 and 7 of Definition 2). Therefore the algorithm runs in timeO(n2), given a term of sizen.

(8)

Name Redex Contractum

(β) (λx.t)u t[u/x]

(§) let§x=§uint t[u/x]

(!) let !x=!uint t[u/x]

(com) (let †x=uint)v let †x=uin(tv) let †y= (let †x=uint)invlet †x=uin(let †y=tinv)

Fig. 2.Reduction Rules

2.3. Reduction Rules

Definition 3.The reduction rules of λla are given in Figure 2. We say that t reduces to u at address w by rule (r), and write as t −−−→w,(r) u, if t≡Φ[v1],u≡Φ[v2], the hole is located at winΦ, and v1 is an(r)-redex whose contractum isv2.

Note that the address w uniquely determines the rule (r) to be used.

When the address w or the rule (r), or both, are irrelevant, we write as t −−→(r) u,t −→w uand t −→u, respectively. Thedepth of a reduction is the depth of its redex.

A finite sequence σ of addresses w0, . . . , wn−1 is said to be a reduc- tion sequencefromt0 totn, written as t0−→σ tn, if there are pseudo-terms t1, . . . , tn−1such that

t0−−→w0 t1−−→ · · ·w1 −−−→wn−1 tn.

If every reduction in σ is an application of rule (r), then σ is called an (r)-reduction sequenceand written ast0−−−→σ,(r) tn (or simply ast0−−→(r)tn).

The length ofσis denoted by |σ|.

The well-formed terms are closed under reduction:

Proposition 1.If t∈ TX,Y,Z andt−→u, thenu∈ TX,Y,Z.

Proof. We prove the following by induction on Φ: if Φ[t] ∈ TX,Y,Z and Φ[t]→Φ[u], then

(1) Φ[u]∈ TX,Y,Z and

(2) F O(x, Φ[u])≤F O(x, Φ[t]) for everyx∈X∪Z.

WhenΦ≡ •and the reduction is of the form t≡let!x=!v1in v2−→(!) v2[v1/x]≡u,

thenv2∈ TX,Y{x},Z,v1∈ TY,∅,∅andF O(v1)1. Hencev2[v1/x]∈ TX,Y,Z

by Lemma 2. (2) is obvious since no variable inv1 belongs toX∪Z.

If Φ λy.Φ, then Φ[t] ∈ TX{y},Y,Z and F O(y, Φ[t]) 1. By the induction hypothesis, Φ[u] ∈ TX{y},Y,Z and F O(y, Φ[u]) 1. Therefore λy.Φ[u]∈ TX,Y,Z. (2) is obvious.

Other cases are similar.

(9)

(1)

ω3!ω3 (β)

−→(let!y=!ω3 in§yy)

−→ §ω(!) 3ω3

−→ §(β) (let!y=ω3 in§yy). (2)

(λ!x.t)!u (λx.let!y=xint[y/x])!u

−→(β) let!y=!uint[y/x]

−→(!) t[u/x] (3)

Suc2 −→(β) λ!f.let§h= (λ!x.§λz.x(xz))!f in§λy.f(hy)

−→λ!f.let§h=§λz.f(fz)in§λy.f(hy)

−→(§) λ!f.§λy.f((λz.f(fz))y)

−→(β) λ!f.§λy.f(f(fy))3

Fig. 3.Examples of normalization

Example 2.

1. We have seen in Example 1 that the termω3≡λx.(let!y=xin §yy) is well-formed. In contrast to ω11 and ω22 described before, ω33 is normalizing (or better, dead-locking). See Figure 3 (1).

2. (λ!x.t)!ureduces tot[u/x] as in Figure 3 (2).

3. The termSuc in Example 1 surely represents the successor for Church numerals. In fact, the term Suc 2 reduces to 3, as illustrated in Fig- ure 3 (3).

Remark 3.The stratified structure of a term is strictly preserved by reduc- tion. In particular, the depth of a term never increases, since in reduction rules (β), (§) and (!) a subterm uis substituted for a variablexoccurring at the same depth, and (com) does not affect the stratified structure.

Reduction rules (β) and (§) are strictly size-decreasing, since they never involve duplication. (com) preserves the size. The only reduction rule that is potentially size-increasing is (!). Nevertheless, it is also strictly size- decreasing at the depth where the redex is located. The size increases only at deeper layers.

(10)

3. Type Assignment

The purpose of this section is to present Intuitionistic Light Affine Logic (ILAL) as a type assignment system for λla and to prove the subject reduction theorem.

In 3.1, we introduce ILAL in a sequent calculus style. It is, however, difficult to prove the subject reduction theorem directly for it. The main difficulty is that it does not satisfy the subterm typability. To overcome this, we introduce a natural deduction systemILALN in 3.2. It is equivalent to ILALas far asclosedterms are concerned, and it does satisfy the subterm typability. Once having defined the suitable formalism ILALN, it is easy to prove the subject reduction theorem. This is accomplished in 3.3.

3.1. ILAL as a Type Assignment System Letα, βrange over the type variables.

Definition 4.The types (formulas) of ILAL are given by the following grammar:

A, B::=α| A−◦B | ∀α.A|!A | §A.

A !-discharged type is an expression of the form [A]!. A§-discharged type is an expression of the form[A]§.

In the sequel,nA abbreviates † · · · †

n times

A.

A declaration is an expression of the form x:A or x: [A]. A finite set of declarations is denoted byΓ, ∆, etc. LetΓ be a set of declarations x1:A1, . . . , xn:An in which all types are undischarged. Then [Γ] denotes x1: [A1], . . . , xn: [An]. IfΓ contains a declaration with a discharged type, then [Γ] is undefined.

Definition 5.The type inference rules of ILAL are given in Figure 4. A pseudo-termt is typablein ILAL if Γ t:A is derivable for some Γ and A by those inference rules. Likewise, a pseudo-termt isof typeA ift:A is derivable.

As expected, we have:

Proposition 2.Every typable pseudo-term is a term. More exactly, if−→x:

→A ,−→y :−→

[B]!,−→z :−→

[C]§t:D,is derivable, then t∈ T{−x},{−y},{−z}.

Proof. By induction on the length of the typing derivation. In the case of (Cut) and (−◦l), apply Lemma 2(1).

Example 3.Let int ≡ ∀α.!(α−◦α)−◦ §(α−◦α) and bint ≡ ∀α.!(α−◦

α)−◦!(α−◦α)−◦ §(α−◦α). Then we have n:int for each n N and w:bintfor eachw∈ {0,1}.

(11)

x:Ax:A Id Γ1u:A x:A, Γ2t:C Γ1, Γ2 t[u/x] :C Cut

Γ t:C

∆, Γt:C W eak x: [A]!, y: [A]!, Γt:C z: [A]!, Γt[z/x, z/y] :C Cntr Γ1u:A1 x:A2, Γ2t:C

Γ1, y:A1−◦A2, Γ2t[yu/x] :C −◦l x:A1, Γ t:A2

Γ λx.t:A1−◦A2 −◦r x:A[B/α], Γ t:C

x:∀α.A, Γ t:C ∀l Γ t:A

Γ t:∀α.A ∀r, (αis not free inΓ) x: [A]!, Γt:C

y:!A, Γlet!x=yint:C !l x:Bt:A x: [B]!!t:!A !r x: [A]§, Γt:C

y:§A, Γ let§x=yint:C §l Γ, ∆t:A [Γ]!,[]§ §t:§A §r In rule (!r),x:B can be absent. In rule (§r),Γ andcan be empty.

Fig. 4.Type Assignment SystemILAL

An example of an untypable well-formed term isω33. To see the reason, define the erasureof a λla term to be a λ-term obtained by applying the following operations as much as possible:

†u→u, let †x=uint→t[u/x].

As easily seen, if a term is typable in ILAL, then its erasure is typable in System F (in the Curry style). Now, ω33 cannot be typed in ILAL, because its erasure is (λx.xx)(λx.xx), a term which cannot be typed in System F.

Remark 4.Unlike the ordinaly lambda calculus,λladoes not need types to ensure normalization. Nevertheless, types are useful in several ways:

Types are used to avoiddeadlocks, such as (†t)uandlet †x= (λx.t)inu.

Some types, typically data types such as int and bint, constrain the shape of normal terms. For instance, all normal terms of typeintare of the formnfor somen≥0 (or λx.(let!z=xin §z), which may be seen as anη-variant of 1). More generally, all normal terms of type§kintare of the form§kn (or anη-variant of§k1).

Lazytypes, i.e., those which do not contain a negative occurrence of∀, constrain the depth of normal terms. If a termt is normal and of lazy typeA, then it means thatt:A can be derived without using the (∀l)

(12)

inference rule, which has an effect of hiding some information on the derivation. Thus all uses of the ! and§inference rules in the derivation are recorded withinA. Hence the depth oft is necessarily bounded by the depth of A. Note that the standard data types such as int, bint, booleans and lists of booleans are all lazy.

The above suggests that in order to normalize a term of lazy type of depthd, one does not have to take care of redices at depth> d, which will be removed anyway by reductions at lower depths before arriving at the normal form. In this way, lazy types help us detect redundant redices.

The expressive power ofILAL, hence ofλla, is witnessed by:

Theorem 1 (Girard[9], Roversi[19]). Every function f : {0,1} −→

{0,1} that is computable in polynomial time is represented by a term of typebint−◦ §dbint for somed.

See [2] for a detailed exposition. Neergaard and Mairson [18] improve the above theorem by showing that a function inDT IM E[nk] can be rep- resented by a proof-net of depthO(logk). The converse will be taken up in Section 5.

3.2. Natural Deduction SystemILALN

ILAL does not satisfy the subterm typability; for example, §(xx) can be typed asx: [A]! §(xx) :§AwithA≡ ∀α.α, but it is clear that its subterm xx cannot be typed. This makes difficult to prove the subject reduction theorem directly for ILAL. For this reason, we introduce a type system ILALN in natural deduction style, which does satisfy the subterm typabil- ity. Then we show that ILALand ILALN are equivalent as far as closed terms are concerned.

The inference rules ofILALN are given in Figure 5.

Lemma 3.If x:µ, Γ t:A is derivable in ILALN andx∈F V(t), where µis either a nondischarged or a discharged type, thenΓ t:Ais derivable inILALN. The same property holds forILAL, too.

Proof. By induction on the derivation.

Lemma 4.The following rules are derivable inILALN: Γ t:C

∆, Γ t:C (W eak) x: [A]!, y: [A]!, Γ t:C

z: [A]!, Γ t[z/x, z/y] :C (Cntr) Γ u:A x:A, Γ t:C

Γ t[u/x] :C (Cut)

∆u:A x: [A]!,[∆]!, Γ t:C F O(u)≤1 [∆]!, Γ t[u/x] :C (Cut!)

(13)

x:A, Γx:A (Ax) Γ t:A−◦B Γ u:A

Γ tu:B (−◦E) x:A, Γt:B F O(x, t)1 Γ λx.t:A−◦B (−◦I) Γ t:∀α.A

Γ t:A[B/α] (∀E) Γ t:A α∈F V(Γ) Γ t:∀α.A (∀I) Γ u:!A x: [A]!, Γt:B

Γ let!x=uint:B (!E) Γ t:A F O(t)1 [Γ]!, ∆!t:!A (!I) Γ u:§A x: [A]§, Γ t:B F O(x, t)1

Γ let§x=uint:B (§E) Γ, Σt:A

[Γ]!,[Σ]§, ∆ §t:§A (§I) Fig. 5. Natural Deduction SystemILALN

∆, Π u:A x: [A]§,[∆]!,[Π]§, Γ t:C

[∆]!,[Π]§, Γ t[u/x] :C (Cut§) Proof. (W eak) By induction on the derivation.

(Cntr) By induction on the derivation. Actually we show that contraction is derivable not only for !-discharged formulas but also for nondischarged and§-discharged formulas.

(Cut) By induction on the derivation ofx:A, Γ t:C.

(Cut!) By induction on the derivation of x: [A]!,[∆]!, Γ t :C. Let us show the critical case. Suppose thatt≡!t and the last inference rule in the derivation is of the form:

x:A, ∆t :C F O(t)1 x: [A]!,[∆]!, Γ !t :!C (!I)

.

By (Cut),∆t[u/x] :Cis derivable inILALN. By assumption,F O(u)≤1 and F O(t) 1, hence F O(t[u/x]) 1. Therefore we can apply (!I) to obtain [∆]!, Γ !t[u/x] :!C.

(Cut§) By induction on the derivation ofx: [A]§,[∆]!,[Π]§, Γ t:C.

Lemma 5.If Γ t:A is derivable in ILAL, then it is also derivable in ILALN.

Proof. By induction on the derivation, using derived rules (W eak), (Cntr) and (Cut) in Lemma 4.

Avariable substitutionis a functionθ from the set of term variables to itself. denotes the term obtained by replacing each free variable x in t withθ(x).Γ θ denotes the set of declarations obtained fromΓ by replacing each variablexwithθ(x). It may decrease the number of declarations due

(14)

to unification. For example, If Γ ≡x:A, y:A and θ(x) = θ(y) = z, then Γ θ≡z:A.

Lemma 6.Suppose thatΓ t:A is derivable in ILALN. Then there are Γ,t and a variable substitution θ such that

Γt:A is derivable inILAL, Γθ≡Γ andtθ≡t.

Proof. By induction on the derivation. We only deal with several critical cases.

(Case 1) The last inference is (−◦E) of the form:

Γ t:A−◦B Γ u:A Γ tu:B (−◦E)

By the induction hypothesis, there areΓ1,Γ2, t, u and variable substitu- tionsθ1andθ2 such that

Γ1t:A−◦B andΓ2 u:Aare derivable inILAL, Γ1θ1≡Γ2θ2≡Γ,tθ1≡tand uθ2≡u.

Without loss of generality, we may assume that F V1) andF V2) are disjoint. From these, Γ1, Γ2 tu :B is derivable in ILAL. A suitable variable substitutionθ is defined by

θ(x) =θ1(x), ifx∈F V1);

=θ2(x), otherwise.

(Case 2) The last inference is (−◦I) of the form:

x:A, Γ t:B F O(x, t)≤1 Γ λx.t:A−◦B (−◦I)

By the induction hypothesis, there arex1:A, . . . , xn:A,Γ,tand a variable substitutionθ such that

x1:A, . . . , xn:A, Γt:B is derivable inILAL, θ(x1) =· · ·=θ(xn) =x,Γθ≡Γ andtθ≡t.

Since F O(x, t) 1, there is at most one xi such that xi F V(t). By Lemma 3,xi:A, Γt:B is derivable inILAL. Renamexi asx. Then we can apply (−◦r) to deriveΓλx.(t[x/xi]) :A−◦Bin ILAL.

(Case 3) The last inference is (!E) of the form:

Γ u:!A x: [A]!, Γ t:B Γ let!x=uint:B (!E)

By the induction hypothesis, there are Γ1,x1: [A]!, . . . , xn: [A]!, Γ2, t, u and variable substitutionsθ1 andθ2 such that

Γ1u :!Aandx1: [A]!, . . . , xn: [A]!, Γ2t:B are derivable inILAL, θ(x1) =· · ·=θ(xn) =x,Γ1θ1≡Γ2θ2≡Γ,uθ1≡uandtθ2≡t.

(15)

We may assume that F V1), F V2) and {x1, . . . , xn} are disjoint. By (Cntr), (!l) and (Cut), Γ1, Γ2 let!x=u in(t[x/x1, . . . , x/xn]) is deriv- able inILAL. A suitable variable substitutionθcan be defined as in (Case 1).

As a consequence, we obtain:

Theorem 2 (Equivalence between ILAL and ILALN).t:Ais deriv- able inILAL if and only if it is derivable inILALN.

Proof. By Lemma 5 and Lemma 6.

3.3. Subject Reduction Theorem

We prove the subject reduction theorem forILALN by employing the tech- nique described in [5]. The following definition is a refinement of Definition 4.2.1 in [5].

For any setΓ of declarations, define a binary relation>Γ on types by

∀α.A >Γ A[B/α],

A >Γ ∀α.A, ifα∈F V(Γ).

Denote the reflexive transitive closure of >Γ byΓ. It is easy to see that wheneverΓ t:AandA≥Γ B,Γ t:B is derivable.

Lemma 7 (Generation lemma).The following hold for ILALN: 1.Γ x:A =⇒x:B∈Γ for someB≥Γ A.

2.Γ λx.t:A=⇒x:B, Γ t:Cfor someBandCsuch thatB−◦C≥Γ A, andF O(x, t)≤1.

3.Γ tu:A=⇒Γ t:B−◦C andΓ u:B for someB andC≥Γ A.

4.Γ let!x=uin t:A = Γ u:!B and x: [B]!, Γ t:C for some B andC≥Γ A.

5.Γ !t:A = t:C for some C and such that !C Γ A and [∆]!⊆Γ, and F O(t)≤1.

6.Γ let§x=uin t:A = Γ u:§B and x: [B]§, Γ t:C for some B andC≥Γ A, andF O(x, t)≤1.

7.Γ §t:A = ∆, Σ t:C for some C, andΣ such that §C Γ A and[∆]!,[Σ]§⊆Γ.

Proof. By induction on derivations. Note that (∀I) and (∀E) are the only inference rules that do not change the subjectt. These rules are handled by means ofΓ.

Theorem 3 (Subject Reduction for ILALN). If Γ t:A is derivable inILALN andt−→u, thenΓ u:Ais derivable inILALN.

Proof. The proof is parallel to that of Proposition 1. We prove the following by induction on Φ: if Γ Φ[t] :Ais derivable in ILALN and Φ[t] →Φ[u], then

(16)

(1) Γ Φ[u] :A and

(2) F O(x, Φ[u]) F O(x, Φ[t]) for each x such that either x:A Γ or x: [A]§∈Γ for someA.

Suppose thatΦ≡ • and the reduction is of the form t≡let!x=!v1in v2−→(!) v2[v1/x]≡u.

By Generation Lemma (4) and (5), we have:

x: [B]!, Γ v2:Cfor some B andC≥Γ A,

∆v1:Dfor some andD such that [∆]!⊆Γ andD≥Γ B.

From the latter, it follows that∆v1:B. By (Cut!) of Lemma 4, we derive Γ v2[v1/x] :C, and thusΓ v2[v1/x] :A. (2) is obvious, because any free variable inv1 is !-discharged inΓ.

Whent is a (β) redex, argue as in the proof of Theorem 4.2.5 in [5].

Other cases are similar.

Corollary 1 (Subject Reduction for ILAL).If Γ t:Ais derivable in ILAL andt−→u, thenΓ u:Ais derivable in ILAL.

Proof. The general case is reducible to the case of closed terms, by using the following facts:

x:A, Γ t:B⇐⇒Γ λx.t:A−◦B

x: [A], Γ t:B⇐⇒y:†A, Γ let †x=yin t:B.

Hence the corollary follows from Theorem 2 and Theorem 3.

4. Proving the Polystep Strong Normalization Theorem

In this section, we prove the polystep strong normalization theorem. The ba- sic idea is very simple: to reduce polystep strong normalization to polystep weak normalization, by showing that any reduction sequence can be trans- formed (standardized) into alongerone which is subject to the outer-layer- first strategy. Since the latter sequence is polynomially bounded by Girard- Asperti’s result [9, 1], we can conclude that any sequence is polynomially bounded as well. Unfortunately, this argument does not work forλlaitself, since standardization inλlamay shorten the reduction sequence. To avoid this, we first introduce an auxiliary term calculus, and show any reduction sequence in λla can be translated into another in the auxiliary calculus in 4.1. Then we show the standardization theorem in 4.2. Finally, we ac- commodate Girard-Asperti’s polynomial time weak normalization theorem to our setting in 4.3.

(17)

4.1. An Extended Calculus with Explicit Weakening

Suppose that t −−→(r) u and consider the following reduction sequence of length two:

(λx.y)!t−−→(r) (λx.y)!u−→(β) y.

It is not outer-layer-first. If one standardizes it, i.e., transforms it into an outer-layer-first one, then the result is

(λx.y)!t−→(β) y,

a shorter reduction sequence of length one, and the standardization argu- ment breaks down. The failure may be ascribed to implicit weakening in- volved byλ-abstraction. We avoid this by introducing an extended calculus where weakening isexplicit.

The setPTwofextended pseudo-termsis defined to be the setPT aug- mented with subexpressions of the formlet =tinu(explicit weakening).

To define a new well-formedness relationt∈ TX,Y,Zw , we modify Definition 2 as follows.

(1) Replace clauses 2, 6, and 7 with:

2’ λx.t∈ TX,Y,Zw ⇐⇒ t∈ TX{x},Y,Zw , F O(x, t) = 1.

6’ let!x=tinu∈ TX,Y,Zw ⇐⇒ t∈ TX,Y,Zw , u∈ TX,Yw {x},Z, F O(x, u)≥1.

7’ let§x=t inu∈ TX,Y,Zw ⇐⇒ t∈ TX,Y,Zw , u∈ TX,Y,Z{x}w , F O(x, u) = 1.

Namely, we require thatλandlet-§bind exactly one variable andlet-! binds at least one variable.

(2) Add the following clause:

8’ let =t inu∈ TX,Y,Zw ⇐⇒ t∈ TX,Y,Zw , u∈ TX,Y,Zw .

We say thattis a(well-formed) extended termift∈ TX,Y,Zw for someX,Y, Z.

The reduction rules in Figure 2 are extended toPTwwith the following modifications:

Extend (com) to the newletoperator.

Add a new reduction rule ( ):let =uin t−→t.

Reduction rules other than ( ) are called proper. A reduction sequence is properif it consists of proper reductions.

Lemmas 1 and 2 hold forTw, too. In addition, we have

Proposition 3.If t∈ TX,Y,Zw ,t−−→(r) uand(r)is proper, thenu∈ TX,Y,Zw . Now we consider a translation ofλlaterms into extended terms.

Lemma 8.For every termt, there is an extended termtwsuch thattw−−→( ) t and|tw| ≤4|t|.

(18)

Proof. By induction ont. Whent≡λx.uandF O(x, u) = 0, definetwto be λx.(let =xinuw). When t≡(let †x=v inu) and F O(x, u) = 0, define tw to belet †x=vw in(let =§xinuw). Other cases are straightforward.

Theorem 4 (Translation into the extended calculus).Lett0be a term and let t0 −→σ t1 be a reduction sequence in λla. Then there are extended terms t0, t1 and a proper reduction sequence τ such that |σ| ≤ |τ|, |t0| = O(|t0|)and

t0 −→σ t1

( )

 



( )

t0 −→τ t1.

The proof is based on permutation of reduction sequences. Each step of permutation is supported by the following two lemmas.

Lemma 9.Let t0 be an extended term. Ift0−−→( ) t1−−−−→(com) t2, then t0−−−−→(com) t1−−−−→(com) t1 −−→( ) t2

for somet1 andt1.

Proof. Letube the contractum of the first reduction (at address w0) and v be the redex of the second reduction (at address w1) in t1. One can distinguish four cases: (i)uandvare separated (w0w1andw0w1), (ii) ucontainsv(w0w1), (iii)vproperly containsu(w0w100 orw0w11), (iv) u and v overlap (w0 =w10). In the first three cases, permutation is straightforward and does not change the length of a reduction sequence. In the case (iv), we apply thepermutation rulein Figure 6(a), which says that the reduction sequence in solid line may be replaced with the other one in broken line.

Lemma 10.Let t0 be an extended term. If t0 −−→( ) t1 −−→(r) t2, where (r) is neither(com)nor( ), then

t0−−−−→(com) t1−−→(r) t1−−→( ) t2 for somet1 andt1.

Proof. As before, one can distinguish four cases, and the critical case is (iv):

two reductions overlap. In this case, use the permutation rules in Figure 6 (b) and (c).

Proof of Theorem 4.We argue step by step as follows:

(1) Ift0−→( ) t1−−−−−→ν,(com) t2, thent0 ν

,(com)

−−−−−→ t1−→( ) t2,

(19)

(a)

Ψ[let =u1in (let=u2 int)] Ψ[let=u2 int]

let=u2 inΨ[t]

let =u1 in(Ψ[let=u2 int]) let =u1 in(let=u2in Ψ[t])

( ) - pppppp

pppppp pppppp pppppp pppppp pppppp pppp

?

(com)

?

(com)

p p p p p p p(com)- ppppppppppppppppp6

( )

whereis either †xor andΨ is either (•)vor (let=inv).

(b)

(let =tin(λy.u))v (λy.u)v u[v/y]

let =tin ((λy.u)v) let =tin(u[v/y])

( )- pppppp

pp?

(com)

(β) -

p p p p p p p p p p p p p p p p p p p p p p p p p p(β) - pppppppp6( )

(c)

let †y= (let =tin †u) inv let †y=†uin v

v[u/x]

let =tin (let †y=†uinv) let =tin(v[u/x])

( )- pppppp

pppppp pppppp pppppp pppppp

pp?

(com)

?

(†)

p p p p p p p(†)- ppppppppppppp6

( )

(d)

(let!x=!tin(λy.u))v (λy.u[t/x])v u[t/x][v/y]

let!x=!tin(λy.u)v let!x=!tinu[v/y] u[v/y][t/x] -

(!)

pppppp pppp

?

(com)

-

(β)

p p p p p p p(β)- p p p p p p p p p p p p(!) -

Fig. 6.Permutation Rules

参照

関連したドキュメント

In [7, 8] the question on the well-posedness of linear boundary value problem for systems of functional differential equations is studied.. Theorem 1.3 can also be derived as

The main difference between classical and intuitionistic (propositional) systems is the implication right rule, where the intuitionistic restriction is that the right-hand side

Next we shall prove Lemma 3.. Then G=F' follows from Proposition 1. This completes the proof of Lemma 3. Let us consider the exact sequence.. r\

In this section we outline the construction of an algebraic integrable system out of non- compact Calabi–Yau threefolds, called non-compact Calabi–Yau integrable systems, and show

Here we do not consider the case where the discontinuity curve is the conic (DL), because first in [11, 13] it was proved that discontinuous piecewise linear differential

This paper presents new results on the bifurcation of medium and small limit cycles from the periodic orbits surrounding a cubic center or from the cubic center that have a

Inside this class, we identify a new subclass of Liouvillian integrable systems, under suitable conditions such Liouvillian integrable systems can have at most one limit cycle, and

In this chapter, we shall introduce light affine phase semantics, which is meant to be a sound and complete semantics for ILAL, and show the finite model property for ILAL.. As