intersection types as logical formulae - semantic scholar · intersection types as logical formulae...

16
Intersection Types as Logical Formulae BETTI VENNERI, Dipartimento di Informatica, Universitd degli Studi di Torino, c. S vizzera, 185, 10149 Torino, Italy. E-mail [email protected] Abstract The aim of this paper is to investigate, in the Curry-Howard isomorphism approach, a logical characterization for the intersection-type discipline First a novel formulation of the intersection type inference for combinatory logic is presented, such that it is equivalent to the original version of the system, while the intersection operator is no longer dealt with as a proof-theoretical connective Then a Hilbert-style axiomatization is defined and proved to totally parallel lntersecOon-denvability, in such a way that inhabited intersection-types are all and only the provable formulae in the logic system Keywords- Combinatory logic, type inference, Curry—Howard isomorphism, relevance logic 1 Background and motivations The present paper answers the question of finding a logical system relating to the intersection type discipline. Intersection types have been introduced in [3] and [2] as a generalization of Curry's type inference system, in order to neatly characterize a larger class of terms. The main idea is the introduction of a new type-forming operator, the intersection A, whose introduction and elimination rules are: / AT N BY- M :a BY- M : r , AP N B Y- M : a A r _ v ' BY- M :a AT ^ /xn) B Y- M : a (B h M : T) " The extended system, TA A , turns out to be significantly more powerful, since it allows the typing of exactly the strongly normalizable terms (terminating programs). Reynolds showed how the type-operation of intersection can be useful to clarify many concepts of ALGOL-like programming languages ([16]), whereasfilter-modelsof A-calculus were devised in [2] by using A-types. A very interesting approach to type disciplines, set out as formulae-as-types or the 'Curry- Howard isomorphism' [9], is the mapping of constructive proofs of logical formulas into programs (A-terms or combinators) of related types and conversely. Thus a logical meaning for the type constructors is provided while logical systems can be seen in a computational way. As far as the simple types of Curry's system are concerned, the well known analogy with the implicational fragment of intuitionistic propositional logic is quite natural. Roughly speaking, an arrow-type of the shape a -4 /? is paralleled by the implicational formula A -y B, where the elimination and introduction rules for the arrow in types correspond, respectively, to the introduction and elimination rules for implication in natural deduction. The simple type discipline has been extended to stronger systems, still prompted by the Curry- Howard isomorphism. In particular, second- and higher-order logics can be dealt with by introducing connectives and quantifiers (of suitable order) on types, thus generating Girard's systems F and F u (see [6] for a thorough account of formulae-as-types). For TA^, however, the question 'what is the corresponding logical system like?', J LofkComfmtal..Voi 4 No X pp. 109-124 1994 © OrfonJ \Mva&y PreM

Upload: others

Post on 24-Mar-2020

13 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Intersection Types as Logical Formulae - Semantic Scholar · Intersection Types as Logical Formulae 111 2 Intersection types for combinatory logic Let us outline the inference system

Intersection Types as Logical Formulae

BETTI VENNERI, Dipartimento di Informatica, Universitd degli Studi diTorino, c. S vizzera, 185, 10149 Torino, Italy.E-mail [email protected]

AbstractThe aim of this paper is to investigate, in the Curry-Howard isomorphism approach, a logical characterization forthe intersection-type discipline First a novel formulation of the intersection type inference for combinatory logic ispresented, such that it is equivalent to the original version of the system, while the intersection operator is no longerdealt with as a proof-theoretical connective Then a Hilbert-style axiomatization is defined and proved to totally parallellntersecOon-denvability, in such a way that inhabited intersection-types are all and only the provable formulae in thelogic system

Keywords- Combinatory logic, type inference, Curry—Howard isomorphism, relevance logic

1 Background and motivations

The present paper answers the question of finding a logical system relating to the intersectiontype discipline. Intersection types have been introduced in [3] and [2] as a generalization ofCurry's type inference system, in order to neatly characterize a larger class of terms. The mainidea is the introduction of a new type-forming operator, the intersection A, whose introductionand elimination rules are:

/ATN BY- M :a BY- M : r ,A PN B Y- M : a A r _v ' BY- M :a AT ^/xn) B Y- M : a (B h M : T) "

The extended system, TAA, turns out to be significantly more powerful, since it allows the typingof exactly the strongly normalizable terms (terminating programs).Reynolds showed how the type-operation of intersection can be useful to clarify many conceptsof ALGOL-like programming languages ([16]), whereas filter-models of A-calculus were devisedin [2] by using A-types.

A very interesting approach to type disciplines, set out as formulae-as-types or the 'Curry-Howard isomorphism' [9], is the mapping of constructive proofs of logical formulas into programs(A-terms or combinators) of related types and conversely. Thus a logical meaning for the typeconstructors is provided while logical systems can be seen in a computational way.

As far as the simple types of Curry's system are concerned, the well known analogy with theimplicational fragment of intuitionistic propositional logic is quite natural. Roughly speaking,an arrow-type of the shape a -4 /? is paralleled by the implicational formula A -y B, wherethe elimination and introduction rules for the arrow in types correspond, respectively, to theintroduction and elimination rules for implication in natural deduction.The simple type discipline has been extended to stronger systems, still prompted by the Curry-Howard isomorphism. In particular, second- and higher-order logics can be dealt with byintroducing connectives and quantifiers (of suitable order) on types, thus generating Girard'ssystems F and Fu (see [6] for a thorough account of formulae-as-types).

For TA^, however, the question

'what is the corresponding logical system like?',

J LofkComfmtal..Voi 4 No X pp. 109-124 1994 © OrfonJ \Mva&y PreM

Page 2: Intersection Types as Logical Formulae - Semantic Scholar · Intersection Types as Logical Formulae 111 2 Intersection types for combinatory logic Let us outline the inference system

