On sets of terms with a given intersection type

09/19/2018 ∙ by Richard Statman, et al. ∙ Carnegie Mellon University 0

We are interested in how much of the structure of a strongly normalizable lambda term is captured by its intersection types and how much all the terms of a given type have in common. In this note we consider the theory BCD (Barendregt, Coppo, and Dezani) of intersection types without the top element. We show: for each strongly normalizable lambda term M, with beta-eta normal form N, there exists an intersection type A such that, in BCD, N is the unique beta-eta normal term of type A. A similar result holds for finite sets of strongly normalizable terms for each intersection type A if the set of all closed terms M such that, in BCD, M has type A, is infinite then, when closed under beta-eta conversion, this set forms an adaquate numeral system for untyped lambda calculus. A number of related results are also proved.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Here we are interested in how much of the structure of a strongly normalizable lambda term is captured by its intersection types and how much all the terms of a given type have in common.

In this note we consider the theory BCD (Barendregt,Coppo, and Dezani) of intersection types without the element ([1] pps 582-583) and the notion of an adequate numeral system for the untyped lambda calculus ([3] 6.4 pps 135-137).

2 Formal Theory of Type Assignment

We define the notion of an expression as follows. are atomic expressions. If , and are expressions then so are and . Even though we write infix notation we say that these expressions begin with and resp. A basis is a map from a finite set of variables, dom, to the set of types. Below we shall often conflate F with the finite set

The formal theory of type assignments BCD (Barendregt, Coppo, and Dezani) is defined by the following set of rules here presented sequentially. For basis and terms

