32

BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

BETA-REDUCTION AS UNIFICATION

(Preliminary Draft)

A.J. Kfoury�

Department of Computer Science

Boston University

Boston, MA 02215, U.S.A.

July 8, 1996

Contents

1 Introduction 2

2 A Uni�cation Problem 3

3 Typability in the System of Intersection Types 8

4 Transformation of Constraint Sets 13

5 Invariant Properties of Transformation Rules 19

6 A Useful Generalization of Beta-Reduction 23

7 Beta-Reduction as Uni�cation 26

�Partly supported by NSF grant CCR{9417382.

1

Page 2: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

1 Introduction

It is certainly possible to de�ne a uni�cation problem U with the property that, given a �-term

M , we can derive an instance � of U from M such that if � has a solution then M is �-strongly

normalizable. For example, U can be standard �rst-order uni�cation 1UP, and � the set of �rst-

order constraints (M) characterizing the typability of M in the simply-typed �-calculus: If (M)

has a solution, then M is simply-typable and, a fortiori, �-strongly normalizable. But, of course,

the converse is not true: IfM is �-strongly normalizable, (M) does not necessarily have a solution.

Our �rst task is this: The de�nition of a uni�cation problem UP with the property that, given

a �-term M , we can derive an instance �(M) of UP fromM such that �(M) has a solution if and

only if M is �-strongly normalizable. There is a type discipline for pure �-terms that characterizes

�-strong normalization; this is the system of intersection types (without a \top" type that can be

assigned to every �-term). In this report, we use a lean version of the usual system of intersection

types, which we call �!;^. Hence, UP is also an appropriate uni�cation problem to characterize

typability of �-terms in �!;^. Quite apart from the new light it sheds on �-reduction, such an

analysis turns out to have several other bene�ts.

2 A Uni�cation Problem

We de�ne a uni�cation problem, here called UP, which gives an appropriate algebraic characteriza-

tion of �-strong normalization. The result is proved in Section 3 and again, di�erently, in Section 7.

Formally, TVar = f�ipj i 2 P[f"g; p 2 P+g is the set of type variables, and ^-Var = fdp j p 2 P

+g

is the set of ^-variables.

De�nition 2.1 (types) The set of types T is a proper subset of the usual intersection types over

one type constant, denoted �, de�ned inductively:

1. � 2 T!.

2. If � 2 T! [ T^ and � 2 T! then (� ! �) 2 T!.

3. If �1; : : : ; �n 2 T! and n > 2 then (�1 ^ � � � ^ �n) 2 T

^.

Let T = T! [ T^.

De�nition 2.2 (type schemes over TVar and ^-Var) Let A � ^-Var and B � TVar. By si-

multaneous induction we de�ne three disjoint sets of type schemes over A and B, namely T!(A;B),

T^(A;B) and T�(A;B):

2

Page 3: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

1. f�g [B � T!(A;B).

2. If � 2 T!(A;B) [ T^(A;B) [ T�(A;B) and � 2 T!(A;B) then (� ! �) 2 T !.

3. If �1; : : : ; �n 2 T!(A;B) [ T�(A;B) and n > 2 then (�1 ^ � � � ^ �n) 2 T

^(A;B).

4. If � 2 T!(A;B) [ T�(A;B) and d 2 A then d� 2 T�(A;B).

The set of type schemes over A and B is T(A;B) = T!(A;B)[T^(A;B)[T�(A;B). A particular

case is A = ^-Var and B = TVar, for which we de�ne:

T ! = T!(^-Var;TVar) and T ^ = T

^(^-Var;TVar) and T � = T�(^-Var;TVar)

Let T = T ! [T ^ [T �. For � 2 T , we denote the set of type variables occurring in � by TVar(�),

and the set of ^-variables by ^-Var(�). We identify appropriate subsets of T = T(^-Var;TVar):

T(^-Var) = T(^-Var;?) = f � 2 T j TVar(�) = ? g

T(TVar) = T(?;TVar) = f � 2 T j ^-Var(�) = ? g

Consistent with this notation, T = T(?;?).

Conventions 2.3

1. Parentheses are omitted in formal type expressions whenever convenient, provided no ambi-

guity is introduced:

(a) As usual, �1 ! �2 ! �3 is shorthand for (�1 ! (�2 ! �3)).

(b) ^ binds more strongly than !, so that �1 ^ �2 ! �3 is shorthand for (�1 ^ �2)! �3, not

�1 ^ (�2 ! �3).

2. Viewing ^ as a binary constructor, other studies take it commutative and associative, and

sometimes also idempotent. Here, ^ is only associative, and neither commutative nor idem-

potent.

3. ^-variables distribute over ^, but not!, i.e. we take d(�1^�2) as shorthand for d�1^d�2. With

this convention we can restrict �1; : : : ; �n in clause 3 (resp. � in clause 4) of De�nition 2.2 to

be in the subset T ! [ T � rather than in the full set T .

4. �1 � �2 means \�1 and �2 are syntactically identical" modulo the preceding conventions.

3

Page 4: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

Convention 2 above becomes important when we later construct a solution for a set of constraints:

We will need to keep track of which ^-component in a type scheme � 2 T ^ corresponds to which

^-component in another type scheme � 2 T ^. Convention 3 is not essential but allows several

de�nitions to be written more compactly and clearly (see Remark 2.9, De�nitions 4.2 and 4.3).

De�nitions 2.4 and 2.5 introduce appropriate restrictions satis�ed by type schemes derived from

�-terms (Section 3).

De�nition 2.4 (^-contexts) The set of ^-contexts is C = (^-Var)�. Every ^-context c is there-

fore a sequence dp1dp

2� � � dp

n

of ^-variables, for some n > 0 . We de�ne a function ^-context from

(TVar [ ^-Var) � T to �nite subsets of C. First de�ne ^-context(�; �) for every � 2 TVar and

� 2 T , by induction:

1. ^-context(�;�) = ? and ^-context(�; �) =

(f"g; if � � �,?; if � 6� �.

2. ^-context(�; � ! �) = ^-context(�; �) [ ^-context(�; �).

3. ^-context(�; �1 ^ � � � ^ �n) = ^-context(�; �1) [ � � � [ ^-context(�; �n).

4. ^-context(�; d�) = fdc j c 2 ^-context(�; �)g.

We next de�ne ^-context(d; �) for every d 2 ^-Var and � 2 T , by induction:

1. ^-context(d;�) = ? and ^-context(d; �) = ?.

2. ^-context(d; � ! �) = ^-context(d; �) [ ^-context(d; �).

3. ^-context(d; �1 ^ � � � ^ �n) = ^-context(d; �1) [ � � � [ ^-context(d; �n).

4. ^-context(d; d0�) =

(fd0c j c 2 ^-context(d; �)g; if d 6� d0,f"g [ fd0c j c 2 ^-context(d; �)g; if d � d0.

De�nition 2.5 (well-behaved type schemes) A type scheme � 2 T is well-behaved if it satis-

�es 4 conditions:

1. For every � 2 TVar(�), ^-context(�; �) is a singleton set.

2. For every d 2 ^-Var(�), ^-context(d; �) is a singleton set.

3. For all �ip; �j

q2 TVar(�), if p 6= q then neither p nor q is a pre�x of the other.

4. For all dp; dq 2 ^-Var(�), if p 6= q then neither p nor q is a pre�x of the other.

4

Page 5: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

In words, conditions 1 and 2 require that the ^-context of every type variable and the ^-context

of every ^-variable be uniquely de�ned. None of these 4 conditions is implied by the others. This

is clear for conditions 3 and 4. The next example shows the independence of conditions 1 and 2.

Example 2.6 Let � � dd0�^d0�0 ! �. Then ^-context(�; �) = fdd0g, ^-context(�0; �) = fd0g and

^-context(�; �) = f"g. Thus � satis�es condition 1 in De�nition 2.5, but does not satisfy condition

2, because ^-context(d0; �) = f"; dg. Now let � � � ^ d� ^ dd0� ! �. Then ^-context(d; �) = f"g

and ^-context(d0; �) = fdg, which implies that � satis�es condition 2 in De�nition 2.5. But � does

not satisfy condition 1, because ^-context(�; �) = f"; d; dd0g.

De�nition 2.7 (renaming functions) A renaming function f has two disjoint parts: an injec-

tion from TVar to TVar, and an injection from ^-Var to ^-Var, extended by induction on T to

f : T ! T . A particular kind of renaming functions is now de�ned, others are considered later.

For every j 2 P, de�ne the renaming function h ij : T ! T , by induction:

1. h�ij = � and h�ipij = �i

p;j.

2. h� ! �ij = h�ij ! h�ij .

3. h�1 ^ � � � ^ �nij = h�1ij ^ � � � ^ h�nij .

4. hdp �ij = dp;j h�ij .

De�nition 2.8 (valuations of ^-Var) A valuation ' of ^-variables is a map ' : ^-Var! P such

that '(d) = 1 for almost all d 2 ^-Var. Such a valuation is extended to ' : T(^-Var;TVar) !

T(TVar) by induction on T = T(^-Var;TVar):

1. '(�) = � and '(�) = �.

2. '(� ! �) = '(�)! '(�).

3. '(�1 ^ � � � ^ �n) = '(�1) ^ � � � ^ '(�n).

4. '(d�) = '(h�i1) ^ � � � ^ '(h�i'(d)).

Remark 2.9 Keep in mind that ^-variables distribute over ^ (3 in Conventions 2.3), e.g. d(�1^�2)

is shorthand for d�1 ^ d�2. If this were not the case, and say '(d) = 2, we would have:

'(d(�1 ^ �2)) = �1;1 ^ �2;1 ^ �1;2 ^ �2;2 6= �1;1 ^ �1;2 ^ �2;1 ^ �2;2 = '(d�1 ^ d�2)

The inequality is a consequence of the non-commutativity of ^ (2 in Conventions 2.3). It is certainly

possible to relax or altogether omit these conventions, but then some of the later de�nitions become

more complicated to formulate.

5

Page 6: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

De�nition 2.10 (valuations of TVar) A valuation of type variables (a \substitution") is a

total function : TVar! T! such that (�) = � for almost all � 2 TVar, extended in the usual

way to : T(TVar)! T by induction on T(TVar):

1. (�) = �.

2. (� ! �) = (�)! (�).

3. (�1 ^ � � � ^ �n) = (�1) ^ � � � ^ (�n).

Note that the range of is restricted to T!, a proper subset of T. Without this restriction, several

things go awry later (see, in particular, Example 4.7).

Lemma 2.11

1. If � 2 T is well-behaved, then so is h�ij, for every j 2 P.

2. If � 2 T is well-behaved and ' : ^-Var! P, then '(�) is well-behaved.

Proof: Part 1 is clear from De�nitions 2.5 and 2.7. A formal proof is by induction on T . Part 2

is by induction on T , using part 1 also.

De�nition 2.12 (uni�cation instances of UP) A constraint is an equation of the form � = �

where �; � 2 T . The constraint � = � is well-behaved if the type scheme � ^ � is well-behaved. An

instance � of UP is a well-behaved �nite set of constraints, i.e.

� = f�1 = �1; �2 = �2; : : : ; �n = �ng

such that the type scheme �1 ^ �1^�2^ �2^ � � � ^�n^ �n is well-behaved. A solution for � is a pair

('; ) where ' : ^-Var ! P (a valuation for ^-Var) and : TVar ! T! (a valuation for TVar),

such that ('(�i)) � ('(�i)) for i = 1; : : : ; n, in which case we write ('; ) j= �. A particular

case is � = ?, the empty set of constraints, which always has a solution.

Sometimes we say ' : ^-Var ! P is a solution of �, and simply write ' j= �, if there is a

valuation : TVar! T! (in general not unique) such that ('; ) j= �.

Notions and functions de�ned earlier in this section for type schemes are extended to constraint

sets in the obvious way. For example, if � is the constraint set above, then

TVar(�) = TVar(�1 ^ �1 ^ � � � ^ �n ^ �n)

The sets ^-Var(�), ^-context(�;�), ^-context(d;�), etc., are de�ned similarly.

6

Page 7: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

3 Typability in the System of Intersection Types

The two conditions in the next de�nition are standard in the literature, whenever constraints are

formulated in relation to typability of �-terms in a type inference system.

De�nition 3.1 (well-named �-terms) A �-term M 2 � is well-named if it satis�es two condi-

tions:

1. No variable in M has more than one binding occurrence.

2. The bound and free variables in M are disjoint sets.

Lemma 3.2 For every �-term M 2 �, we can e�ectively de�ne a well-named �-term N 2 � such

that M �� N .

Proof: By induction on the de�nition of M .

Let M 2 �. Formally, the set of �-variables is �-Var = fxi j i 2 Pg. For the same variable

xi, the occurrences of xi (free or bound but not binding) in M are uniquely identi�ed by their

occurrence numbers, as

x(j1)i ; x

(j2)i ; : : : ; x

(jn)i

for some n > 0 and j1; j2; : : : ; jn 2 P. Subscripts are part of the variable name, superscripts are

not. For simplicity of notation, we often assign occurrence numbers consecutively, starting with 1,

as M is scanned from left-to-right, as

x(1)i ; x

(2)i ; : : : ; x

(n)i

but our analysis is independent of this numbering scheme. All that matters is that an occurrence

of xi in M is uniquely identi�ed by an occurrence number.

We de�ne a procedure which, given a well-named �-term M , generates a �nite set �(M) of

constraints. If � is a set of constraints and d 2 ^-Var, we write d� to denote the set of constraints:

d� = fd� = d� j � = � is a constraint in �g

The constraints in �(M) do not mention the type constant �, and are written over proper subsets

of TVar and ^-Var, namely the subsets:

TVar1 = f �ji j i 2 P; j 2 P [ f"g g and ^-Var1 = f di j i 2 P g

7

Page 8: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

For a �xed i 2 P, all type variables of the form �ji correspond to �-variables xi. For convenience,

distinguish a subset TVaraux of TVar1 whose members do not correspond to �-variables in M :

TVaraux = f �i j i 2 P; xi does not occur in N g

We reserve � (possibly decorated) as a metavariable to range over TVaraux (\aux" is for \auxiliary").

For later purposes we need to generate the set of constraints �(M) with polarities inserted, i.e.

with a sign \+" or \�" inserted in front of every type variable. Polarities are bookkeeping markers,

which are not part of the syntax of type schemes.

De�nition 3.3 (procedure � to generate constraints) Simultaneously with �(M), we de�ne

a type scheme �(M) and, for the �-variable occurrence x(j)i in M , a ^-context �(i; j;M). It will

turn out that ^-context(�ji ;�(M)) = �(i; j;M). By induction on well-named �-terms:

1. Variables x(j)i :

� �(x(j)i ) = ?.

� �(x(j)i ) = (+�ji ).

� �(k; `; x(j)i ) =

("; if k = i and ` = j,?; if k 6= i or ` 6= j.

2. Applications (NP ):

� �(NP ) = �(N) [ d�(P ) [ f�(N) = d�(P )! (��)g,

for a fresh d 2 ^-Var1 and a fresh � 2 TVaraux.

� �(NP ) = (+�).

� �(k; `; (NP )) =

8><>:�(k; `;N); if �(k; `;N) 6= ?,d�(k; `; P ); if �(k; `; P ) 6= ?,?; if �(k; `;N) = �(k; `; P ) = ?.

3. Abstractions (�xi N), where the free occurrences of xi in N are x(1)i ; : : : ; x(m)i as N is scanned

from left to right, for some m > 0:

� �(�xi N) = �(N):

� �(�xi N) =

(c1(��

1i ) ^ � � � ^ cm(��

mi )! �(N); if m > 1, cj � �(i; j;N), 1 6 j 6 m,

(��i)! �(N); if m = 0.

� �(k; `; (�xi N)) =

(?; if k = i,�(k; `;N); if k 6= i.

8

Page 9: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

The process of going from M to �(M) as de�ned above is not strictly speaking a function, for

two reasons. First, subterm occurrences in M are not speci�ed to be generated in a �xed pre-

determined order. But this only a�ects the order in which auxiliary type variables from TVaraux

and ^-variables from ^-Var1 are introduced into �(M) in part 2 of the procedure, which turns out

to be a convenience for us. That is, in some of the proofs later, it is notationally convenient not to

prescribe a particular order in which members of TVaraux and ^-Var1 are introduced.

Second, occurrence numbers for the same �-variable in M are not assigned in a unique way,

e.g. they are not necessarily assigned consecutively from left to right, starting with 1. Again, this

turns out to be notationally convenient.

Lemma 3.4 For every well-named M 2 �, the set �(M) is a well-behaved set of constraints.

Proof: The proof of Lemma 5.1 establishes this fact, and more.

Example 3.5 Let M � (�f:�x:f (1) (f (2) (f (3)x))) (�g:�y:g(1) (g(2)y)). (Instead of the formal

�-variables x1, x2, x3, and x4, we use x, y, f , and g for better readability.) �(M) contains 6

constraints:

(1) d3d2(+�3f ) = d3d2(d1(+�x) ! (��1))

(2) d3(+�2f ) = d3(d2(+�1) ! (��2))

(3) (+�1f ) = d3(+�2) ! (��3)

(4) d6d5(+�2g) = d6d5(d4(+�y) ! (��4))

(5) d6(+�1g) = d6(d5(+�4) ! (��5))

(6) (��1f ) ^ d3(��

2f ) ^ d3d2(��

3f ) ! (d3d2d1(��x) ! (+�3))

= d6((��1g) ^ d5(��

2g) ! (d5d4(��y) ! (+�5))) ! (��6)

A solution (not unique) for �(M) is given by a pair ('; ) where (for convenience we write d111

instead of d1;1;1, d112 instead of d1;1;2, etc.):

� '(d) = 1 for all d 2 ^-Var� fd111; d112; d121; d122; d21; d22; d3; d6g, and

� '(d111) = '(d112) = '(d121) = '(d122) = '(d21) = '(d22) = '(d3) = 2 and '(d6) = 7.

We omit the details of , easily obtained by inspecting the constraints in '(�(M)).

9

Page 10: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

Example 3.6 Let N � (�x:x(1)x(2)) (�y:y(1)y(2)). �(N) is the following set of constraints (polar-

ities omitted in this example):

(1) �1x = d1�

2x ! �1

(2) d3�1y = d3(d2�

2y ! �2)

(3) �1x ^ d1�

2x ! �1 = d3(�

1y ^ d2�

2y ! �2)! �3

�(M) does not have a solution, corresponding to the fact that M is not typable in �!;^, by the

next theorem.

System �!;^ is our lean version of the system of intersection types. (Similar but not quite

identical restrictions of the system of intersection types are extensively studied in [8] and [9].) In

the de�nition of �!;^ below, A is a type assignment, i.e. a partial function from �-Var to T with

�nite domain of de�nition, written as a �nite list of pairs. If A and B are type assignements, then

A ^B is a new type assignment given by:

(A ^B)(x) =

8>>><>>>:?; if A(x) = B(x) = ? ,A(x); if A(x) 6= ? and B(x) = ? ,B(x); if A(x) = ? and B(x) 6= ? ,A(x) ^B(x); if A(x) 6= ? and B(x) 6= ? .

We take ^ non-commutative and non-idempotent (Conventions 2.3). Suppose there is a proof in

�!;^ for the sequent A `M : � , where M is well-named, and x is a �-variable occurring free inM .

If there are n > 1 invocations of rule VAR in this proof to derive n types for x, then

A(x) = �1 ^ �2 ^ � � � ^ �n

where �i 2 T! for i = 1; : : : ; n. If m is the number of of occurrences of x in M , then n > m.

System �!;^

VAR x : � ` x : � � 2 T!

ABS-IA; x : �1 ^ � � � ^ �n ` M : � n > 1

A ` (�x:M) : (�1 ^ � � � ^ �n ! �)

ABS-KA ` M : � � 2 T!

A ` (�x:M) : (� ! �)

APPA ` M : (�1 ^ � � � ^ �n ! �) B1 ` N : �1 ; : : : ; Bn ` N : �n n > 1

A ^B1 ^ � � � ^Bn ` (MN) : �

10

Page 11: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

Theorem 3.7 For every well-named M 2 �, M is typable in �!;^i� �(M) has a solution.

Proof: By induction on M . Details omitted in this preliminary draft.

The next result is our promised characterization of �-SN via the uni�cation problem UP.

Another proof of this result is given in Section 7 (Corollary 7.14).

Corollary 3.8 For every well-named M 2 �, M is �-SN i� �(M) has a solution.

Proof: Immediate from Theorem 3.7, using the fact that M is �-SN i� M is typable in �!;^,

proved in [5].1

Corollary 3.9 There is no algorithm which, given an arbitrary well-named M 2 �, can decide

whether the set of constraints �(M) has a solution.

Proof: Immediate from Corollary 3.8, using the fact that it is undecidable whether an arbitrary

�-term is �-SN.

Theorem 3.10 There is a semi-decision procedure which, given an arbitrary well-named M 2 �,

terminates i� the set of constraints �(M) has a solution. Moreover, if and when the procedure

terminates, it returns a solution ('; ) for �(M).

Proof: We can e�ectively generate all valuations ' : ^-Var ! P such that '(d) = 1 for almost

all d 2 ^-Var, and all valuations : TVar! T! such that (�) = � for almost all � 2 TVar. We

systematically generate all such pairs ('; ), and we stop the procedure if and when we �nd one

which is a solution for �(M).

4 Transformation of Constraint Sets

We devise another semi-decision procedure to test whether �(M) has a solution. The new procedure

(Corollary 7.17) does not return a solution ('; ) for �(M) if and when it terminates, in contrast

to the procedure of Theorem 3.10. It is possible to adjust the new procedure in such a way that

it returns a solution ('; ) for �(M) if and when it terminates, but at the cost of introducing

unnecessary complications.

De�nition 4.1 (special type schemes) The set of special type schemes is partitioned into two

disjoint sets, R and S, which are simultaneously de�ned by induction. We de�ne them here with

polarities \+" and \�" inserted:

1That M is �-SN i� M is typable in �!;^ is proved once more, in an altogether di�erent way, in Section 7

(Corollary 7.15).

11

Page 12: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

1. (+�) 2 R! and (��) 2 S!.

If � 2 TVar then (+�) 2 R! and (��) 2 S!.

2. If � 2 R� and � 2 S! then (� ! �) 2 S!.

If � 2 S! [ S^ [ S� and � 2 R! then (� ! �) 2 R!.

3. If �1; : : : ; �n 2 R! [R� and n > 2 then (�1 ^ � � � ^ �n) 2 R

^.

If �1; : : : ; �n 2 S! [ S� and n > 2 then (�1 ^ � � � ^ �n) 2 S

^.

4. If � 2 R! and d 2 ^-Var then d� 2 R�.

If � 2 R! [R� and d 2 ^-Var then d� 2 R�.

If � 2 S! [ S� and d 2 ^-Var then d� 2 S�.

Note that R� � R�. The two sets of special type schemes are:

R = R! [R^ [R� and S = S! [ S^ [ S�

We call R (resp. S) the set of positive (resp. negative) special type schemes. With polarities

omitted, R [ S is a proper subset of T . We say that type variable � occurs positively (resp.

negatively) in � 2 R [ S if � occurs as +� (resp. ��) in �. We denote by �TVar(�) the set of

type variables occurring in � with polarities inserted, and denote by TVar(�) the same set with

polarities omitted.

Although ^-variables are not preceded by a \+" or \�", we identify each with a polarity. We

say that d 2 ^-Var occurs positively (resp. negatively) in � 2 R [ S if there is � 2 R (resp. � 2 S)

such that d� occurs in �.

The new semi-decision procedure is the result of repeatedly applying transformation rules to

the set of constraints �(M), for a given well-named M 2 �.

De�nition 4.2 (local transformation rules) The local transformation rules are: !PARSE and

^PARSE. They are local because they work on one constraint at a time, without a�ecting other

constraints in a simultaneous set of constraints �.

!PARSE� [ f c(�1 ! �2) = c(�1 ! �2) g

� [ f c�1 = c�1 ; c�2 = c�2 g

where c 2 C, �1 2 S, �2 2 R!, �1 2 R

�, and �2 2 S!.

12

Page 13: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

^PARSE� [ f c1�1 ^ � � � ^ cn�n = c1�1 ^ � � � ^ cn�n g

� [ f c1�1 = c1�1 ; : : : ; cn�n = c1�n g

where c1; : : : ; cn 2 C, n > 2, �1; : : : ; �n 2 R!, and �1; : : : ; �n 2 S!. A totally equivalent but more

explicit way of writing !PARSE is this:

!PARSE� [ f c(�1;1 ^ � � � ^ �1;n ! �2) = c(�1 ! �2) g

� [ f c�1 = c�1;1 ^ � � � ^ c�1;n ; c�2 = c�2 g

where c 2 C, n > 1, �1;1; : : : ; �1;n 2 S! [ S�, �2 2 R!, �1 2 R�, and �2 2 S!. The equivalence

between the two di�erent ways of writing!PARSE follows from the fact that ^-variables distribute

over ^ (see Conventions 2.3).

De�nition 4.3 (global transformation rules) The global transformation rules are: SUBST (in

two versions), CLEAN, ALPHA and XPAND. They are global because they a�ect more than one

constraint at a time. In contrast to the local rules, they do not increase the number of constraints.

If � is a set of constraints, � 2 TVar and � 2 R!, we write �[+� := �] to denote the set of

constraints obtained by replacing every positive occurrence +� in �, if any, by �. Similarly, we

de�ne �[�� := � ] where now � 2 S!.

+SUBST� [ f c(+�) = c� g

�[�� := � ]

�SUBST� [ f c� = c(��) g

�[+� := �]

where c 2 C, � 2 TVar, � 2 R!, and � 2 S!. A use of +SUBST or �SUBST decreases the

number of constraints by one. A particular case of +SUBST is when � occurs positively but not

negatively in �; this particular case is identi�ed as +SUBST1.

+SUBST1� [ f c(+�) = c� g

�� � 62 �TVar(�)

We can similarly de�ne �SUBST1, the particular case of �SUBST when � occurs negatively but

not positively in �. If d 2 ^-Var, then d� is the constraint set:

d� = fd� = d� j � = � is a constraint in �g

13

Page 14: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

Another global transformation rule is:

CLEANd� [ �0

� [ �0d 62 ^-Var(�0)

Rules +SUBST1, �SUBST1 and CLEAN are used to \clean up" constraint sets.

Recall the notion of renaming function (De�nition 2.7), which is simultaneously an injection

from TVar to TVar and injection from ^-Var to ^-Var. The rule ALPHA renames variables in a

constraint set \without changing its meaning".

ALPHA�

f(�)f is a renaming function

We need ALPHA in order to achieve a good �t between �-reduction and uni�cation. It plays a

role on the side of uni�cation equivalent to �-conversion, which is implicit in �-reduction. (More

on this at the beginning of Section 7.)

We need one more global transformation rule, for which the notation is a bit more complicated.

Let � be a set of constraints, d 2 ^-Var and c1; : : : ; cn 2 C, for some n > 1. We write

�[d := c1 ^ � � � ^ cn]

to denote the set of constraints obtained by replacing every type scheme occurrence in � of the

form d� for some � 2 R! [R� [ S! [ S� by2

c1h�i1 ^ � � � ^ cnh�in

(� is a type scheme occurrence in � if there is a constraint � = � in � and � occurs in � or � .) In

words, we create n distinct copies of � each with a new private set of type variables and ^-variables.

XPAND\cd� = cc1�1 ^ � � � ^ ccn�n" is a constraint in �

�[d := c1 ^ � � � ^ cn]

where c; c1; : : : ; cn 2 C, n > 1, d 2 ^-Var, and � 2 R!, �1; : : : ; �n 2 S!.

A particular case of rule XPAND is when n = 1, i.e. the right-hand side of the constraint in

the premise of XPAND can be just cc1�1. In this case, in order to minimize the renaming of type

and ^-variables, we can take �[d := c1] to mean: Replace every type scheme occurrence in � of

the form d� by c1� (not by c1h�i1).

2No type scheme d� for some � 2 R^ [ S^ will occur in �. See 3 in Conventions 2.3.

14

Page 15: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

Remark 4.4 In the case n > 2 it is tempting to rede�ne the expansion [d := c1^� � � ^ cn] to mean:

Replace every type scheme occurrence in � of the form d� by c1�^ c2h�i1 ^ � � � ^ cnh�in�1. But this

rede�nition would violate conditions 3 and 4 in De�nition 2.5.

In Section 5 we prove the soundness of the transformation rules under appropriate restrictions.

In the present context this means the following: If � and �0 are constraint sets such that �0 is

obtained from � by one of the transformation rules, then � has a solution i� �0 has a solution.

In Section 7 we strengthen this result: If constraint set � has a solution, then repeated use of the

transformation rules on � produces the empty constraint set ?, which always has a solution. The

examples below illustrate some of the issues we have to deal with.

Remark 4.5 Keep in mind that, in order to use the transformation rules on a constraint set �,

polarities must be inserted. On the other hand, the question of whether � has (or does not have)

a solution does not depend on the presence of polarities.

Example 4.6 Consider the termM of Example 3.5 and the corresponding set of constraints �0 =

�(M) = f(1); : : : ; (6)g. We can transform constraint (6), using !PARSE, to obtain two new

constraints:

(7) d6((��1g) ^ d5(��

2g) ! d5d4(��y)! (+�5)) = (��1

f ) ^ d3(��2f ) ^ d3d2(��

3f )

(8) d3d2d1(��x) ! (+�3) = (��6)

The resulting constraint set is now �1 = f(1); (2); (3); (4); (5); (7); (8)g. Using XPAND relative to

constraint (7), we obtain another constraint set:

�2 = �1[d6 := " ^ d3 ^ d3d2] = f(1); (2); (3); (8); (9); (10); (11)g

The constraints containing d6, namely (4), (5) and (7), are transformed into (9), (10), and (11),

respectively (for convenience we write d51 instead of d5;1, d52 instead of d5;2, etc.):

(9) d51(+�2g1) ^ d3d52(+�

2g2) ^ d3d2d53(+�

2g3) =

d51(d41(+�y1)! (��41)) ^ d3d52(d42(+�y2)! (��42)) ^ d3d2d53(d43(+�y3)! (��43))

(10) (+�1g1) ^ d3(+�

1g2) ^ d3d2(+�

1g3) =

(d51(+�41)! (��51)) ^ d3(d52(+�42)! (��52)) ^ d3d2(d53(+�43)! (��53))

(11) ((��1g1) ^ d51(��

2g1) ! d51d41(��y1)! (+�51))^

d3((��1g1) ^ d51(��

2g1) ! d51d41(��y1)! (+�51))^

d3d2((��1g1) ^ d51(��

2g1) ! d51d41(��y1)! (+�51)) = (��1

f ) ^ d3(��2f ) ^ d3d2(��

3f )

15

Page 16: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

At this point we can use ^PARSE relative to (9), ^PARSE relative to (10), and ^PARSE relative to

(11). In each case, a single constraint is replaced by three constraints. We stop the transformation

process here, as it takes more than 50 steps to terminate. The results in Section 7 show that

transforming the initial �0 repeatedly is bound to terminate with the empty constraint set ?,

which trivially has a solution. On the other hand, using repeatedly the transformation rules on

�(N) in Example 3.6, the process does not terminate, because N is not �-SN, again by the results

in Section 7.

Example 4.7 Consider the constraint set �0:

�0 = f d(+�1) = (��2) ^ (��3); d(+�4) = (+�5)! (��6) g

�0 does not have a solution. This fact can be discovered by using the transformation rules. (The

example is easy enough so that its non-solvability can be also established by inspection.) The only

rule we can initially use on �0 is XPAND. If we use it, we obtain:

�1 = �0[d := " ^ "]

= f (+�11) ^ (+�12) = (��2) ^ (��3); (+�41) ^ (+�42) = (+�5)! (��6) g

Using ^PARSE relative to the �rst constraint in �1, followed by two uses of +SUBST, we obtain:

�2 = f (+�41) ^ (+�42) = (+�5)! (��6) g

which cannot be transformed further and does not have a solution. On the other hand, if we allow

the range of to be all of T, then it is easy to see that �0 has a solution ('; ) where '(d) = 1 for all

d 2 ^-Var. Hence, if we do not restrict the range of to the proper subset T!, our transformation

rules do not preserve the solvability of constraint sets.

Example 4.8 Consider the constraint set �0:

�0 = f +�1 = (��2) ^ (��3); +�1 = (+�4)! (��5) g

�0 does not have a solution. Nevertheless, using +SUBST twice on �0, we obtain the empty

constraint set ?, which has a solution. The anomaly illustrated by this example results from the

fact that the initial �0 is not the constraint set of any M 2 �, i.e. �0 6= �(M) for every M 2 �.

Hence, +SUBST does not preserve the non-solvability of constraint sets that do not correspond to

�-terms.

16

Page 17: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

5 Invariant Properties of Transformation Rules

The notion of well-behaved type scheme (De�nition 2.5) is still meaningful in the presence of po-

larities: If � 2 R [ S, a type scheme with polarities inserted, we say that � is well-behaved in

case � is well-behaved after all the polarities are omitted. More generally, every notion de�ned

independently of polarities is still meaningful in their presence. We now list several properties that

a constraint set � can satisfy.

(A) Every type variable � occurs at most twice in �. And if � occurs twice, it occurs

once positively as +� and once negatively as ��.

(B) Every constraint in � is one of two forms:

(B.1) c1�1 ^ � � � ^ cn�n = c1�1 ^ � � � ^ cn�n

(B.2) cd� = cc1�1 ^ � � � ^ ccn�n

where n > 1, c; c1; : : : ; cn 2 C, d 2 ^-Var, d does not occur in c1 ^ � � � ^ cn,

�; �1; : : : ; �n 2 R!, and �1; : : : ; �n 2 S

!.

The constraints in the premises of rules!PARSE, ^PARSE, +SUBST, and �SUBST, are all cases

of (B.1). The constraint in the premise of rule XPAND is a case of (B.2).

Consider a constraint of the form (B.1), resp. (B.2). Let d0 2 ^-Var. We say that d0 has

an inner occurrence in the constraint if d0 occurs in f�1; : : : ; �n; �1; : : : ; �ng, resp. if d0 occurs

in fd�; c1�1; : : : ; cn�ng. We say that d0 has an outer occurrence in the constraint if d0 occurs in

fc1; : : : ; cng, resp. if d0 occurs in fcg. In words, an \outer occurrence" must appear symmetrically

on both sides of the constraint and at the top level.

We say that d0 2 ^-Var has an inner, resp. outer, occurrence in the set of constraints � if d0

has an inner, resp. outer, occurrence in one of the constraints of �.

(C) If d 2 ^-Var occurs at all in �, then there is at most one occurrence of d in �

which is both positive and inner.

(D) If \� = �" is a constraint in �, then:

(D.1) No type variable � 2 TVar has occurrences in both � and � .

(D.2) No ^-variable d 2 ^-Var has inner occurrences in both � and � .

Lemma 5.1 If M is a well-named �-term, then �(M) is a well-behaved constraint set satisfying

properties f (A), (B), (C), (D) g.

17

Page 18: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

Proof: Straightforward, if somewhat tedious induction on M . Details omitted in this preliminary

draft.

Let � and �0 be constraint sets, and X one of the transformation rules:

X 2 f!PARSE;^PARSE;+SUBST;�SUBST;CLEAN;ALPHA;XPANDg

We write � X �0 in case �0 is obtained from � by using rule X. Note that if � X �0, then �0

is not necessarily uniquely de�ned, as X may be used relative to di�erent constraints in �. We

generalize this notation to (�nite) sequences of transformation rules. Let X = X1 � � �Xn where

X1; : : : ;Xn 2 f!PARSE;^PARSE;+SUBST;�SUBST;CLEAN;ALPHA;XPANDg

and n > 0. We de�ne � X �0 by:

� X �0 i� � � �1 X1 �2 X2 �3 � � � Xn �n+1 � �0

We generalize the notation further. Let fX1;X2; : : :g be a set of sequences of transformation rules:

fX1;X2; : : :g � f!PARSE;^PARSE;+SUBST;�SUBST;CLEAN;ALPHA;XPANDg�

We de�ne � fX1;X2; : : :g �0 by:

� fX1;X2; : : :g �0 i� � Xi �

0 for some i :

Lemma 5.2 Let � and �0 be constraint sets, and X a transformation rule in

f!PARSE;^PARSE;CLEAN;ALPHAg

such that � X �0. If � is a well-behaved constraint set satisfying properties f(A), (B), (C), (D)g,

then so is �0.

Proof: For each of the 4 rules under consideration, there are 5 parts to prove, namely that �0

satis�es the 4 properties listed and that �0 is well-behaved. This adds up to 20 separate cases.

This is a straightforward (and tedious) case analysis. The only non-trivial case (perhaps) is to show

that �0 satis�es (B) when X =!PARSE, in particular that \d does not occur in c1 ^ � � � ^ cn" (see

the formulation of (B)): For this, use the hypothesis that � satis�es not only (B) but also (D) (in

fact (D.2) su�ces).

Lemma 5.3 Let � and �0 be constraint sets, and X = �SUBST such that � X �0. If � is a

well-behaved constraint set satisfying properties f (A), (B), (C) g, then so is �0.

18

Page 19: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

Proof: It su�ces to consider X = +SUBST, as the proof for X = �SUBST is totally symmetric.

If � is well-behaved, it is easy to check that �0 is well-behaved, reviewing the 4 conditions in

De�nition 2.5. It is just as easy to check that if � satis�es property (A), then so does �0, and

likewise for properties (B) and (C).

Lemma 5.4 Let � and �0 be constraint sets such that � XPAND �0. If � is a well-behaved

constraint set satisfying properties f (A), (B), (C) g, then so is �0.

Proof: Suppose �0 = �[d := c1 ^ � � � ^ cn] and n > 2 throughout the proof. The case n = 1 is

immediate, as no renaming of variables takes place, and is therefore omitted.

If � is well-behaved, then is �0, by the 4 conditions in De�nition 2.5 (straightforward details

omitted). If � satis�es (A) and is well-behaved (only condition 3 of 2.5 matters here), then it is

easy to see that �0 satis�es (A) too.

Lemma 5.5 Let � and �0 be well-behaved constraint sets, X one of the transformation rules, and

� X �0.

Let � be a constraint set and ' : ^-Var ! P such that ' j= �. We write jTVar('(�))j to

denote the number of type variables occurring in '(�). We say ' is a minimal solution of � if

� ' j= �, and

� for every '0 j= �, we have jTVar('(�))j 6 jTVar('0(�))j.

Lemma 5.6 Let � and �0 be well-behaved constraint sets, X one of the transformation rules, and

� X �0. If ';'0 : ^-Var! P are minimal solutions of � and �0 respectively, then jTVar('(�))j >

jTVar('0(�0))j. If in addition X = �SUBST and � satis�es property (A), then jTVar('(�))j >

jTVar('0(�0))j.

For later reference, we state two easy facts about transformation rules.

Lemma 5.7 Let � and �0 be well-behaved constraint sets, and X one of the transformation rules.

1. If � CLEAN X �0 then � X CLEAN �0.

2. If � ALPHA X �0 then � X ALPHA �0.

In words, we can delay uses of CLEAN and ALPHA past other uses of transformation rules.3

3The converse of part 1 is not true in general; there are easy counterexamples. The converse of part 2 is true, butwe do not need it.

19

Page 20: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

Proof: Straightforward, if somewhat tedious, case analysis.

Lemma 5.8 Let � and �0 be well-behaved constraint sets. If � ALPHA ALPHA �0, then

� ALPHA �0. In words, consecutive uses of ALPHA can be combined into a single use of ALPHA.

Proof: The composition of two renaming functions is a renaming function.

We conclude this section with another conjecture.

Conjecture 5.9 Let M be a well-named �-term. The following are equivalent conditions:

1. �(M) has a solution.

2. Using the rules in f!PARSE;^PARSE;+SUBST;�SUBST;XPANDg repeatedly, in any or-

der, the constraint set �(M) is always transformed into the empty constraint set ?.

In Section 7 we prove a result (Corollary 7.17) which is weaker than the preceding conjecture, but

su�cient for our purposes, namely: \�(M) has a solution" is equivalent to the transformation of

�(M) into ? using the rules repeatedly in a particular order. This is the particular order speci�ed

by the ]-transformation of �(M) (De�nition 7.16).

6 A Useful Generalization of Beta-Reduction

K-redexes are the source of many interesting complications in the �-calculus. The particular com-

plication concerning us here is the di�erence they introduce between �-weak-normalization (�-WN)

and �-strong-normalization (�-SN). In the absence of K-redexes the two notions coincide. There

is a long trail of results on how to reduce �-SN to �-WN without excluding K-redexes since the

late 1960's, by Nederpelt, by Klop, and by many others in the 1980's and 1990's (see the references

in [4] and [7] for example). We tackle this question once more, not to prove a result (Theorem 6.5)

which is likely to be found in some form or other in the extensive literature, but to adapt it to our

later needs (Section 7).

Every �-term M which is not in �-nf contains a leftmost �-redex occurrence R � ((�x:P )Q).

R is uniquely identi�ed by its �-binding \�x" which occurs to the left of the �-binding of every

other, if any, �-redex occurrence in M .

Lemma 6.1 Let R � ((�x:P )Q) be a leftmost �-redex occurrence in M , and let MR�!�

N .

1. If R is a I-redex and N is �-SN, then M is �-SN.

2. If R is a K-redex and both N and Q are �-SN, then M is �-SN.

20

Page 21: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

Example 6.2 Part 2 of the preceding lemma is not true without the restriction \leftmost". Con-

sider the term

M � ( (�x: (�v:�w: vw)) I| {z }R1

) (�y: (�x:I)(y!!)| {z }R2

) (�v:�w: vw)

where I � (�z:z) and ! � (�z:zz). M contains two �-redex occurrences: R1 and R2. R1 is

leftmost-outermost, R2 is only outermost, and both are K-redexes. (A �-redex occurrence R in M

is outermost if R does not occur as a proper subterm in another �-redex occurrence inM . Leftmost

is a special case of outermost.) �-reducing R2, we get

N � ( (�x: (�v:�w: vw)) I ) (�y: I) (�v:�w: vw)

It is not the case thatM is �-SN (it is not) if N and (y!!) are �-SN (they both are). This example

also shows that relaxing the \leftmost" restriction to \outermost" is not strong enough to get part

2 of Lemma 6.1.

G�(M) is the �-reduction graph of �-term M (Section 3.1 in [1]). The set of vertices in G�(M)

is fN j M �!�!�

Ng modulo �-equivalence, i.e. if M �!�!�

N1 and M �!�!�

N2, and N1 �� N2, then

N1 and N2 refer to the same vertex. There is an edge from vertex N1 to vertex N2 in G�(M) i�

N1 �!�

N2. G�(M) is a connected graph, because every vertex N is accessible from vertex M .

De�ne

degree(M) = \number of edges in G�(M)"

The relevant fact for us is: M is �-SN i� G�(M) is a �nite dag (directed acyclic graph). In

particular, if M is �-SN then degree(M) is �nite (the converse is not true).

Lemma 6.3 Let R � ((�x:P )Q) be a leftmost �-redex occurrence in M , and let MR�!�

N .

1. If R is a I-redex and M is �-SN, then degree(M) > degree(N).

2. If R is a K-redex and M is �-SN, then degree(M) > degree(N) + degree(Q).4

De�nition 6.4 ([�]-reduction) Let M be the multiterm [M1; : : : ;M`], i.e. a �nite sequence of

�-terms (repetitions allowed), and R � ((�x:P )Q). We writeMR�![�]N to mean two conditions are

satis�ed:

1. R is a leftmost �-redex occurrence in M, i.e. there is k 2 f1; : : : ; `g such that R is leftmost

in Mk and M1; : : : ;Mk�1 are all in �-nf.

4Lemma 6.3 is probably true without the restriction \leftmost" on R, but we do not need such a result.

21

Page 22: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

2. If MkR�!�

N , then N =

([M1; : : : ;Mk�1; N;Mk+1; : : : ;M`]; if R is a I-redex,[M1; : : : ;Mk�1; N;Q;Mk+1; : : : ;M`]; if R is a K-redex.

We writeM �![�]N, pronounced \multitermM beta-reduces to multiterm N", if there is a leftmost

�-redex occurrence R in M such that MR�![�]N.

Strictly speaking, the relation [�] is not a \notion of reduction" in the sense of Section 3.1 in [1],

because it relates two multiterms (rather than two terms). Nevertheless, [�]-reduction generalizes

�-reduction not only in the sense that (1) it relates two multiterms rather than two terms, but also

in the sense that (2) it does not discard arguments of K-redexes after their reduction.

Theorem 6.5 For every M 2 �, M is �-SN i� [M ] is [�]-normalizing.

Proof: There are two inductions in this proof, and to push them through, prove a more general

result, namely, for every multiterm M, the following are equivalent:

(a) Every M 2M is �-SN.

(b) M is [�]-SN.

(c) M is [�]-normalizing.

First prove (a) implies (b). Generalize the notion of �-reduction graph to every multiterm M, by

de�ning G�(M) asSfG�(M) j M 2Mg (this is multiset union). UnlessM contains only one term

(or no terms at all), G�(M) is a disconnected graph, with one component for every member of M

and with the same multiplicity. De�ne

degree(M) =X

f degree(M) j M 2M g

(this counts degree(M) as many times as there are copies of M inM). Now, every M 2M is �-SN

i� G�(M) is a �nite dag.

The proof that (a) implies (b) is by induction on degree(M) > 0. If degree(M) = 0 then every

M 2 M is in �-nf, so that M is also [�]-SN. Assume the result true for every multiterm M such

that every M 2M is �-SN and such that degree(M) 6 n. Consider a �xed, but otherwise arbitrary

M, such that every M 2M is �-SN and such that degree(M) = n+1. We want to show that every

[�]-reduction sequence � starting fromM terminates. Consider the �rst step of such a sequence �,

say M �![�]N. Reviewing De�nition 6.4, it is easy to see that if every M 2 M is �-SN then so is

every N 2 N and, by Lemma 6.3, that degree(N) 6 n. Hence, by the induction hypothesis, N is

[�]-SN, which in turn implies the sequence � terminates.

22

Page 23: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

The proof that (b) implies (c) is immediate.

The proof that (c) implies (a) is by induction on the length of [�]-normalizing sequences. Con-

sider a [�]-normalizing sequence from a multiterm M:

M0 =M �![�]

M1 �![�]

M2 �![�]

� � � �![�]

Mn

where Mn is in [�]-nf, so that every M 2Mn is in �-nf. If n = 0, then M0 =Mn and the desired

conclusion is immediate. Assume the result true for every [�]-normalizing sequence of length n 2 N,

and prove it for an an arbitrary [�]-normalizing sequence of length n+ 1, using Lemma 6.1.

7 Beta-Reduction as Uni�cation

Let M 2 � and R � ((�x:P )Q) a �-redex occurrence in M , i.e. M � C[R] where C[ ] is a context

with a single hole. In general, we need to �-convert R before �-reducing it, in order to avoid capture

of free variable occurrences in Q by �-bindings in P . The necessary �-conversion can in fact be

restricted to P , so that if MR�!�

N we can write:

N � C[P 0[x := Q]] where P 0 �� P :

Neither C nor Q are �-converted. For the correspondence to be established in this section, we need

to spell out exactly where �-conversion takes place.

If M is well-named to start with, no �-conversion is necessary at all to avoid capture of free

variables. In this case, if we take N � C[P [x := Q]] (no �-conversion in C, P , or Q) thenMR�!�N

is a valid �-reduction. However, the resulting N is not necessarily well-named, and the problem of

free-variable capture may be encountered later, if we �-reduce N again. Consider for example the

well-named �-term M � (�x:xx)(�y:�z:yz). Without �-conversion:

M �!�

N � (�y:�z:yz)(�y:�z:yz) �!�

N1 � �z:(�y:�z:yz)z �!�

N2 � �z:�z:zz

None of N , N1 and N2 is well-named and the reduction from N1 to N2 is not valid. The usual

practice is to �-convert whenever necessary only, which we can call lazy �-conversion. We do not

need to �-convert N (and therefore do not, according to lazy �-conversion), and only �-convert N1

to, say, N 0

1 � �z:(�y:�z0:yz0)z before �-reducing it. The resulting reduction sequence is now valid:

M �!�

N � (�y:�z:yz)(�y:�z:yz) �!�

N 0

1 � �z:(�y:�z0:yz0)z �!�

N 0

2 � �z0:�z:zz0

Our practice here will be di�erent, which we can call eager �-conversion. We prevent the problem

at an earlier stage: Every �-reduct is �-converted to a well-named �-term before it is �-reduced

23

Page 24: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

again, whether or not capture of free variables occurs. For the preceding example, we have the

following reduction sequence according to this convention:

M �!�

eN � (�y:�z:yz)(�y0:�z0:y0z0) �!�

eN1 � �z:(�y0:�z0:y0z0)z �!�

eN2 � �z:�z0:zz0

Each of eN , eN1, and eN2, is well-named. For our purposes, we need to restrict this convention further.

Convention 7.1 Let M be a well-named �-term, R � ((�x:P )Q) a �-redex occurrence inM , and

M � C[R] where C[ ] is a context with a single hole. Write R as

R � ((�x:P [x(1); x(2); : : : ; x(n)])Q)

explicitly listing the n > 0 bound occurrences of x. In this notation, P is a context with exactly n

holes, which does not mention x anywhere else. We spell out conditions under which the �-reduction

of R in M produces another well-named �-term N . We write MR�!�

N provided:5

a. Either n 6 1 and N � C[P [Q]], with no �-conversion allowed in C, P , or Q.

b. Or n > 2 and N � C[P [Q1; : : : ; Qn]] where:

{ Q �� Q1 �� � � � �� Qn,

{ Q1Q2 � � �Qn is a well-named �-term,

{ the bound �-variables in Q1Q2 � � �Qn are fresh, i.e. do not occur in C[P [ ; : : : ; ]].

These conditions guarantee both that MR�!�

N is a valid �-reduction and that N is well-named.

If n > 2, note that we restrict �-conversion to the argument Q: Neither C nor P are �-converted.6

De�nition 7.2 ([�]-reduction revisited) We adjust [�]-reduction according to the preceding

convention. The multiterm M = [M1; : : : ;M`] is well-named if the single �-term xM1 � � �M` is

well-named, where x appears nowhere in M.7 Let R � ((�x:P )Q) be a �-redex occurrence in M,

i.e. Mk � C[R] for some k 2 f1; : : : ; `g where C[ ] is a context with a single hole. Adopting the

notation of De�nition 6.4 and Convention 7.1, we write MR�![�]N if the two conditions of 6.4 are

satis�ed in addition to:

5It is possible to merge the two cases, n 6 1 and n > 2, by requiring that N � C[P [Q;Q1; : : : ; Qn�1]]. But theresulting indexing would complicate some of the bookkeeping later (e.g. in the proof of Lemma 7.7), partly becauseit would con ict with the conventions for the XPAND rule (see Remark 4.4).

6So, in eager �-conversion, C and P are not �-converted; only if n > 2 do we �-convert Q, whether or not captureof free variables occurs. By contrast, in lazy �-conversion, C and Q are not �-converted; and only if capture of freevariables occurs do we �-convert P .

7We can equivalently require that the single �-term M1 � � �M` be well-named.

24

Page 25: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

3. Conditions a and b of 7.1 are satis�ed.

Moreover, if occurrence numbers are inserted (which we need when we use procedure �, De�ni-

tion 7.3 below) we further stipulate:

4. The reduction MR�![�]N does not change occurrence numbers in:

� M1; : : : ;Mk�1;Mk+1; : : : ;M`.

� C[(�x:P [ ; : : : ; ])[ ]], i.e. they remain the same in C[P [ ; : : : ; ]] after the reduction.

� Q, if n 6 1.

MR�![�]N introduces fresh occurrence numbers only in Q1; : : : ; Qn and only if n > 2.

Names of type variables in the constraint set �(M) depend on names of �-variables and their

occurrence numbers in M. Conditions 3 and 4 above are imposed on the [�]-reduction MR�![�]N

in order to regulate and minimize the process of variable-renaming in going from �(M) to �(N).

De�nition 7.3 (� revisited) We extend the procedure � (De�nition 3.3) to well-named multi-

terms. IfM = [M1; : : : ;M`] is a well-named multiterm, we �rst assign a unique occurrence number

to every �-variable occurrence in M, free or bound (but not binding), and then de�ne �(M) by:

�(M) = �(M1) [ � � � [ �(M`)

�(M) induces 2 other constraint sets: �a(M) and �b(M). For the de�nition of �a(M), recall the

special case +SUBST1 of +SUBST (De�nition 4.3): It deletes constraints of the form c(+�) = c� .

�a(M) is the constraint set �2 such that:

1. �1 = �(M).

2. �1 f+SUBST1;CLEANg� �2.

3. �2 cannot be transformed further using +SUBST1 or CLEAN,

i.e. �2 is in f+SUBST1;CLEANg-normal form.

In clause 2, we can write �1 f+SUBST1g�fCLEANg� �2 instead, by Lemma 5.7 part 1.8 It is

easy to see that �a(M) is uniquely de�ned, i.e. it is independent of the order in which we delete

constraints in �(M) using +SUBST1 or cross out outermost ^-variables using CLEAN. �b(M) is

a subset of �a(M):

�b(M) = �a(M) \ f c(�1 ! �2) = c(�1 ! �2) j c 2 C; �1 2 S; �2 2 R!; �1 2 R

�; �2 2 S! g

8+SUBST1 and CLEAN do not commute in general.

25

Page 26: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

In words, �b(M) is the subset of �a(M) consisting of all the constraints to which we can apply the

transformation rule !PARSE.

Lemma 7.4 Let M be a well-named multiterm. The number of �-redex occurrences in M is pre-

cisely the number of constraints in �b(M). In particular, M is in [�]-nf i� �b(M) = ?.

Proof: It su�ces to prove it for the case of a single term M , i.e. when M = [M ]. The proof

is a straightforward induction on M . Note that because of the naming convention for well-named

terms and well-named multiterms, every �-redex in M occurs exactly once.

Lemma 7.5 If M is a well-named multiterm, then M is in [�]-nf if and only if �a(M) = ?.

De�nition 7.6 (sharp-reduction) This reduction relation is only de�ned between constraint sets

corresponding to well-named multiterms. Given constraint sets �1 and �2, we write �1 �!]

�2

(\�1 sharp-reduces to �2") i� there are well-named multiterms M1 and M2 such that:

1. �1 = �a(M1) and �2 = �a(M2).

2. There is a �-redex occurrence R in M1 such that M1R�![�]M2. (By the de�nition of [�]-

reduction, De�nitions 6.4 and 7.2, R is necessarily leftmost in M1.)

We say that � is in ]-nf i� there is a well-named multiterm M such that � = �a(M) and M is in

[�]-nf. By Lemma 7.5, this means � is in ]-nf i� � = ?.

Lemma 7.7 Let �1 and �2 be constraint sets such that �1 �!]

�2. This single ]-reduction step

can be decomposed into a �nite sequence of the transformation rules | in this order:

{ one use of !PARSE,

{ one use of XPAND,

{ zero or more uses of ^PARSE,

{ one or more uses of �SUBST,

{ one use of ALPHA.

Lemma 7.7 gives a precise meaning to the title of this section and the entire report:

BETA-REDUCTION AS UNIFICATION

26

Page 27: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

A single [�]-reduction step from M1 to M2 corresponds to a �nite sequence of uni�cation steps in

f!PARSEgfXPANDgf^PARSEg�f�SUBSTg+

from �1 to �2. (We ignore the last use of ALPHA in Lemma 7.7, as it is only a renaming of

variables.) This correspondence works just �ne if �1 = �a(M1) and �2 = �a(M2), but not if

�1 = �(M1) and �2 = �(M2). The next example illustrates the complication, had we taken

instead �1 = �(M1) and �2 = �(M2). The source of the problem are the K-redexes, which were

also the reason in Section 6 for the generalization of �-reduction to a relation between multiterms

(rather than between terms only).

Example 7.8 Consider the �-term M � v(�w:(�x:w(1)y)w(2)). The leftmost (and only) �-redex

in M is R � (�x:w(1)y)w(2). If we set M1 � [M ] and [�]-reduce R, we obtain:

M1 � [M ]R�![�]

M2 � [ v(�w:w(1)y) ; w(2) ]

Using � instead of �a, the corresponding constraint sets are:9

�1 = �(M1)

= f d3(+�1w) = d3(d1(+�y)! (��1)); d3((��x)! (+�1)) = d3(d2(+�

2w)! (��2));

(+�v) = d3((��1w) ^ d2(��

2w)! (+�2))! (��3) g

�2 = �(M2)

= f d3(+�1w) = d3(d1(+�y)! (��1)); (+�v) = d3((��

1w)! (+�1))! (��3) g

No matter how we use the transformation rules, it is not possible to transform �1 into �2. The

reason is this: �2 does not mention �2w, whereas �1 does, in its second and third constraints. To

reach �2 from �1, using the transformation rules, we have to eliminate �2w somehow. We can

eliminate �2w by using !PARSE relative to the second constraint in �1, followed by XPAND to

carry out the expansion [d2 := "], followed by �SUBST twice to eliminate �2w (and �2) | but then

there will remain an �x which we cannot eliminate. This happens only because R is a K-redex. On

the other hand, using �a instead of �:

f�1 = �a(M1) = f (��x)! (+�1) = d2(+�2w)! (��2) g

and f�2 = �a(M2) = ?. Now, f�1 can be transformed into f�2 = ?, by using !PARSE �rst,

followed by XPAND, followed by �SUBST twice.

9According to De�nition 3.3 we have freedom in choosing the order in which ^-variables from ^-Var1 and typevariables from TVaraux are introduced by �.

27

Page 28: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

If we replace y by x in M , we obtain M 0 � v(�w:(�x:w(1)x)w(2)), where R0 � (�x:w(1)x)w(2) is

now an I-redex. We then have

M0

1 � [M 0]R0

�![�]

M0

2 � [ v(�w:w(1)w(2)) ]

and the corresponding constraint sets are | again using � not �a:

�0

1 = �(M0

1)

= f d3(+�1w) = d3(d1(+�x)! (��1)); d3(d1(��x)! (+�1)) = d3(d2(+�

2w)! (��2));

(+�v) = d3((��1w) ^ d2(��

2w)! (+�2))! (��3) g

�0

2 = �(M0

2)

= f d3(+�1w) = d3(d1(+�

2w)! (��1)); (+�v) = d3((��

1w) ^ d1(��

2w)! (+�1))! (��3) g

If we use !PARSE, followed by XPAND, followed by �SUBST twice, it is easy to check that

�0

1 can be transformed into �0

2. Note that this sequence of transformation rules is one given by

the conclusion of Lemma 7.7 (we can always append a dummy use of ALPHA at the end of the

transformation sequence, to perform the identity renaming). This is an example of a more general

situation, in the remark below.

Remark 7.9 Let M1 and M2 be well-named �I-terms. (There is no need to consider multiterms

when we restrict our attention to �I-terms | see De�nition 6.4.) Let �1 = �(M1) and �2 = �(M2).

Write �1 �![

�2 if there is a �-redex occurrence R in M1 such that M1R�!�

M2 (R not necessarily

leftmost) . We say that � is in [-nf i� there is a well-named �I-term M such that � = �(M)

and M is in �-nf, but now, in constrast to a constraint set in ]-nf, it is not necessarily the case

that � = ?. The interesting fact is that Lemma 7.7, with \]" replaced by \[" throughout, still

holds. We do not pursue this line of investigation further, because it would limit the �nal results

to �I-terms, even though it would also simplify our entire analysis and make it more perspicuous.

Lemma 7.10 If �1 and �2 are constraint sets such that �1 �!]

�2, then �1 has a solution i�

�2 has a solution.

Proof: Immediate consequence of Lemmas 5.5 and 7.7.

Lemma 7.11 If �1 and �2 are constraint sets such that �1 �!]

�2, and 'i is a minimal solution

of �i for i = 1; 2, then jTVar('1(�1))j > jTVar('2(�2))j.

Proof: Immediate consequence of Lemmas 5.6 and 7.7.

28

Page 29: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

Lemma 7.12 Let M be a well-named multiterm and � = �a(M). Then � is ]-normalizing i� �

has a solution.

Proof: The left-to-right implication is an immediate consequence of (the right-to-left implication

in) Lemma 7.10, what it means for � to be in ]-nf, and by Lemma 7.5 (which implies that � is in

]-nf i� � = ?). The empty constraint set ? always has a solution.

For the converse, assume � = �1 has a solution and �1 is not in ]-nf. Consider a ]-reduction

sequence from �1:

�1 �!]

�2 �!]

�3 �!]

� � �

By Lemma 7.10 (the left-to-right implication), �k has a solution, for every k > 1. Let 'k be a

minimal solution of �k. By Lemma 7.11,

jTVar('1(�1))j > jTVar('2(�2))j > jTVar('3(�3))j > � � �

Hence, for some k > 1, it must be that jTVar('k(�k))j = 0. Because the type constant � occurs

nowhere in �1, and therefore nowhere in �k, this implies �k = ? and �1 is ]-normalizing.

Theorem 7.13 LetM be a well-named multiterm. Then M is [�]-normalizing if and only if �(M)

has a solution.

Proof: We prove the following are equivalent conditions:

1. M is [�]-normalizing.

2. �a(M) is ]-normalizing.

3. �a(M) has a solution.

4. �(M) has a solution.

By De�nition 7.6, we have (1) i� (2). By Lemma 7.12, we have (2) i� (3). By Lemma 5.5, we have

(3) i� (4).

Corollary 7.14 is, once again, our characterization of �-SN via the uni�cation problem UP.

(Corollary 3.8 gives a di�erent proof of this characterization.)

Corollary 7.14 For every well-named M 2 �, M is �-SN i� �(M) has a solution.

Proof: By Theorem 6.5, M is �-SN i� [M ] is [�]-normalizing i�, by Theorem 7.13, �(M) has a

solution.

29

Page 30: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

Corollary 7.15 For every well-named M 2 �, M is �-SN i� M is typable in the system �!;^.

Proof: Immediate from Theorem 3.7 and Corollary 7.14.

Variations of the equivalence in Corollary 7.15 are well-known in the literature (see [2], [3], and

the references cited therein); these are \variations" because they use formulations of the system of

intersection types that are somewhat di�erent from our �!;^. One particular feature of the proof

of 7.15 here is that it does not use an argument based on the method of \candidats de r�eductibilit�e"

(or a weaker variant, such as the \realizability" method). This is not the only such proof: Several

recent reports prove that typability in �!;^ (or in minor variations of it) characterizes the class of

�-terms that are �-SN, by methods totally unrelated to \candidats de r�eductibilit�e", e.g. [3], [5]

and [6].

De�nition 7.16 (]-transformation) The ]-transformation of a constraint set � is de�ned only

if � = �(M) for some well-named �-term M . It is a particular sequence of transformation rules in

f+SUBST1g� (f!PARSEgfXPANDgf^PARSEg�f�SUBSTg+)1

induced by the ]-reduction sequence that starts from �(M). We make this notion precise. Let M

be a well-named multiterm and consider a [�]-reduction sequence starting from M:

M �M1R1�![�]

M2R2�![�]

M3R3�![�]

� � �

This [�]-reduction sequence is uniquely de�ned, because Ri is the unique leftmost �-redex occur-

rence in Mi, for i = 1; 2; 3; : : : . Hence, if �i = �a(Mi), the ]-reduction sequence

�1 �!]

�2 �!]

�3 �!]

� � �

is also uniquely de�ned. Starting from M = [M ] where M is a well-named �-term, we therefore

have a uniquely de�ned transformation sequence:

�(M) X �1 Y1 �2 Y2 �3 Y3 � � �

where X 2 f+SUBST1;CLEANg� by De�nition 7.3, and

Yi 2 f!PARSEgfXPANDgf^PARSEg�f�SUBSTg+fALPHAg

by Lemma 7.7, for i = 1; 2; 3; : : : . Let bX be the subsequence of X where all CLEAN's are omitted,

and bYi the pre�x of Yi where the last ALPHA is omitted, resulting in the following commutative

diagram of transformations:

30

Page 31: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

?

b�2b�1

b�3�(M)

�1

bX

? ?

�3�2

bY1bY2

bY3 � � �

Y1 Y2 Y3 � � �

where every downward arrow is a sequence in fCLEANg�fALPHAg. The correctness of this dia-

gram follows from Lemmas 5.7 and 5.8, according to which:

1. Every use of CLEAN can be displaced after a use of another transformation rule.

2. Every use of ALPHA can be displaced after a use of another transformation rule.

3. Consecutive uses of ALPHA can be replaced by a single use of ALPHA.

We call the ]-transformation of �(M) the uniquely de�ned sequence Z = bX bY1bY2

bY3 � � � which

makes the preceding diagram commute. If the [�]-reduction sequence from [M ] (or, equivalently,

the ]-reduction sequence from �a(M)) terminates, then Z is a sequence in

f+SUBST1g� (f!PARSEgfXPANDgf^PARSEg�f�SUBSTg+)�

and if it does not terminate, then Z is a sequence in

f+SUBST1g� (f!PARSEgfXPANDgf^PARSEg�f�SUBSTg+)!

Another consequence of Theorem 7.13 is the following corollary, a somewhat weaker result than

Conjecture 5.9.

Corollary 7.17 Let M be a well-named �-term. The following are equivalent conditions:

1. �(M) has a solution.

2. The ]-transformation of �(M) terminates with the empty constraint set ?.

Proof: Immediate from Theorem 7.13 and the de�nition of ]-transformation.

References

[1] Barendregt, H.P., The Lambda Calculus, Its Syntax and Semantics, revised edition, North-

Holland, Amsterdam, 1984.

31

Page 32: BET - BU Computer Science · BET A-REDUCTION AS UNIFICA TION (Preliminary Draft) A.J. Kfoury Departmen t of Computer Science Boston Univ ersit y Boston, MA 02215, U.S.A. July 8, 1996

[2] Ghilezan, S., \Strong Normalization and Typability with Intersection Types", Notre Dame J.

Formal Logic, Vol 37, no. 1, Winter 1996.

[3] Kfoury, A.J. and Wells, J.B., \New Notions of Reduction and Non-Semantic Proofs of Beta

Strong Normalization in Typed Lambda Calculi", Proceedings of Logic in Computer Science,

June 1995.

[4] Kfoury, A.J. and Wells, J.B., Addendum to \New Notions of Reduction and Non-Semantic

Proofs of Beta Strong Normalization in Typed Lambda Calculi", BUCS Tech Report 95-007,

March 1995.

[5] Kfoury, A.J., \A Linearization of the �-Calculus and an Application", under preparation.

[6] Retor�e, C., \A Note on Intersection Types", INRIA report RR-2431, January 1995, postscript

available at: ftp://ftp.inria.fr/INRIA/publication/publi-ps-gz/RR/RR-2431.ps.gz

[7] S�rensen, M.H., \Strong Normalization from Weak Normalization in Typed Lambda Cal-

culi", Report from CS Department, University of Copenhagen, 1996, available at URL:

http://www.diku.dk/research-groups/topps/personal/rambo.html

[8] van Bakel, S., \Complete Restrictions of the Intersection Type Discipline", Theo. Comp. Sc.,

Vol 102, pp 135-163, 1992.

[9] van Bakel, S., Intersection Type Disciplines in Lambda Calculus and Applicative Term Rewrit-

ing Systems, Doctoral dissertation, Catholic University of Nijmegen, also issued by the Math-

ematisch Centrum, Amsterdam, 1993.

32