110 Intersection Types as Logical Formulae

has not yet been answered.Let us consider where the difficulty lies. The logical characterization of Curry's inference

system for combinatory logic can be expressed by the following equation:

set of inhabited —t-types = set of possible types of combinators (closed X-terms)= set of theorems of the logic L_,

where L_, is defined thus:

1. formulas are propositional formulas built by implication

2. the only deduction rule is 'modus ponens'

3. the axiom schemes are

(;4 -> (B -»• C)) -> ((A -+ B)-+(A-¥ C)).

Since TAA extends Curry's system by adding a new type constructor with corresponding rules, itis reasonable to look for a logic LA, extending L_, both in the language and in the set of axiomsand rules, such that the above equality holds between LA and TAA.

Difficulties arise from the specific shape of the (Al)-rule, saying that a term has (a deductionproves) a type (a formula) a A r if and only if this term has (the same deduction proves) botha and r. So the first candidate to be a parallel of intersection seems to be a restricted form ofthe usual propositional conjunction &: in other words, the provability of a conjunctive formulaAhB must require that both the conjuncts are provable by proofs with the same structure. In sucha system, the &-introduction rule would be constrained by a global condition of applicability,involving the shape of the whole subderivations.

These features led some authors to investigate intersection as a proof-theoretic operator, in thecontext of 'untyped terms as realizers of logical formulae'. Lopez-Escobar first referred to A as'...the first...connective which is truly proof-functional' [10]. Following that approach, in [12]and [1] a first-order logic was defined to derive predicate formulas such as .RA[M] , meaning 'theA-term M realizes the propositional formula A'. Actually, in this logic no specific rule is givento represent the A-derivability; the predicate RAAB[M] is proved by the proof of the predicateRA[M]8ZRB[M], which is defined as equivalent to the former one since the two subjects of thepredicates connected by Sz are equal (& is the usual conjunction).

Completely different, our quest for a logic LA matching TAA requires intersection to beparalleled by only using propositional connectives and the derivability of intersection types to becompletely represented in a logical Hilbert-style axiomatization. We will do that in two steps.

First, we shall define a new type inference system proved to be equivalent to Tv4A, in whichno rule involves any global metalinguistic requirements (Section 2). Let us recall that suchrequirements are common in standard logical systems, for example in the form of side conditionson variables occurring free in assumptions in the V-introduction. What we will avoid is anyproof-functional condition for rule's applicability, involving relations on subderivations.

The novel formulation of TA^,, in addition to allowing a smooth solution to our originalproblem, comes to be interesting in its own right. By providing structural rules to deriveintersection types, it can indicate a way to deal with some syntactical questions, such as theproblem of finding decidable, yet powerful restrictions of TAA-

Lastly, we will define the logical axiomatization LA (Section 4), whose inference rules donot contain the usual ^-introduction whereas they are all admissible rules in the conjunctiveimplicational calculus (see Remark 4.9).

Page 3: Intersection Types as Logical Formulae - Semantic Scholar · Intersection Types as Logical Formulae 111 2 Intersection types for combinatory logic Let us outline the inference system

Intersection Types as Logical Formulae 111

2 Intersection types for combinatory logic

Let us outline the inference system of intersection types for combinatory logic terms, (TAA)which has been defined in [4] as a translation of the original formulation of A-type assignmentfor A-calculus TAAX [3].

Let us notice that the type system of [4] introduces both intersection types and the universaltype u) meaning the 'undefined' value, so the corresponding TAA\ is the A-w-type discipline.In the present paper the intersection type theory is studied without the universal type. However,the proof of the correspondence between TAA\ and TAA when type u> is omitted is a trivialrestriction of that one presented in [4]; thus for the formulation of T AA as well as main propertiesof the system we shall simply refer to [4].

In what follows the reader is assumed to be familiar with combinatory logic (see Chapter 2 of[8]). We shall only recall main definitions and usual notations.

DEFINITION 2.1 (Combinatory logic terms)Assume that there is given an infinite set of variables. Let B denote any fixed basis of basic(initial) combinators B = {Ci, C2, • • •}• CLB-terms are built out of variables and C\, C2, • • •by application.An atom is a variable or a basic combinator. A closed term (combinator) is a term whose onlyatoms are C i ,C2 , . . .Each atomic combinator is assumed to have an axiom-scheme defining its contraction rule, i.e.

where £>, is a combination of some or all of x\,..., xn and no other atoms.We say that a term U reduces to V (U y V) iff V is obtained from U by a finite series ofcontractions (weak reduction).

NOTATION 2.2

To avoid parentheses, we assume that application of terms associates to the left.

In what follows B is assumed to be any combinator complete basis, that is any set of initialcombinators such that, for each sequence of variables x\,..., xn and each CLB-term Y, thereexists a CLB-term denoted by \*X\... xn.Y, containing none of X\,..., xn, with the followingproperty:

(\*xi...xn.Y)xi...xn yY.

Let us recall that if B is complete then there always exists an abstraction-algorithm to computesuch a A ' x i . . . xn.Y for B.

A well known complete basis is B = {S, K, 1} where

• Sfgx y fx(gx) (strong composition operator)• Kxy >- x (operator for forming constants)• Ix y x (identity operator).

Actually I can be obtained from S and K, so the minimal complete basis is {S, K}, but it is usualto assume it as atomic combinator.

DEFINITION 2.3 (Types)Assume that we have infinitely many type-variables a,/9,7,<5, ao .a i , The set T of types isinductively defined thus:

Page 4: Intersection Types as Logical Formulae - Semantic Scholar · Intersection Types as Logical Formulae 111 2 Intersection types for combinatory logic Let us outline the inference system

112 Intersection Types as Logical Formulae

1. All type-variables are types.2. If a and r are types, then so is a -¥ T (arrow-types).3. If a and r are types, then so is a A T (intersection-types).