Here we note that the rule ([) is read “less that or equal to”.

3 The Relational Theory of Types

The rule is governed by the free theory of a preorder;

and a contravariant-covariant operation ,


satisfying the weak distributive law

.

There is an equivalent equational theory.

4 The Algebraic Theory of Types

A semilattice with meet operation



satisfying the distributive law

and an absorption law

where the quotient partial order can be recovered
.

5 Theory of Expressions and their Rewriting

With an equational presentation we can associate a set of rewrite rules. The one step rewrite of an expression by the rule to the expression is denoted . This is the replacement of exactly one occurrence of the left hand side of the rule as a subexpression of , the redex, by the righthand side. Sets of rules can be combined by the regular operations + (union) and * (reflexive-transitive closure). We define rewrites

and we set semi. = assoc. + comm., and slat. = semi. + idem. Let redo. = slat. + absp. + dist.. redo. generates the congruence on expressions induced by the algebraic theory.

We recall the following properties of the rewrite theory from ([5]).

  1. idem. can be restricted to atoms.

  2. comm. can be restricted to atoms and expressions beginning with .

  3. If slat.* then there exists such that
                      .

  4. Every dist. reduction terminates.

  5. dist. has the weak diamond property.

  6. redo. has the Church-Rosser property.

For each type expression , the unique dist. normal form of is denoted dnf().Each type expression in dnf can be written

associatively with each

Here is the principal atom of . The are the components of .

6 Formal Theories of Type Expressions

The formal theory of simply mirrors the relational theory.

  1. Traditional:

    Axioms;

    Rules;

  2. Equational:

    We add the axioms for the algebraic theory of and the usual rules for being a congruence. Since in this theory is defined by , the BCD rule,

    in the formal theory of type assignment. In addition, there is a useful proof theoretic variant.

  3. Munich Version

    The notions of positive, negative, and strictly positive are defined recursively by

    is positive and strictly positive in .

    If is positive in then is positive in and negative in .

    If is strictly positive in then is strictly positive in .

    If is positive in or then is positive in .

    If is strictly positive in or then is strictly positive in .

    If is negative in then is negative in and positive in .

    If is negative in or then is negative in .

    A single occurrence of as a subexpression of will be indicated . An expression can be thought of as a rooted oriented binary tree with atoms at its leaves and either or at each internal vertex. For each subexpression of there is a unique path from the root of to the root of . If we remove this occurrence of we have a context where we could just as easily have thought of this as the replacement of by a new atom . The rules of the Munich version are

    Axioms;

    Rules;

Lemma 6.1.

(Munich)

If by the Traditional rules then by the Munich rules

Proof.

We verify that the Munich rules are closed under the Traditional rules by simulating the Traditional proofs by Munich proofs. First observe that if in Munich and is positive then and if is negative then . Next observe that if we have and in Munich, then , so by idem. . End of proof. ∎

This version is named in honor of Kurt Schutte.

7 Evaluating Types in the Tropical Semiring

The tropical semiring is the semiring of integers with 0,1,+,min, and max (and + and - infinity, but we will not need these; ([2]). With each type expression we associate a tropical semiring polynomial . The definition is by recursion over subtype expressions of and is not context free; it depends on the sign of the subtype expression. For each atom a pick a distinct variable and set

The dual of , denoted , is obtained from by interchanging max and min.

Facts; (tropical)
For all natural number values of the variables

  1. is monotone.

  2. If and are slat. congruent then .

  3. if is strictly positive.

¿From these facts we conclude the

Lemma 7.1.

If then

Proof.

By the Munich axioms and rules. End of proof. ∎

8 Proof Theory of BCD

Here we need to strengthen several of the derived rules for BCD stated in ([3]) chapter 14 to proof theoretic statements. For this it is convenient to write proofs in tree form. Indeed, we shall implicitly adopt the natural deduction form of the rules of BCD using the left hand side of sequences to indicate active assumptions. We denote proofs etc.

Lemma 8.1.

(dnf)
Suppose that for each and are in dnf, and is provable. Then there is a proof where every type expression is in dnf.

Proof.

Let be such a proof. Our proof is by induction on . We write dnf for the basis such that .
Basis; and the axiom . Then
dnf is an axiom.

Induction step;

Case 1; ends in the BCD rule . Since implies dnf this case is obvious.

Case 2: ends in the BCD rule . Since dnf this case is obvious. Remark; the case is similar and could be included here.

Case 3; ends in the BCD rule . So we may suppose that
, and has the form

Let dnf where each is dnf and does not begin with . By induction hypothesis there exist proofs , of

and resp..Now for , applications of to gives a proof of

which when combined with by gives a proof of

applications of to the gives the desired proof of

Case 4; ends in the BCD rule . Again we may suppose that has the form and has the form

Now if dnf, where each is dnf and does not begin with , then

By induction hypothesis there exists a proof of

which after applications of yields a proof of

Thus for we have proofs

These can be combined by for the desired result. End of proof. ∎

Lemma 8.2.

(predicate reduction)
       Suppose is a proof of where every type expression is in dnf. Then there exists a similar proof where every application of the BCD rule [ is to a variable as the subject.

Proof.

We first recall the criterion for [ on dnfs verified in ([5]) section (19)

If

=
where
is an atom, may be 0,
and each is in distributive normal form
for
=
where
is an atom, may be 0,
and each is in distributive normal form
for

then

for each there exists
such that and
for we have .

Next we consider an application of the BCD rule ([) in immediately following the application of a different rule, and we show how the ([) can be promoted (if you like, permuted).

Case 1;

Now for each we have so we have proofs

which can be combined by .

Case 2;

Now for each we have and

Replacing axioms in by

gives new proofs

which can be combined by .

Case 3;

We may suppose and . By the criterion for of dnfs, for each there exists such that . So for each such where we have the proof

and for each such that we have the proof

and these can all be combined with . End of proof.

A sequence of inferences




      

     
                 

is said to be “intemperate” and can be replaced by




      
                            

                                      

Theorem 8.3.

Suppose that for each :dom and are in dnf, and is provable. Then
there is a proof of such that

  1. every type expression is in dnf,

  2. every application of the BCD rule [ is to a variable as the subject, and

  3. there are no intemperate sequences

Proof.

we already know that proofs satisfying (1) and (2) exist for . The proof is by induction on the length of with a subsidiary induction on length of a proof and (1) and (2). We suppose that

  1. (head normal form), or

  2. (head redex)
    and , showing all components, and we distinguish several cases.

Case 1; ends in . By subsidiary induction hypothesis. Otherwise ends in the BCD rule [, in which case we are done, or , or , Thus we can assume that and begins with .
Case 2; Let .
In case (a) has the form



                            


                            

                                            
                                            

Thus, and for . Now suppose that show all components. By the criterion for [ on dnfs verified in [5] section (19) there exists some such that and with, for . Thus we can alter the proofs above to

and apply the major induction hypothesis to them while we replace the [ inference



appropriately.
The case (b) follows form the main induction hypothesis. End of Proof. ∎

Definition 8.4 A BCD proof satisfying conditions (1),(2), and (3) is said to be “almost minimal” (am)

Definition 8.5 We define the notion of a oscillation in the Bohm tree of a beta normal term as follows. An oscillation is a sequence of pairs of nodes which descend in the tree such that the node

is paired with one of the arguments of this occurrence of which has a non-empty lambda prefix, and the next pair (if it exists) has the head variable of its first coordinate bound by this lambda prefix.

Definition 8.6 We say that the closed term

in beta normal form is of class if

(i) every lambda prefix in the Bohm tree of has at most lambdas

(ii) every node in the Bohm tree of has at most immediate descendants

(iii) every oscillation in the Bohm tree of has at most length .

Lemma 8.4.

(class)
Let be in beta normal form. If is provable in BCD then then any oscillation beginning with dom has length less than or equal to and other oscillations have length less than

Proof.

w.l.o.g we may assume that and all are in dnf. The proof is by induction on an am proof of

Basis; is an axiom. Obvious.

Induction step; we distinguish several cases.

Case 1; ends in . Then and . By induction hypothesis applied to the premise of minimum .

Case 2; ends in . Then and

This case follows immediately.

Case 3; ends in Now consider the leftmost path of proceeding up ; i.e. we take left premises of ’s as often as possible, and then possibly the premise of an inference with a variable subject, and end at an axiom for a variable . This is all that is possible since is am. Let the axiom for be

If the axiom for is immediately followed by an ([) rule inference

note that or = by tropical fact (4). Now consider one of the inferences on the leftmost path of .

By induction hypothesis any oscillation in beginning with has length less than or equal to and other oscillations have length less than less than since is negative in E. Such an oscillation extends to one beginning with the with the head variable .

Case 4; ends in . Similar to case 3. End of proof. ∎

Corollary 8.5.

For each type there exists an integer n s.t. for any closed beta normal such that in BCD has class .

Proof.

by induction on the length of an am proof of using the class lemma. End of proof. ∎

Lemma 8.6.

(thinning)
Suppose that is an am proof of where is in beta normal form and the principal atoms of do not occur in either or any for . Then does not occur in .

Proof.

By induction on . End of proof. ∎

Defintion 8.10 An intersection type in dnf is said to be functional if each atom occurs at most twice and if twice then with opposite sign, and there is no + occurrence of . The type is co-functional if each atom occurs at most twice and if twice then with opposite sign, and there is no - occurrence of .

Definition 8.11 If is dnf, say with the set of hereditary components of , is defined recursively by

Defintion 8.12 If is dnf and is a subset of then is obtained by deleting the members of from and the corresponding arrows if entire lhs’s are deleted.

Lemma; (eta normal form)

Suppose that we have a functional type
where
,
and for

Let be in beta eta normal form. Then if , and
,

we have .

Proof.

by induction on the length of an am proof . let

and suppose that . W.l.o.g and may assume does to end in and does not begin with . Suppose that is not . We then consider the left most path of . Beginning at the top this path consists of 0 or 1 application [, followed by 1 application of followed by applications of . Now write

Now since , by functionality, has a unique component

with principal type . This accounts for the two possible occurrences of so , and we have for
Le

Then the axiom at the top of the leftmost path is

and for . Now consider the type
where
for and

for .
This is functional, so by induction hyothesis . But . End of proof. ∎

Construction;
Suppose that is in beta normal form with free variables
. We construct co-functional types , and a functional type such that if is the basis such that then . We construct the types by recursion; it will be convenient not to identify different free occurrences of each variable until becomes bound, so that the do not have strictly positive occurrences of until binding. Thus, in may have several types not beginning with . This is only a convenience.

  1. if then the atom

  2. if then let be the of all the types assigned to the different occurrences of in ; then the type for is

  3. if then we have already types such that . We add the new occurrence , for a new atom, to and set the type for .

Lemma 8.7.

(uniqueness)
Suppose that is functional and there exists a beta-eta normal such that

then is unique.

Proof.

; set ; the proof is by induction on the length of an am proof of . Write as . Then

where . There are two cases which are determined by alone.

Case 1; is . Let . Then, since is am, has the component

where
and the conclusion of the [ on the leftmost path of
(if it exists, otherwise is . Now the lemma applies, and if

,

then since for we have
. Thus, since is eta normal, this case cannot happen for two distinct values of . We have

by shorter am proofs than , and

is functional so our induction hppothesis applies.

Case 2; is a . Similar. End of proof. ∎

Theorem 8.8.

If is strongly normalizable then there exists a functional type such that if is the beta eta normal form of then and is the unique beta eta normal form such that .

Proof.

by the construction of a functional type above and the uniqueness lemma, the theorem follows for already beta normal. We must show that this extends to all strongly normalizable . To this end we will consider a standard reduction from a strongly normalizable to its beta normal form . This is sufficient by eta postponement and the construction above. For one step we will have as an induction hypothesis where for each :dom, is co functional, is functional,and if range(
then

is functional. We will show that there exists , such that , where for each :dom is co functional, is functional and if range then is functional.Indeed will be related in the following way

  1. dom is contained in dom.
    Let