NOTATION 2.4

We assume that 'A' takes precedence over '-»•' and '->' associates to the right.

A preorder relation on types naturally comes by thinking of the A-operator as the usualintersection on sets.

DEFINITION 2.5

The < relation on T is inductively defined by the following axiom schemes and rules:Axiom schemes

l.T <T.

2. T < r A r.3. <TAT < T .

4. cr A r < a.

5. (<7 ->• p) A (a ->• r ) < a -> p A T.

Rules

6. a < p < T implies a < T (transitivity).

1. <j < a1 and T < T' imply a AT < a' AT'.

8. a < a' and T < T1 imply a' -> r < cr —> T'.

cr ~ T is short for <7 < r < cr; for instance, a A r ~ T A a and a ~ o ACT formalize the obviousequivalence of intersection types under permutations and repetitions.

Now the type inference system can be introduced as a set of axioms and rules assigning typesto untyped CLB-terms. For each initial combinator C, we shall write TT, as a notation for theprincipal type scheme (p.t.s.) of C,, that is the type from which all the other types of C, can beobtained by syntactic operations. In [17] Sections 3-4, the reader can find definitions of p.t.s.s forall A-terms in normal form, then for all atomic combinators, and the proof that they can generateall types of the terms by means of the operations of substitutions, expansions and raises.

Let us only recall the principal types of some usual combinators:

• p.t.s.(l) = a -¥ a

• p.t.s.(S) = (c*i -> /? -> <5) -> (a2 ->• /3) -> a i A a2 -> 6

• p.t.s.(K) = a ->• (3 -> a.

All the following definitions and results are independent from the choice of B. For simplicity,to avoid explicitly writing the parameter B, we shall consider the specific basis B = {S, K, I}.Other complete bases with corresponding axioms for reduction and associated p.t.s.s are listed in[4].

DEFINITION 2.6 (The system TAh)

StatementsM : T where M is a CLB-term (subject) and T €T (predicate).

Page 5: Intersection Types as Logical Formulae - Semantic Scholar · Intersection Types as Logical Formulae 111 2 Intersection types for combinatory logic Let us outline the inference system

Intersection Types as Logical Formulae 113

A basis B is a set of statements whose subjects are all distinct variables.AxiomsFor each C, € B, the following is an axiom

(Ax) h C, : <

where n* is an instance of the p.t.s. TT, of Ct, obtained by substituting types for type variables in71",.

Inference rules

(Var) B U {x : a} h x : a if a; does not occur in B

B

BY-

BY-

Y- M

M :BY-M :,

: aBaM

(7

-)• T BY- MN :T

BY-:a A

a <

M :r

r

hJV:<7

T

qBY- M :T

We will wnte B Y- M : cr to mean that the statement B h M : a can be proved in the abovesystem; for example, V SII: a A (a -> (i) -¥ a.

The equivalence between TAA and T ^ A A , proved in [4], means that

BY- M :a iff B hA MA : a

where h^ is derivability in TA^\ and MA is, as usual, the A-term translating M via the wellknown correspondence between combinatory logic and A-calculus. Then all main properties ofTA/\\ are inherited by TAA; in particular, TA^ can be still viewed as acomplete characterizationof functional programs which are strongly normalizable. The proof of the property that a A-termis strongly normalizable iff it is typable in TAA\ can be found in [3] and in [19].

REMARK 2.7

TAA is a proper extension of Curry's type inference system for combinatory logic (TA-,). InCurry's discipline simple types are generated by the operator -t and the only inference rule is(-¥ E). Atomic combinators are typed by a p.t.s. from which all the types of the term can beobtained simply by substitution.

Let us recall that, in T A _ , the p.t.s.s of K and I are the same as in TAA while the p.t.s. of Sis (a -> P -¥ S) -> (a -> (3) -»• (a -> S).

The system T J 4 _ does not type a large class of terms. For instance, SII has no type in Tv4_.

Our aim is now to define a new formulation of the A-type inference system, denoted by TA*A,not containing any rule such as (AI).As discussed before in Section 1, this way of introducing intersection by (AI) prevents us fromdevising a structural correspondence between untyped terms and type deductions, since conditionson the whole subderivations are involved in the rule applicability.

The set T of types will be unchanged.

DEFINITION 2.8 (The system TA*A)Let < be defined as in Definition 2.3 and statements and bases as in Definition 2.6.

Page 6: Intersection Types as Logical Formulae - Semantic Scholar · Intersection Types as Logical Formulae 111 2 Intersection types for combinatory logic Let us outline the inference system

114 Intersection Types as Logical Formulae

AxiomsFor every C, 6 B, and every n > 1, the following is an axiom

(AxA) I-* C t : TT,1 A .. A 7T,n

where every TT* (1 < fc < n) is an instance of the p.t.s. TT, of C,, obtained by substituting typesfor type variables in TT,: i.e. for each TT*, there exists a substitution Sk such that TT* = Sfc(7rt).

Inference rules

(Var) Bl) {x : a}\~* x : a if i does not occur in B

( ^ E ) B h* MiV : r ^~

(s\ B\~* M :a a <T

^ BWWTT •

It is easy to verify that the following rules are derived:

i f_vF » i -5 I-* M : en -4 n A .. A an -> Tn B \-* N : <n A . . . A an

i . ^^-cgen; S K MA7 : n A . . . rn

by using (<), since O\ —> Ti A . . . A an ->• r n < <Ti A . . . A an —> T\ A ... A Tn

9 CAFI B \-* M : a AT

^ > B\-* M :a (or r)

by (3) or (4) of Definition 2.3

B h* M : a a < r

by (2) and (7) of Definition 2.3.

These derived rules will be useful to simplify the following proofs. Moreover, (A—<) points puthow intersection types can be derived by using (<). Informally speaking, the original rule (Al) issplit into two rules, (AxA)and (<), so that any introduction of intersection types now consists ofduplicating the derived type by instantiation or by <. Which does not imply that for any derivedtype of the shape a AT a relation of instantiation or < holds between a and T, because of manypossible (AE)-applications during the derivation of a AT.

In the above formulation of the type inference system, the requirements involved in (AxA) and(<) concern syntactic relations on types rather than relations on subderivations. So a structuralcorrespondence between terms and type deductions could be recovered, simply by mapping (AxA)and (<) into a set of coercions.

The equivalence between 2MA and TA\ will be proved in Theorem 2.13, by using twopreliminary lemmas.

NOTATION 2.9

Metalinguistic implication will be denoted by =3-.

LEMMA 2.10

B \-* MN :T = > 3a. B \-* M : a -> r and B K N : a.

Page 7: Intersection Types as Logical Formulae - Semantic Scholar · Intersection Types as Logical Formulae 111 2 Intersection types for combinatory logic Let us outline the inference system

Intersection Types as Logical Formulae 115

PROOF. By induction on the size of the proof that B h* M : T. The only interesting case is whenthe last applied rule is (<). Then the result follows by the induction hypothesis, since r < T'implies a —i T < a —» T7. I

The preceding lemma essentially says that any type derivation, for all terms but variables, can bedone in such a way that the last step is an application of (-+E). This means that all applicationsof the rule (<) can be pushed up above all (-»E)-steps.

LEMMA 2.11

VC, € B, B h* C, : a =>• there exists an intersection type n] A . . . A TT" (for somen > 1) such that a > K\ A . . . A TTJ* and each TT* is an instance of the p.t.s. of C, (1 < k < n).

PROOF. Trivial, taking into account that, in the case of initial combinators, the only applicablerules are (AxA) and then (<). I

THEOREM 2.12 (Rule (AI) is admissible)For all CLB-terms C,

flh* C:ax ...Bh* C:an = • B h* C : ay A . . . A an (n > 1).

PROOF. By structural induction on C.First step.

1. C = x. It is easy to verify that there exists a type r such that x : T E B and, for every a,(1 < t < n), T < <7t; so r < Oi A . . . A an and the derivation can be obtained by (<).

2. C is some initial combinator belonging to B. From Lemma 2.11 it follows that there existn-types T\ , . . . , r n such that for each 1 < t < n• r, is an intersection of some instances of the p.t.s. of C• r, < ax.So one derives B h* C : T\ A . . . A r n by (AxA), and thenB h* C : ai,... ,an by using the rule (<).

Inductive step.C = MN. By Lemma 2.10, for any cr, (1 < t < n), there exists a type pt such thatB \~* M : pt —> cr, and B \~* N : px. Thus, by induction hypothesis,B h* M : p\ -> CTi A . . . A pn -> an and B h* N : p\ A . . . A pn

so, by (-*E.gen), B \-* MN : <jx A . . . Aan. I

THEOREM 2.13 (Equivalence between TAA and TA\)For all CLB-terms C and types r,

B h C i T <=> B\-* C :T

PROOF. (•<=). Trivial, h* is a subsystem of h, since (AxA) can be proved to be an admissibleinference rule of h by using (Ax) and (AI).(=>). By induction on the deduction of B h C : T. The proof easily follows from the inductionhypothesis, using Theorem 2.12 when the last applied rule is (Ai). I

REMARK 2.14

An alternative formulation of the system h* can be obtained from T/tA if one replaces rule (AI)by the following rule:

, B\~C:a T is an instance of a, C is a closed termS ) B\-C:cAr

Page 8: Intersection Types as Logical Formulae - Semantic Scholar · Intersection Types as Logical Formulae 111 2 Intersection types for combinatory logic Let us outline the inference system

116 Intersection Types as Logical Formulae

It is easy to verify that the type inference so obtained is a subsystem of TAA, while TA\ is asubsystem of it; so, the three inference systems come to be equivalent by Theorem 2.13. This isquite reasonable by considering that one handles the same syntactic relation on types, that is oneof instantiation, in introducing intersections both by (AxA) and by (Al-s).

It is important to notice that the system TA\ defined in the present paper would not beequivalent to TAA if rule (<) was erased from both systems, still considering types modulo theequivalence relation ~.

For instance, let us consider the simple case of the combinator SKK (SKK represents I whenI is not assumed to be a basic combinator): the statement

h SKK : (a -> a) A (/3 A 5 ->• (5)

can be proved in TAA without using the rule (<). Namely,h SKK : a - > a ~ a A a - > a c a n b e obtained by (-+E) from the axiom steps

(- S : a = (a -> (/? ->• a) ->• a) -4 (a -»• p ->• a) -> (a A a ->• a)r- K : a\ = a -)• (/? -> a) -4 ar- K : <r2 = ct -> P -* oc-

Analogously, j3 A 6 -> 0 is derived from the axiomsr- S : r = (/? -^ (/? -><5) -> /3) -> (* -»• /3 -»• <5) -> ()8 A 6 -> j8)h K : n = /3 -> (^ -> 5) -> 0\-K:T2 = 6^/3^-6

and, then, h SKK : (a ->• a) A (/? A 6 -> /?) requires an application of (AI).On the other hand, in the system h", by (AxA) one only denves

r -*S .o -Arh* K : CTI A nh* K : CT2 A T2

from which an application of the rule (-^E.pen) is needed to obtain(a —> a) A (/3 A <5 —> /?), that is an essential application of the rule (<). By an alternativededuction, h* SKK : a -* a by (AxA) and (-»E), thenh* SKK : (a -> a) A (/? A <5 -> /3) by (A/-5) and (A-<).

So the inference rule (<), which has been originally introduced in [2] just to obtain a com-pleteness proof of the A-type system without increasing the class of typable terms, comes to playa different role in the h* derivability. Type derivations of TAA ait mapped to T.AA-typings,namely by using both (AxA) and (<) in place of (AI).

REMARK 2.15

In a recent paper [20], H. Yokouchi investigates relations between intersection type system (ITS)and a second-order type system (STS), in the specific framework of type inference for A-calculus.In particular, an embedding of STS into a subsystem of ITS, called ITS*, is devised thus:

1. a function tr is defined (on deductions) translating intersection types into V-types2. a partial ordering relation C is introduced between V-types, which is the same as the contain-

ment relation defined by Mitchell in [15]3. the subsystem ITS* is characterized by restricting the use of (AI) in the following way:

B\- M :a and Bh M :T => B\- M :o AT

only provided that there exists a typing B' h M : p such that B' = tr{B),Vtu...,tn.tr(p)Qtr(a) and V«i,... ,tn.tr(p) E tr{r).

Page 9: Intersection Types as Logical Formulae - Semantic Scholar · Intersection Types as Logical Formulae 111 2 Intersection types for combinatory logic Let us outline the inference system

Intersection Types as Logical Formulae 117

The interested reader is referred to [20] for details.We point out that Vt.p C r essentially means 'T is obtained from p by replacing type variables

by types' [15]. So the inference rule (<) seems to be able to characterize the intersection typediscipline with respect to the system STS.

In order to achieve the logical axiomatization relating to TA*A, we first look for a logicalrepresentation of the rule (<). In the following section we will show how the <-relation can bemapped into a relevant implication on propositional formulae.

3 The relevant implication for representing <

Types of Definition 2.3 can be read as logical formulae of an implicational-conjunctive-propositionallanguage, mapping type variables, ->• and A into propositional letters, implication and conjunc-tion, respectively.

Formulae will be called T-Formulae as a short hand for Types-formulae, where implication andconjunction connectives will be denoted by —> and A, respectively, for simplicity.

DEFINITION 3.1

T-formulae are defined inductively as:

• propositional letters are T-formulae

• if A and B are T-formulae, so are A -¥ B and AAB.

We will consider T-formulae modulo (=) associativity of intersections, i.e. for example (A AB) A C = A A {B A C) which will be simply written as A A B A C.

From now we can speak simply about T-formulae instead of types.

Any inference system deriving assertions on types (Relational system on types) can be formu-lated as a logical system, by defining the logic as a triple (L, E, 77/), where

• L i sa language of formulae

• E is a set of axioms and rules, such that TH C L is the set of theorems coinciding with theset of type assertions proved in the inference system.

In this approach, Definition 2.5 of < can be viewed as a relational system (RS) in which theoremsof the shape A < B (A, B are T-formulae) are proved by using points (l)-(8) as the set E ofaxioms and rules.

In this section the logical system representing RS is showed to be the minimal relevant logic,namely the system B+ defined by R. K. Meyer and R. Routley in [12] and [13].

R. Meyer first pointed out this coincidence (private discussions), that is the fact that A —¥ B isa theorem of B+ iff A < B is valid according to the definition of <, by using a 'metavaluation'argument.

In the present paper, this correspondence is proved in Theorem 3.4 by a different argument; inparticular, the system of relevant logic mapping RS is an essential restriction of B+ since it doesnot contain the 'Church constant' T.

DEFINITION 3.2 (The minimal relevant logic)Let LT be defined as the logic LT = (L, E r , THr) where

Page 10: Intersection Types as Logical Formulae - Semantic Scholar · Intersection Types as Logical Formulae 111 2 Intersection types for combinatory logic Let us outline the inference system

118 Intersection Types as Logical Formulae

• L is the language of T-Formulae

• the set E r is so defined:

Axiom schemes

(al) A -> A

(a4) (A ->• B) A (A -> C) -> (A -*• B A C).

Rules

A,A-+B =$• B (modus ponens)

A, B =s> A A B (adjunction)

A -> B =*> (B ->• C) -> (A -> C) (suffixing)

B ->• C =>• (A ->• B) -> (A ->• C) (prefixing).

LEMMA 3.3

In the RS-system the following properties hold:

1. A->• B <C ->• D = > C < A a n d B < . D2. Ai A . . . A An < E and E = Bi A . . . A B m (n, m > 1) =>•

Ai A . . . A An < B, (1 < t < m)3. (Ai -> Bi) A . . . A (An -> Bn) < B = > B cannot be a prepositional letter4. (Ai -> Bi) A . . . A(An -»• Bn) < C->- D =*•

there are some t i , . . . , ifc 6 { 1 , . . . , n} such thatA,, A . . . A A, t > C and B t l A . . . A Blu < D.

PROOF. By easy induction on the definition of <. The point (4) corresponds to Lemma 2.4 (ii) of[2]. •THEOREM 3.4 (Coincidence between RS and LT)

1. if A < B is proved in RS then A^ Be THr

2. for all A 6 THr, A = (Ax -> Bi) A . . . A (An -> Bn) (n > 1)where A, < B, is a theorem of RS (1 < i < n).

PROOF. 1. By deductive induction. Points (1), (3), (4) and (5) of Definition 2.5 correspond toaxiom schemes (al), (a2), (a3) and (a4) of E r , respectively.A —> A A A (i.e. point (2)) can be proved from (A —> A) A (A —*• A) (which is a theoremby (al) and adjunction) by using (a4).Transitivity rule (point (6)): if B -+ C then (A -¥ B) -¥ (A ->• C) by prefixing-rule, andso A -> C can be derived from A -»• B by modus ponens.Point (7): A -> A' and B -> B ' ==• A A B -> A' and A A B -^ B ' (by (a2) andprefixing) ^ ^ A A B —• A' A B ' (by adjunction and (a4)).Point (8) corresponds to the inference rules of suffixing and prefixing.

2. By deductive induction. Cases of axiom schemes, suffixing, prefixing and adjunction aretrivial. The only interesting case is that one of modus ponens. Suppose that D and D —¥ Aare theorems. By induction hypothesis, both D < A is proved in RS andD = (Pi - • Qi) A ... A (Pn -»• Qn) for some n > 1 where Pt < Qt (1 < t < n). So theproof follows from induction hypothesis by using Lemma 3.3. I

Page 11: Intersection Types as Logical Formulae - Semantic Scholar · Intersection Types as Logical Formulae 111 2 Intersection types for combinatory logic Let us outline the inference system

Intersection Types as Logical Formulae 119

Let us notice that the interpretation of -> as relevant implication means that the weakening ruledoes not hold. As a consequence one cannot prove any form of the deduction theorem allowingone to derive the formula A —¥ B —> A A B (from the adjunction rule) and hence the exportationlaw

(exp) ( / l A B - > P ) - + ( A ^ B - t P ) .

On the other hand, the following formula

is a theorem of LT. This will allow the converse formula of (exp), i.e. the importation law, tobe provable in the logical system representing intersection, as we will show in the next section(Remark 4.9). Moreover the relevant logic B+ is minimal since even the usual contraction lawon —>• does not hold.

4 The Hilbert-style axiomatization LA

A very simple way of setting out a logic relating to combinatory logic with a type assignmentconsists of identifying each combinatory term with a set of logical formulae representing its types

The formulation of the intersection type discipline as the system TA\ allows one to describehow combinators, i.e. closed terms, can be associated to logic proofs whereas initial combinatorscorrespond to axioms. As a result, a Hilbert style axiom-based formulation of logic, denoted byLA, will parallel the A-type-inference system in the sense that the set of all inhabited types inTA\, and hence in TAA, coincides with the set of provable formulae in LA-

This logical correspondence will be shown in the present section by using some ideas andtechniques that have been introduced by R. Meyer and M. Bunder in [11] for defining the notionof 'fool's model' for combinatory logic with Curry's simple types. The fool's model of [11] wasused in a proof that the pure implicational logic is complete with respect to the rule of condenseddetachment, that is to Robinson's resolution rule. Our purpose in following the same approachis to point out how a model for combinatory logic with intersection types can be built up as anextension of the fool's model for implicational logic.

NOTATION 4.1

L still denotes the language of T-formulae, as defined in Definition 3.1 and s, t, v, w,... willdenote arbitrary sets of T-formulae.

For any T-formula A, let [A] denote the set of formulae generated by A thus:[A] = {A\ A . . . A An (n > 1) : each At (1 < i < n) is an instance of A,

that is a formula obtained from A by simultaneously substitutingT-formulae for variables}.

Roughly speaking, for a given formula A the set [A] is intended to include any intersectionformula of possible different instances of A.

DEFINITION 4.2

Let s, ( be any arbitrary sets of T-formulae. The fusion operation o is defined thus:

s o t = {B : A ->• B € s and A G t}.

This definition means that the fusion s o t is just the set of all consequences of formulae of s(major premise) and t (minor premise) by modus ponens. In the specific case when s is the set

Page 12: Intersection Types as Logical Formulae - Semantic Scholar · Intersection Types as Logical Formulae 111 2 Intersection types for combinatory logic Let us outline the inference system

120 Intersection Types as Logical Formulae

of theorems of a logical system T, then s o t is the set of all formulae which are T-entailed bysome member of t. Let us consider now a very simple model, where the notion of model is usedin a wider sense than the usual one, such that all closed typable combinators can be interpreted init essentially as the set of their possible types-formulae.

DEFINITION 4.3

The model M. is defined as the quadruple M = (M, o, C, Lr) where

• o is the fusion operation• C is the usual set inclusion

• Lr is the logic defined in Definition 3.2, whose class of theorems is denoted by THr

• M i s the smallest class of sets of T-formulae such that- it contains three initial elements defined ass = THT ° [(A -> B ->• C) -¥ {A -> B) -> A -> C]k = THT o [A -> B -> A]i = THr o [A -> A]

- it is closed under fusion, that isw,v 6 M ==> wov€.M.

DEFINITION 4.4

Let C be any closed combinator, built as a combination of S, K and I. The interpretation of C inthe model M is inductively defined thus:

• if C is an initial combinator, then [S] = s, [K] = k, [I] = i;

• if C = C\Ci, then [C1C2] = i « i o u>2, provided that [Cl] = wi and [C2] = w^.

So in the structure Ai all closed combinators can be identified with the set of formulae whichare all and only their possible types in the system TA*A.

Once basic combinators are associated to initial elements of M., application of terms comes tobe the fusion operation between distinct elements, that is modus ponens. Moreover the closureof initial elements of Ai under fusion with the relevant logic Lr corresponds to the inferencerule (<) by the coincidence proved in Theorem 3.4. Let us notice that it is sufficient to assumethis closure property under < in defining initial elements, while it holds for all constructedelements won essentially by Lemma 2.10 as we will prove in Theorem 4.5(1). That mappingof combinators into sets of formulae is formally given in the following theorem, where the basisB = {K, S, 1} is chosen as the set of initial combinators for defining terms (CLB-terms) andp.t.s.s which are axioms in T^-derivability.

Take into account that here as well as in Section 3 we still speak about formulae instead ofcorresponding types.

THEOREM 4.5 (Types-to-logic mapping)Let C be any closed combinator. Then

1. for all T-formulae A, h* C : A =S- A e [C]2. for any t « 6 M there exists a combinator C such that

w = [C] and, for all A, Aew =s> r-* C : A.

PROOF. 1. By structural induction on C.First step.

= K o r C = I then the proof follows from Lemma 2.11, by definition of k and i. The

Page 13: Intersection Types as Logical Formulae - Semantic Scholar · Intersection Types as Logical Formulae 111 2 Intersection types for combinatory logic Let us outline the inference system

Intersection Types as Logical Formulae 121

only interesting case is when C = S, since the formula(A -> B -> C) -¥ (A -¥ B) ->• 4 -)• C corresponds to the p.ts. of S in Curry's typesystem 7 \4_ , while the p.t.s. of S in TA\ is(A -*• B ->• C) -> (£> -> B) ->• A A D ->• C (see Remark 2.7).In this particular case, it is sufficient to verify the following property: if a formula F isobtained by any arbitrary substitution s from(A —i B —*• C) —* (D —¥ B) —> A A D ^ C then there always exists a substitution s*such that F > s*((A -* B -> C) -> (A -t B) -* A -t C). That proof easily proceedsfrom the fact that, for all substitution s, T-formulae P and Q,s(P ->Q)= s(P) -> s(Q) and s(P A Q) = s(P) A s(<?). So, for any formula F andcorresponding substitution 5, the substitutions s* can be defined ass*(B) = s{B),s*(C) = s(C) and s*(A) = s(A) A s(D),so that F > s*((A -> 5 -» C) -> (A -> 5) -> A -> C), from whichh* S : F = > f € s since s = THr o s.Inductive step.C = C1C2. The proof follows from the induction hypothesis by Lemma 2.10, since[C] = [d] o [C2].

2. This is by easy induction on the structure of w. In the inductive step the fusion betweendistinct elements is mapped into the inference rule (->E).

I

The logic LA corresponding to M can be defined as a Hilbert-style axiomatization, whoseaxioms namely are those of imphcational intuitionistic calculus. Denvability of A-types will betotally represented into derivability in LA.

DEFiNrnoN 4.6 (The Hilbert-style logic LA)Let Lr be defined as in Definition 3.2.Given the following list of definitionsAxioms

7) -> ((A -> B) -»• A -* C)(S) (^(K) {A

(D W

^ 5

Rules

(Sub-A): Any finite intersection of different instances of the same axiom is an axiom

(Sub): Any instance of an axiom is an axiom

MP (Modus Ponens): A -* B,A = > B

RMP (Relevant Modus Ponens): A ->• B G THr, A ==> B,

thenlet LA be the logic whose axioms are (S), (K), (I) and whose only inference rules are (Sub-A),

MP and RMP,let L _ be the logic with the same set of axioms and whose only inference rules are (Sub) and

MP.

NOTATION 4.7

77/A and 77/_ will denote the set of provable formulae in LA and L _ , respectively.

Page 14: Intersection Types as Logical Formulae - Semantic Scholar · Intersection Types as Logical Formulae 111 2 Intersection types for combinatory logic Let us outline the inference system

122 Intersection Types as Logical Formulae

The system L_, is the implication^ fragment of intuitionistic propositional logic, whoseclass of theorems 77/_ is well known to coincide with the set of inhabited types in Curry's typeinference system [7].

Now the logic LA is characterized as an extension of L_,, obtained

1. by adding the inference rule RMP2. by extending the usual notion of axiom-schemes, i.e. (Sub), as in the rule (Sub-A).

Both of the these operations, (1) and (2), are essentially needed to parallel intersection typetheory as proved in the present paper.

Let us notice that any application of the rule RMP could be restricted only to axiom (orassumption)-steps as minor premises, namely as in the construction of M. So an equivalentformulation of the logic LA can be done, in which the only inference rule is modus ponens, whilethe set of axioms is extended to all formulae provable from axioms by RMP; this corresponds toassume as axioms the whole set THr since A-¥ B € THr = > (A -t A) -4 A ->• B € THr.

Hence, since S, K and I are provable, the deduction theorem can be derived by using thestandard technique: a derivation of B from A is transformed into a proof of A —> B, by sticking'A —y' in front of every formula in the original deduction (see, for example, [18]). >

However the more general formulation of RMP defining LA in Definition 4.6 shows how tomap step-by-step any type derivation of TA*A into a LA -proof (Curry-Howard isomorphism),namely by translating any (<)-step as a RMP-application.

The following lemma concludes that the class of theorems THA coincides with the set ofinhabited types in intersection type theory.

LEMMA 4.8

For any arbitrary T-formula F,F € THA <=$• for any complete basis of initial combinators B, there exists aCLB-combinator C such that, in the system TA*A defined on p.t.s.s of B,

h* C : F (i.e. F is inhabited in A-type inference).

PROOF. The set of inhabited T-formulae in the system TAA is independent of the choice of thecomplete basis B, as essentially proved in [4]. So the present proof follows from the coincidencebetween TAA and TA*A (Theorem 2.13) and by Theorem 4.5. I

For example,(A-+ A-> B) -*• A -> B e THA (contraction law) and(A-> A-* S) -> A^B 6 [SS(KI)] in M.

REMARK 4.9

The logical axiomatization of A-derivability allows us to compare intersection with the usualpropositional connective of conjunction. Namely, instead of considering the A-operator as aproof theoretical operator (see discussion in section 1), the logic LA comes to be a propersubsystem of the conjunctive implicational (intuitionistic) calculus.

Let Lc (conjunctive logic) be defined as the logic whose axioms are (S), (K) and (I) plus thefollowing ones(Al) A-+ B -> AAB (A2) A A B ->• A (A3) A A B -> Band whose only inference rules are (Sub) and MP.

It is an easy matter to verify that, for any F € THT, F is also a theorem of Lc. As aconsequence, all the applications of RMP can be replaced in Lc by applications of MP, in such away that all theorems of LA are still provable in Lc.

Page 15: Intersection Types as Logical Formulae - Semantic Scholar · Intersection Types as Logical Formulae 111 2 Intersection types for combinatory logic Let us outline the inference system

Intersection Types as Logical Formulae 123

By a similar argument in the opposite direction one proves A A B -* A and4 A f l - > B , i.e. (A2) and (A3) belong to 77/A.

Moreover (A->B->C)-*(AAB-*AAB-*C)£ THA, from which the importationlaw is derived, that is

(imp) (A ->• B -> C) ->• (A A B -»• C) e THA, (by MP and the contraction law).

However, (Al) is provable neither in LT nor in LA, and so the exportation law(A A B ->> C) -»• (yl -4 5 -+ C) does not hold.

In other words, the A-derivability is a restricted form of introducing-conjunction obtained byconfining the adjunction rule to a subsystem of relevant implication (without weakening andcontraction), except for conjuncts which are instances of the same formula.

5 ConclusionSummarizing the results of the present paper, we have provided a Curry-Howard interpretationto the intersection type inference system for combinatory logic.

The key technical point consisted in reformulating the original type inference rules in such away as to drop out the (Al)-rule while proving its admissibility. This rule was the main technicalobstacle to the interpretation of the type intersection as a logical connective, due to the global,proof-functional, conditions of its applicability. Surprisingly, it turns out that all the power ofthe original formulation is preserved in the present new system by making essential use of theinference rule (<) instead of (AI).

Then we showed how the < preorder and intersection on types can be interpreted as a relevantimplication and conjunction in propositional formulae, respectively. Namely, we proved thatA < B holds, for implicative conjunctive type-formulae A and B, if and only if A —> B is atheorem of the minimal relevant logic (no weakening and contraction on —>).

In this manner, typable Combinators can be viewed as logical proofs for the (Hilbert-styleformulation of the) implicational fragment of intuitionistic propositional logic with the additionof all the theorems of minimal relevant logic. These theorems are used as major premises ofmodus ponens in order to derive intersection formulae.

A future work will consist in extending the present approach to encompass union types, look-ing for an interpretation of the resulting type system into 'resource' logics, notably linear logic [5].

Acknowledgements

We are very grateful to R. K. Meyer for many stimulating discussions and to J. R. Hindleyfor numerous helpful comments. We also wish to thank M. Dezani Ciancaglini for providinginvaluable guidance, advices and encouragement. Work partially supported by EEC 'ProjectStimulation ST2J/0374/C(EDB): Lambda Calcul Type'.

References[1] F. Alessi and F Barbanera, Strong conjunction and intersection types In Mathematical Foundations of Computer

Science, LNCS 520, pp 64-73, 1991

[2] H. P Barendregt, M. Coppo, and M Dezani-Ciancaglini, A filter lambda model and the completeness of typeassignment Notre Dame Journal of Formal Logic, 48, 931-940, 1983.

Page 16: Intersection Types as Logical Formulae - Semantic Scholar · Intersection Types as Logical Formulae 111 2 Intersection types for combinatory logic Let us outline the inference system

124 Intersection Types as Logical Formulae

[3] M Coppo, M. Dezaru-Ciancaglini, and B Vennen, Principal type schemes and lambda-calculus semantics In ToH B Curry. Essays on Combuuuory Logic, Lambda-calculus and Formalism, R Hindley and J Seldin, eds, pp480-490 Accademic Press, London, 1980

[4] M. Dezani-Ciancaglini and J R. Hindley, Intersection types for combinatory logic. Theoretical Computer Science,100, 303-324, 1992.

[5] J. Y. Girard, Linear logic Theoretical Computer Science, 50, 1-102, 1987.[6] J Y Girard, Y. Lafont, and P Taylor, Proof and Types. Cambridge University Press, 1989.[7] R. Hindley and D Meredith, Principal types schemes and condensed detachment. Journal of Symbolic Logic, 55,

90-105, 1990[8] R Hindley and J Seldin. Introduction to Combinators and X-Cakulus London Mathematical Society Student Texts

1. Cambridge University Press, London, 1986[9] W. A Howard, Formulae as types. In To H. B Curry Essays on Combinatory Logic, Lambda-calculus and

Formalism, R. Hindley and J. Seldin, eds Academic Press, London, 1980[10] E. G K.Lopez-Escobar, Proof functional connectives In LNM1130, pp 208-221, 1985[11] R K. Meyer and M. W Bunder, Condensed detachment and combinators, Technical report, TR-ARP8/88, Research

School of Social Sciences, Australian National University, 1988[12] R. K. Meyer and R Routley, Algebraic analysis of entailment I Logique et Analyse, 15, 407-428, 1972[13] R. K. Meyer and R Routley, The semantics of entailment III Journal of Philosophical Logic, 1,192-208, 1972[14] J.E Mints, The completeness of provable realizabihty. Notre Dame Journal of Formal Logic, 30,420-441, 1989[15]J.C Mitchell, Polymorfic type inference and containment Information and Compulation, 76, 211-249,1988[16] J. C Reynolds, Preliminary design of the programming language Forsyte, Technical report CMU-CS-85-159,

Computer Science Department, Carnegie-Mellon University, Pittsburgh, PA, June 1988[17] S Ronchi della Rocca and B Vennen, Principal types schemes for an extended type theory Theoretical Computer

Science, 28, 151-169, 1984[18] G Sundholm, Systems of deduction In Handbook of Philosophical Logic vol /, D Gabbay and F Guenthner, eds,

pp 133-188 D Reidel Publishing Company, Dordrecht, 1983[19] S van Bakel, Complete restrictions of intersection type discipline. Theoretical Computer Science, 102, 135-163,

1992

[20] H. Yokouchi, Embedding second order type system into intersection type system and its applications to typeinference. Technical report, IBM-Research, Tokyo Research Laboratory, Tokyo, September 1991

Received 20 June 1992