A journey through resource control lambda calculi and explicit substitution using intersection types (an account)
Silvia Ghilezan, Jelena Ivetic, Pierre Lescanne, Silvia Likavec
aa r X i v : . [ m a t h . L O ] J un A journey through resource control lambdacalculi and explicit substitution using intersectiontypes
S. Ghilezan ∗ , J. Iveti´c †1 , P. Lescanne ‡2 , and S. Likavec §31 University of Novi Sad, Faculty of Technical Sciences, Serbia University of Lyon, ´Ecole Normal Sup´erieure de Lyon, France Dipartimento di Informatica, Universit`a di Torino, Italy
Abstract
In this paper we invite the reader to a journey through three lambda calculiwith resource control: the lambda calculus, the sequent lambda calculus, and thelambda calculus with explicit substitution. All three calculi enable explicit controlof resources due to the presence of weakening and contraction operators. Alongthis journey, we propose intersection type assignment systems for all three resourcecontrol calculi. We recognise the need for three kinds of variables all requiringdifferent kinds of intersection types. Our main contribution is the characterisationof strong normalisation of reductions in all three calculi, using the techniques ofreducibility, head subject expansion, a combination of well-orders and suitableembeddings of terms.
Keywords: lambda calculus; resource control; sequent calculus; explicit substitu-tion; intersection types; strong normalisation; typeability
Introduction
It is well known that simply typed l -calculus captures the computational content ofintuitionistic natural deduction through Curry-Howard correspondence [34]. This con-nection between logic and computation can be extended to other calculi and logicalsystems [27]: Herbelin’s l -calculus [33], Pinto and Dyckhoff’s lps -calculus [49] andEsp´ırito Santo’s l Gtz -calculus [20] correspond to intuitionistic sequent calculus. In the ∗ Email: [email protected] † Email: [email protected] ‡ Email: [email protected] § Email: [email protected] l µ -calculus [48] corresponds to classical natural de-duction, whereas Barbanera and Berardi’s symmetric calculus [3] and Curien and Her-belin’s l µ e µ -calculus [14] correspond to its sequent version. Extending first, the l x cal-culus of explicit substitution and later l -calculus and l Gtz -calculus with explicit opera-tors for erasure (a.k.a. weakening) and duplication (a.k.a. contraction) brings the samecorrespondence to intuitionistic natural deduction and intuitionistic sequent calculuswith explicit structural rules of weakening and contraction on the logical side [24], asinvestigated in [35, 36, 26].On the other hand, let us consider type assignment systems for various calculi.To overcome the limitations of the simple type discipline in which the only formingoperator is an arrow → , a new type forming operator ∩ was introduced in [12, 13,50, 55]. The newly obtained intersection type assignment systems enabled completecharacterisation of termination of term calculi [60, 23, 25]. The extension of Curry-Howard correspondence to other formalisms brought the need for intersection typesinto many different settings [18, 39, 43, 46].Our work is inspired by and extends Kesner and Lengrand’s [35] work on resourceoperators for l -calculus with explicit substitution. Their linear l lxr -calculus introducesoperators for linear substitution, erasure and duplication, preserving at the same timeconfluence and full composition of explicit substitutions of its predecessor l x [8, 54].The simply typed version of this calculus corresponds to the intuitionistic fragment ofLinear Logic’s proof-nets, according to Curry-Howard correspondence, and it enjoysstrong normalisation and subject reduction. Resource control in sequent l -calculuswas proposed by Ghilezan et al. in [26], whereas resource control both in l -calculusand l x -calculus was further developed in [36, 37].In order to control all resources, in the spirit of l I -calculus (see e.g. [4]), voidlambda abstraction is not acceptable, so in order to have l x . M the variable x has tooccur in M . But if x is not used in a term M , one can perform an erasure (a.k.a weak-ening) by using the expression x ⊙ M . In this way, the term M does not contain thevariable x , but the term x ⊙ M does. Similarly, a variable should not occur twice. Ifnevertheless, we want to have two positions for the same variable, we have to duplicateit explicitly, using fresh names. This is done by using the operator x < x x M , called duplication (a.k.a contraction) which creates two fresh variables x and x .Explicit control of erasure and duplication leads to decomposing of reduction stepsinto more atomic steps, thus revealing the details of computation which are usually leftimplicit. Since erasing and duplicating of (sub)terms essentially changes the structureof a program, it is important to see how this mechanism really works and to be ableto control this part of computation. We chose a direct approach to term calculi ratherthan taking a more common path through linear logic [1, 7]. In practice, for instancein the description of compilers by rules with binders [52, 53], the implementation ofsubstitutions of linear variables by inlining is simple and efficient when substitutionof duplicated variables requires the cumbersome and time consuming mechanism ofpointers and it is therefore important to tightly control duplication. On the other hand,precise control of erasing does not require a garbage collector and prevents memory Inlining is the technics which consists in copying at compile time the text of a function instead ofimplementing a call to that function. l r (theextension of the l -calculus), l Gtz r (the extension of the sequent lambda calculus l Gtz )and l x r (the extension of the l x -calculus with explicit substitution). We then intro-duce intersection types into all three calculi l r , l Gtz r and l x r . Our intersection typeassignment systems l r ∩ , l Gtz r ∩ and l x r ∩ integrate intersection into logical rules, thuspreserving syntax-directedness of the system. We assign restricted form of intersec-tion types to terms, namely strict types, therefore minimizing the need for pre-order ontypes. By using these intersection type assignment systems we prove that terms in allthree calculi enjoy strong normalisation if and only if they are typeable. To the best ofour knowledge, together with the conference version of this paper [28], this is the firsttreatment of intersection types in the presence of resource control operators. Intersec-tion types fit naturally to resource control. Indeed, the control allows us to considerthree types of variables: variables as placeholders (the traditional view of l -calculus),variables to be duplicated and variables to be erased because they are irrelevant. Foreach kind of a variable, there is a kind of type associated to it, namely a strict type fora placeholder , an intersection for a variable to-be-duplicated , and a specific type for an erased variable.We first prove in Section 1 that terms typeable in l r -calculus are strongly normal-ising by adapting the reducibility method for explicit resource control operators. Thenwe prove that all strongly normalising terms are typeable in l r -calculus by using ty-peability of normal forms and head subject expansion.Further, we prove strong normalisation for l Gtz r and l x r , in Section 2 and Section 3,respectively, by using a combination of well-orders and a suitable embeddings of l Gtz r -terms and l x r -terms into l r -terms which preserve typeability and enable the simula-tion of all reductions and equations by the operational semantics of the l r -calculus.Finally, we prove that strong normalisation implies typeability in l Gtz r and l x r usinghead subject expansion. Related work
The idea to control the use of variables can be traced back to Church’s l I -calculus [4]. Currently there are several different lines of research in resource awareterm calculi. Van Oostrom [61] and later Kesner and Lengrand [35], applying ideasfrom linear logic [31], proposed to extend the l -calculus and the l x -calculus, with op-erators to control the use of variables (resources). Generalising this approach, Kesnerand Renaud [36, 37] developed the prismoid of resources , a system of eight calculiparametric over the explicit and implicit treatment of substitution, erasure and du-plication. Resource control in sequent calculus corresponding to classical logic wasproposed in [62]. On the other hand, process calculi and their relation to l -calculusby Boudol [9] initialised investigations in resource aware non-deterministic l -calculuswith multiplicities and a generalised notion of application [10]. The theory was con-nected to linear logic via differential l -calculus in [19] and typed with non-idempotentintersection types in [47]. In this paper we follow the notation of [62] and [28], which3s related to [61].This paper is an extended and revised version of [28]. In addition to l r -calculusand l Gtz r -calculus presented in [28], this extended version adds the treatment of the l x r -calculus, the resource lambda calculus with explicit substitution, together with thecharacterization of strong normalisation for this calculus. Also, the proof that typeabil-ity implies strong normalisation in l r -calculus is improved. Outline of the paper
In Section 1 we first give the syntax and reduction rules for l r -calculus, followed by the intersection type assignment system and the characterisationof strong normalisation. Section 2 deals with l Gtz r -calculus, its syntax, reduction rules,intersection type assignment system and the characterisation of strong normalisation.Section 3 introduces l x r -calculus with its syntax, reduction rules and intersection typeassignment system, again followed by the characterisation of strong normalisation. Fi-nally, we conclude in Section 4 with some directions for future work. Contents l r l r . . . . . . . . . . . . . . . . . 51.2 Intersection types for l r . . . . . . . . . . . . . . . . . . . . . . . . 101.3 Typeability ⇒ SN in l r ∩ . . . . . . . . . . . . . . . . . . . . . . . 141.4 SN ⇒ Typeability in l r ∩ . . . . . . . . . . . . . . . . . . . . . . . 20 l Gtz r l Gtz r . . . . . . . . . . . . 222.2 Intersection types for l Gtz r . . . . . . . . . . . . . . . . . . . . . . . . 232.3 Typeability ⇒ SN in l Gtz r ∩ . . . . . . . . . . . . . . . . . . . . . . . 262.4 SN ⇒ Typeability in l Gtz r ∩ . . . . . . . . . . . . . . . . . . . . . . . 31 l x r l x r . . . . 323.2 Intersection types for l x r . . . . . . . . . . . . . . . . . . . . . . . . 32 l r In this section we focus on the resource control lambda calculus l r . First we revisitits syntax and operational semantics; further we introduce intersection type assignmentsystem and finally we prove that typebility in the proposed system completely charac-terises the set of strongly normalising l r -terms.4 .1 Resource control lambda calculus l r The resource control lambda calculus, l r , is an extension of the l -calculus with ex-plicit operators for weakening and contraction. It corresponds to the l cw -calculus ofKesner and Renaud, proposed in [36] as a vertex of “the prismoid of resources”, wheresubstitution is implicit. We use a notation along the lines of [62] and close to [61]. Itis slightly modified w.r.t. [36] in order to emphasize the correspondence between thiscalculus and its sequent counterpart.First of all, we introduce the syntactic category of pre-terms of l r -calculus givenby the following abstract syntax:Pre-terms f :: = x | l x . f | f f | x ⊙ f | x < x x f where x ranges over a denumerable set of term variables. l x . f is an abstraction , f f is an application , x ⊙ f is a weakening and x < x x f is a contraction . The contractionoperator is assumed to be insensitive to the order of the arguments x and x , i.e. x < x x f = x < x x f .The set of free variables of a pre-term f , denoted by Fv ( f ) , is defined as follows: Fv ( x ) = x ; Fv ( l x . f ) = Fv ( f ) \ { x } ; Fv ( f g ) = Fv ( f ) ∪ Fv ( g ) ; Fv ( x ⊙ f ) = { x } ∪ Fv ( f ) ; Fv ( x < x x f ) = { x } ∪ Fv ( f ) \ { x , x } . In x < x x f , the contraction binds the variables x and x in f and introduces a freevariable x . The operator x ⊙ f also introduces a free variable x . In order to avoidparentheses, we let the scope of all binders extend to the right as much as possible.The set of l r - terms , denoted by L r and ranged over by M , N , P , M , ... . is a subsetof the set of pre-terms, defined in Figure 1. x ∈ L r f ∈ L r x ∈ Fv ( f ) l x . f ∈ L r f ∈ L r g ∈ L r Fv ( f ) ∩ Fv ( g ) = /0 f g ∈ L r f ∈ L r x / ∈ Fv ( f ) x ⊙ f ∈ L r f ∈ L r x = x x , x ∈ Fv ( f ) x / ∈ Fv ( f ) \ { x , x } x < x x f ∈ L r Figure 1: L r : l r -termsInformally, we say that a term is a pre-term in which in every subterm every freevariable occurs exactly once, and every binder binds (exactly one occurrence of) a freevariable. Our notion of terms corresponds to the notion of linear terms in [35]. In thatsense, only linear expressions are in the focus of our investigation. In other words,terms are well-formed in l r if and only if bound variables appear actually in the termand variables occur at most once. These conditions will be assumed throughout thepaper without mentioning them explicitly. This assumption is not a restriction, sinceevery traditional term has a corresponding l r -term, as illustrated by the followingexample. 5 xample 1. Pre-terms l x . y and l x . xx are not l r -terms, on the other hand pre-terms l x . ( x ⊙ y ) and l x . x < x x ( x x ) are their corresponding l r -terms. In the sequel, we use the notation X ⊙ M for x ⊙ ... x n ⊙ M and X < YZ M for x < y z ... x n < y n z n M , where X , Y and Z are lists of size n , consisting of all distinct variables x , ..., x n , y , ..., y n , z , ..., z n . If n =
0, i.e., if X is the empty list, then X ⊙ M = X < YZ M = M . Note that due to the equivalence relation defined in Figure 4, we can use thesenotations also for sets of variables of the same size.In what follows we use Barendregt’s convention [4] for variables: in the samecontext a variable cannot be both free and bound. This applies to binders like l x . M which binds x in M , x < x x M which binds x and x in M , and also to the implicitsubstitution M [ N / x ] which can be seen as a binder for x in M .The set r of reduction rules → l r of the l r -calculus is presented in Figure 2. ( b ) ( l x . M ) N → M [ N / x ]( g ) x < x x ( l y . M ) → l y . x < x x M ( g ) x < x x ( MN ) → ( x < x x M ) N , if x , x Fv ( N )( g ) x < x x ( MN ) → M ( x < x x N ) , if x , x Fv ( M )( w ) l x . ( y ⊙ M ) → y ⊙ ( l x . M ) , x = y ( w ) ( x ⊙ M ) N → x ⊙ ( MN )( w ) M ( x ⊙ N ) → x ⊙ ( MN )( gw ) x < x x ( y ⊙ M ) → y ⊙ ( x < x x M ) , y = x , x ( gw ) x < x x ( x ⊙ M ) → M [ x / x ] Figure 2: The set r of reduction rules of the l r -calculusThe reduction rules are divided into four groups. The main computational step is b reduction. The group of ( g ) reductions perform propagation of contraction into theexpression. Similarly, ( w ) reductions extract weakening out of expressions. This dis-cipline allows us to optimize the computation by delaying duplication of terms on theone hand, and by performing erasure of terms as soon as possible on the other. Finally,the rules in ( gw ) group explain the interaction between explicit resource operators thatare of different nature.The inductive definition of the meta operator [ / ] , representing the implicit substi-tution of free variables, is given in Figure 3. In order to obtain well formed terms asthe results of substitution, Fv ( M ) ∩ Fv ( N ) = /0 must hold in this definition. Moreover,notice that for the expression M [ N / x ] to make sense, M must contain exactly one oc-currence of the free variable x and M and N must share no variable but x . Indeed asubstitution is always created by a b -reduction and, in the term ( l x . M ) N , x has to ap-pear exactly once in M and the other variables of Fv ( M ) ∪ Fv ( N ) as well. Barendregtconvention on variable says that x should not occur freely in N . Also, if the terms N and N are obtained from the term N by renaming all the free variables in N by freshvariables, then M [ N / x , N / x ] denotes a parallel substitution. We prefer x not to belong to M in order to respect Barendregt convention on variable. [ N / x ] , N ( l y . M )[ N / x ] , l y . M [ N / x ] , x = y ( MP )[ N / x ] , M [ N / x ] P , x Fv ( P )( MP )[ N / x ] , MP [ N / x ] , x Fv ( M )( y ⊙ M )[ N / x ] , y ⊙ M [ N / x ] , x = y ( x ⊙ M )[ N / x ] , Fv ( N ) ⊙ M ( y < y y M )[ N / x ] , y < y y M [ N / x ] , x = y ( x < x x M )[ N / x ] , Fv ( N ) < Fv ( N ) Fv ( N ) M [ N / x , N / x ] Figure 3: Substitution in l r -calculus ( e ) x ⊙ ( y ⊙ M ) ≡ l r y ⊙ ( x ⊙ M )( e ) x < x x M ≡ l r x < x x M ( e ) x < yz ( y < uv M ) ≡ l r x < yu ( y < zv M )( e ) x < x x ( y < y y M ) ≡ l r y < y y ( x < x x M ) , x = y , y , y = x , x Figure 4: Equivalences in l r -calculus Definition 2 (Parallel substitution) . M [ N / x , P / z ] = ( M [ N / x ])[ P / z ] for x , z ∈ Fv ( M ) and ( Fv ( M ) \ { x } ) ∩ Fv ( N ) = ( Fv ( M ) \ { z } ) ∩ Fv ( P ) = Fv ( N ) ∩ Fv ( P ) = /0 .In the l r -calculus, one works modulo equivalencies given in Figure 4.Notice that because we work with l r terms, no variable is lost during the compu-tation, which is stated by the following proposition. Proposition 3.
If M → M ′ then Fv ( M ) = Fv ( M ′ ) . Proof.
The proof is by case analysis on the reduction rules.The following lemma explains how to compose implicit substitutions.
Lemma 4. • If z ∈ FV ( N ) then ( M [ N / x ])[ P / z ] = M [ N [ P / z ] / x ] . • If z ∈ FV ( M ) then ( M [ N / x ])[ P / z ] = ( M [ P / z ])[ N / x ] Proof.
Notice that for the expressions to make sense, one must have x ∈ Fv ( M ) and ( Fv ( M ) \{ x } ) ∩ Fv ( N ) = /0 , ( Fv ( N ) \{ z } ) ∩ Fv ( P ) = /0 and ( Fv ( M ) \ { x } ) ∩ Fv ( P ) = /0 . • ( x [ N / x ])[ P / z ] , N [ P / z ] and x [ N [ P / z ] / x ] , N [ P / z ] • (( l y . M )[ N / x ])[ P / z ] , ( l y . M [ N / x ])[ P / z ] , l y . ( M [ N / x ])[ P / z ] = IH l y . M [ N [ P / z ] / x ] , ( l y . M )[ N [ P / z ] / x ] , x , z = y x Fv ( Q ) (the case x Fv ( M ) is analogous) (( MQ )[ N / x ])[ P / z ] , ( M [ N / x ] Q )[ P / z ] = z ∈ Fv ( N ) ( M [ N / x ])[ P / z ] Q = IH M [ N [ P / z ] / x ] Q =( MQ )[ N [ P / z ] / x ] • (( y ⊙ M )[ N / x ])[ P / z ] , ( y ⊙ M [ N / x ])[ P / z ] , y ⊙ M [ N / x ][ P / z ] = IH y ⊙ M [ N [ P / z ] / x ] , ( y ⊙ M )[ N [ P / z ] / x ] , y = x , z • (( x ⊙ M )[ N / x ])[ P / z ] , ( Fv ( N ) ⊙ M )[ P / z ] = z ∈ Fv ( N ) ( z ⊙ { Fv ( N ) \ { z }} ⊙ M )[ P / z ] = { Fv ( P ) ∪ Fv ( N ) \ z } ⊙ M = Fv ( N [ P / z ]) ⊙ M , ( x ⊙ M )[ N [ P / z ] / x ] • (( y < y y M )[ N / x ])[ P / z ] , ( y < y y M [ N / x ])[ P / z ] , y < y y M [ N / x ][ P / z ] = IH y < y y M [[ P / z ] N / x ] = IH ( y < y y M )[[ P / z ] N / x ] , x = y • (( x < x x M )[ N / x ])[ P / z ] , ( Fv ( N ) < Fv ( N ) Fv ( N ) M [ N / x , N / x ])[ P / z ] , Fv ( N ) < Fv ( N ) Fv ( N ) M [ N / x ][ N / x ][ P / z ] = z < z z Fv ( N ) \ { z } < Fv ( N ) \{ z } Fv ( N ) \{ z } M [ N / x ][ N / x ][ P / z ] , Fv ( P ) < Fv ( P ) Fv ( P ) Fv ( N ) \ { z } < Fv ( N ) \{ z } Fv ( N ) \{ z } M [ N / x ][ N / x ][ P / z ][ P / z ] = IH Fv ( P ) ∪ Fv ( N ) \ { z } < Fv ( P ) ∪ Fv ( N ) \{ z } Fv ( P ) ∪ Fv ( N ) \{ z } M [ N [ P / z ] / x , N [ P / z ] / x ] , ( x < x x M )[ N [ P / z ] / x ] . We used the fact that z ∈ Fv ( N ) and z ∈ Fv ( N ) .In the following lemma, by → ∗ we denote the reflexive and transitive closure of thereductions and equivalences of l r -calculus, i.e., → ∗ , ( → l r ∪ ≡ l r ) ∗ . Lemma 5. (i) M [ y ⊙ N / x ] → ∗ y ⊙ M [ N / x ] (ii) y < y y M [ N / x ] → ∗ M [ y < y y N / x ] , for y , y / ∈ Fv ( M ) .Proof. The proof is by induction on the structure of the term M .(i) – M = x . Then M [ y ⊙ N / x ] = x [ y ⊙ N / x ] , y ⊙ N , y ⊙ x [ N / x ] = y ⊙ M [ N / x ] . – M = l z . P . Then M [ y ⊙ N / x ] = ( l z . P )[ y ⊙ N / x ] , l z . P [ y ⊙ N / x ] → IH l z . ( y ⊙ P [ N / x ]) → w y ⊙ ( l z . P [ N / x ]) , y ⊙ ( l z . P )[ N / x ] = y ⊙ M [ N / x ] . – M = PQ . We will treat the case when x Fv ( Q ) . The case when x Fv ( P ) is analogous.Then M [ y ⊙ N / x ] = ( PQ )[ y ⊙ N / x ] , P [ y ⊙ N / x ] Q → IH ( y ⊙ P [ N / x ]) Q → w y ⊙ ( P [ N / x ] Q ) , y ⊙ ( PQ )[ N / x ] = y ⊙ M [ N / x ] . – M = z ⊙ P . Then M [ y ⊙ N / x ] = ( z ⊙ P )[ y ⊙ N / x ] , z ⊙ P [ y ⊙ N / x ] → IH z ⊙ y ⊙ P [ N / x ] ≡ e y ⊙ z ⊙ P [ N / x ] = y ⊙ M [ N / x ] . – M = x ⊙ P . Then M [ y ⊙ N / x ] = ( x ⊙ P )[ y ⊙ N / x ] , Fv ( y ⊙ N ) ⊙ P = y ⊙ Fv ( N ) ⊙ P , y ⊙ ( x ⊙ P )[ N / x ] = y ⊙ M [ N / x ] , since x Fv ( P ) .8 M = z < z z P . Then M [ y ⊙ N / x ] = ( z < z z P )[ y ⊙ N / x ] , z < z z P [ y ⊙ N / x ] → IH z < z z ( y ⊙ P [ N / x ]) → gw y ⊙ ( z < z z P [ N / x ]) = y ⊙ M [ N / x ] . – M = x < x x P . Then M [ y ⊙ N / x ] = ( x < x x P )[ y ⊙ N / x ] , Fv ( y ⊙ N ) < Fv ( y ⊙ N ) Fv ( y ⊙ N ) P [ y ⊙ N / x , y ⊙ N / x ] → IH Fv ( y ⊙ N ) < Fv ( y ⊙ N ) Fv ( y ⊙ N ) y ⊙ y ⊙ P [ N / x , N / x ] = Fv ( N ) < Fv ( N ) Fv ( N ) y < y y y ⊙ y ⊙ P [ N / x , N / x ] → gw Fv ( N ) < Fv ( N ) Fv ( N ) y ⊙ P [ N / x , N / x ] → gw y ⊙ Fv ( N ) < Fv ( N ) Fv ( N ) P [ N / x , N / x ] , y ⊙ ( x < x x P [ N / x ]) = y ⊙ M [ N / x ] .(ii) – M = x . Then y < y y M [ N / x ] = y < y y x [ N / x ] , y < y y N , x [ y < y y N / x ] = M [ y < y y N / x ] . – M = l z . P . Then y < y y M [ N / x ] = y < y y ( l z . P )[ N / x ] , y < y y l z . P [ N / x ] → g l z . y < y y P [ N / x ] → IH l z . P [ y < y y N / x ] , ( l z . P )[ y < y y N / x ] = M [ y < y y N / x ] . – M = PQ , x Fv ( Q ) . The case when x Fv ( P ) is analogous.Then y < y y M [ N / x ] = y < y y ( PQ )[ N / x ] , y < y y P [ N / x ] Q → g ( y < y y P [ N / x ]) Q → IH P [ y < y y N / x ] Q , ( PQ )[ y < y y N / x ] = M [ y < y y N / x ] . – M = z ⊙ P , where z = x , y , y . Then y < y y M [ N / x ] = y < y y ( z ⊙ P )[ N / x ] , y < y y z ⊙ P [ N / x ] → gw z ⊙ y < y y P [ N / x ] → IH z ⊙ P [ y < y y N / x ] , ( z ⊙ P )[ y < y y N / x ] = M [ y < y y N / x ] . – M = x ⊙ P . Then y < y y M [ N / x ] = y < y y ( x ⊙ P )[ N / x ] , y < y y Fv ( N ) ⊙ P . Since y , y ∈ Fv ( N ) we have that y < y y y ⊙ y ⊙ Fv ( N ) \{ y , y }⊙ P → gw y ⊙ Fv ( N ) \ { y , y } ⊙ P . On the other hand, M [ y < y y N / x ] = ( x ⊙ P )[ y < y y N / x ] , Fv ( y < y y N ) ⊙ P = y ⊙ Fv ( N ) \ { y , y } ⊙ P , so the proposition is proved. – M = z < z z P . Then y < y y M [ N / x ] = y < y y ( z < z z P )[ N / x ] , y < y y z < z z P [ N / x ] ≡ l r z < z z y < y y P [ N / x ] → IH z < z z P [ y < y y N / x ] , ( z < z z P )[ y < y y N / x ] = M [ y < y y N / x ] . – y < y y M [ N / x ] = y < y y ( x < x x P )[ N / x ] , y < y y Fv ( N ) < Fv ( N ) Fv ( N ) P [ N / x , N / x ] = y < y y y < y ′ y ′ y < y ′′ y ′′ Fv ( N ) \ { y , y } < Fv ( N ) \{ y ′ , y ′′ } Fv ( N ) \{ y ′ , y ′′ } P [ N / x , N / x ] ≡ l r y < y y ′ y < y y ′ y < y ′′ y ′′ Fv ( N ) \ { y , y } < Fv ( N ) \{ y ′ , y ′′ } Fv ( N ) \{ y ′ , y ′′ } P [ N / x , N / x ] ≡ l r y < y y ′ y < y y ′′ y < y ′ y ′′ Fv ( N ) \ { y , y } < Fv ( N ) \{ y ′ , y ′′ } Fv ( N ) \{ y ′ , y ′′ } P [ N / x , N / x ] ≡ l r y < y y y < y ′ y ′′ y < y ′ y ′′ Fv ( N ) \ { y , y } < Fv ( N ) \{ y ′ , y ′′ } Fv ( N ) \{ y ′ , y ′′ } P [ N / x , N / x ] ≡ l r y < y y Fv ( N ) \ { y , y } < Fv ( N ) \{ y ′ , y ′′ } Fv ( N ) \{ y ′ , y ′′ } y < y ′ y ′′ y < y ′ y ′′ P [ N / x , N / x ] → IHx y < y y Fv ( N ) \ { y , y } < Fv ( N ) \{ y ′ , y ′′ } Fv ( N ) \{ y ′ , y ′′ } P [( y < y ′ y ′′ N ) / x , ( y < y ′ y ′′ N ) / x ] On the other hand, rewriting the right hand side yields: M [ y < y y N / x ] = ( x < x x P )[ y < y y N / x ] , v ( y < y y N ) < Fv ( y < y y N ′ ) Fv ( y < y y N ′ ) P [( y < y y N ′ ) / x , ( y < y y N ′ ) / x ] By renaming y → y ′ and y → y ′′ in y < y y N ′ and y → y ′ and y → y ′′ in y < y y N ′ we get Fv ( y < y y N ) < Fv ( y < y ′ y ′′ N ) Fv ( y < y ′ y ′′ N ) P [( y < y ′ y ′′ N ) / x , ( y < y ′ y ′′ N ) / x ] where N ′ [ y ′ / y , y ′′ / y ] = N and N ′ [ y ′ / y , y ′′ / y ] = N . Finally, by renaming y → y and y → y we get Fv ( y < y y N ) < Fv ( y < y ′ y ′′ N ) Fv ( y < y ′ y ′′ N ) P [( y < y ′ y ′′ N ) / x , ( y < y ′ y ′′ N ) / x ] = y < y y Fv ( N ) \ { y , y } < Fv ( N ) \{ y ′ , y ′′ } Fv ( N ) \{ y ′ , y ′′ } P [( y < y ′ y ′′ N ) / x , ( y < y ′ y ′′ N ) / x ] which completes the proof.Since the last case of the previous lemma is a bit tricky, let us illustrate it with thefollowing example. Example 6.
Let M = x < x x x x and N = y y . Then y < y y M [ N / x ] = y < y y x < x x x x [( y y ) / x ] , y < y y Fv ( y y ) < Fv ( z z ) Fv ( w w ) x x [( z z ) / x , ( w w ) / x ] = y < y y y < z w y < z w x x [( z z ) / x , ( w w ) / x ] ≡ l r , ( × e ) y < y y y < z z y < w w ( z z )( w w ) = M .On the other hand: x < x x x x [ y < y y y y / x ] , Fv ( y < y y y y ) < Fv ( y < y y y y ) Fv ( y < y y y y ) ( x x )[( y < y y y y ) / x , ( y < y y y y ) / x ] = y < y y ( y < y y y y )( y < y y y y ) . By renaming y → z , y → z in the first bracket, and y → w , y → w in the secondone we obtain: y < y y ( y < z z z z )( y < w w w w ) . By renaming y → y , y → y we get y < y y ( y < z z z z )( y < w w w w ) = M . Finally, M → g , g M . l r In this subsection we introduce an intersection type assignment system which assigns strict types to l r -terms. Strict types were proposed in [60] and used in [22] for char-acterisation of strong normalisation in l Gtz -calculus.The syntax of types is defined as follows:Strict types s :: = p | a → s Types a :: = ∩ ni s i p ranges over a denumerable set of type atoms, and ∩ ni s i stands for s ∩ . . . ∩ s n , n ≥
0. Particularly, if n =
0, then ∩ i s i represents the neutral element for the inter-section operator, denoted by ⊤ .We denote types with a , b , g ... , strict types with s , t , u ... and the set of all types by Types . We assume that the intersection operator is idempotent, commutative and asso-ciative. We also assume that intersection has priority over the arrow operator. Hence,we will omit parenthesis in expressions like ( ∩ ni t i ) → s . Definition 7. (i) A basic type assignment is an expression of the form x : a , where x is a termvariable and a is a type.(ii) A basis G is a set { x : a , . . . , x n : a n } of basic type assignments, where all termvariables are different. Dom ( G ) = { x , . . . , x n } . A basis extension G , x : a denotesthe set G ∪ { x : a } , where x Dom ( G ) . (iii) A bases intersection is defined as: G ⊓ D = { x : a ∩ b | x : a ∈ G & x : b ∈ D & Dom ( G ) = Dom ( D ) } . (iv) G ⊤ = { x : ⊤ | x ∈ Dom ( G ) } . In what follows we assume that the bases intersection has priority over the basisextension, hence the parenthesis in G , ( D ⊓ . . . ⊓ D n ) will be omitted. It is easy to showthat G ⊤ ⊓ D = D for arbitrary bases G and D that can be intersected, hence G ⊤ can beconsidered the neutral element for the bases intersection. x : s ⊢ x : s ( Ax ) G , x : a ⊢ M : sG ⊢ l x . M : a → s ( → I ) G ⊢ M : ∩ ni t i → s D ⊢ N : t . . . D n ⊢ N : t n G , D ⊤ ⊓ D ⊓ ... ⊓ D n ⊢ MN : s ( → E ) G , x : a , y : b ⊢ M : sG , z : a ∩ b ⊢ z < xy M : s ( Cont ) G ⊢ M : sG , x : ⊤ ⊢ x ⊙ M : s ( Weak ) Figure 5: l r ∩ : l r -calculus with intersection typesThe type assignment system l r ∩ is given in Figure 5. Notice that in the syntax of l r there are three kinds of variables according to the way they are introduced, namelyas a placeholder, as a result of a contraction or as a result of a weakening. Each kind of avariable receives a specific type. Variables as placeholders have a strict type, variablesresulting from a contraction have an intersection type and variables resulting from aweakening have a ⊤ type. Moreover, notice that intersection types occur only in twoinference rules. In the rule ( Cont ) the intersection type is created, this being the only place where this happens. This is justified because it corresponds to the duplication of11 variable. In other words, the control on the duplication of variables entails the controlon the introduction of intersections in building the type of the term in question. In therule ( → E ) , intersection appears on the right hand side of ⊢ sign which correspondsto the usage of the intersection type after it has been created by the rule ( Cont ) or bythe rule ( Weak ) if n =
0. In this inference rule, the role of D should be noticed. It isneeded only when n = N has a type, i.e. that N is strongly normalizing.Then, in the bottom of the rule, the types of the free variables of N can be forgotten,hence all the free variables of N receive the type ⊤ . All the free variables of the termmust occur in the environment (see Lemma 8), therefore useless variables occur withthe type ⊤ . If n is not 0, then D can be any of the other environments and the typeof N the associated type. Since D ⊤ is a neutral element for ⊓ , then D ⊤ disappears inthe bottom of the rule. The case for n = ( drop ) and/or (K-cup) in [42] and was used to present the two cases, n = n = ( Weak ) the choice of the type of x is ⊤ , since this corresponds to a variablewhich does not occur anywhere in M . The remaining rules, namely ( Ax ) and ( → I ) aretraditional, i.e. they are the same as in the simply typed l -calculus. Noticed howeverthat the type of the variable in ( Ax ) is a strict type. Lemma 8 (Domain Correspondence for l r ∩ ) . Let G ⊢ M : s be a typing judgment.Then x ∈ Dom ( G ) if and only if x ∈ Fv ( M ) .Proof. The rules of Figure 5 belong to three categories.1.
The rules that introduce a variable . These rules are (Ax) , ( Cont ) and ( Weak ) .One sees that the variable is introduced in the environment if and only it is intro-duced in the term as a free variable.2. The rules that remove variables . These rules are ( → I ) and ( Cont ) . One sees thatthe variables are removed from the environment if and only if they are removedfrom the term as a free variable.3. The rule that does not introduce and does not remove a variable . This rule is ( → E ) .Notice that ( Cont ) introduces and removes variables.The Generation Lemma makes somewhat more precise the Domain Correspon-dence Lemma. Lemma 9 (Generation lemma for l r ∩ ) . (i) G ⊢ l x . M : t iff there exist a and s such that t ≡ a → s and G , x : a ⊢ M : s . (ii) G ⊢ MN : s iff and there exist D i and t i , i = , . . . , n such that G ′ ⊢ M : ∩ ni t i → s and for all i ∈ { , . . . , n } , D i ⊢ N : t i and G = G ′ , D ⊤ ⊓ D ⊓ . . . ⊓ D n .(iii) G ⊢ z < xy M : s iff there exist G ′ , a , b such that G = G ′ , z : a ∩ b and G ′ , x : a , y : b ⊢ M : s . (iv) G ⊢ x ⊙ M : s iff G = G ′ , x : ⊤ and G ′ ⊢ M : s . roof. The proof is straightforward since all the rules are syntax directed.The proposed system satisfies the following properties.
Lemma 10 (Substitution lemma for l r ∩ ) . If G , x : ∩ ni t i ⊢ M : s and for all i ∈{ , . . . , n } , D i ⊢ N : t i , then G , D ⊤ ⊓ D ⊓ ... ⊓ D n ⊢ M [ N / x ] : s . Proof.
The proof is by induction on the structure of the term M . We only show theinteresting cases. • Base case M = x . By the axiom x : t ⊢ x : t where t = ∩ i t i , i.e. n =
1, hence thesecond assumption is D ⊢ N : t which proves the case since N , x [ N / x ] . • M = x ⊙ P . Now we assume G , x : ∩ i t i ⊢ x ⊙ P : s and D i ⊢ N : t i for all i ∈ { , . . . , } , in other words G , x : ⊤ ⊢ x ⊙ P : s and D ⊢ N : t (i.e. N is ty-peable). By Generation lemma 9 ( iv ) we get G ⊢ P : s . Since Dom ( D ) = Fv ( N ) by applying the ( Weak ) rule multiple times we get G , D ⊤ ⊢ Fv ( N ) ⊙ P ⊢ s whichis exactly what we want to prove. • M = x < x x P . From G , x : ∩ ni t i ⊢ x < x x P : s , by Generation lemma 9 ( iii ) we getthat ∩ ni t i = ∩ mi = t i ∩ ∩ ni = m + t i for some m < n and G , x : ∩ mi t i , x : ∩ ni = m + t i ⊢ P : s . From the other assumption D i ⊢ N : t i for all i ∈ { , . . . , n } , by renaming thevariables in D i (i.e. the free variables of N ) we get two different sets of sequents: D ′ j ⊢ N : t j for j = , . . . , m and D ′′ k ⊢ N : t k for k = m + , . . . , n . By applying IHtwice, we get G , D ′⊤ ⊓ D ′ ⊓ . . . ⊓ D ′ m , D ′′⊤ ⊓ D ′′ m + ⊓ . . . ⊓ D ′′ n ⊢ ( P [ N / x ])[ N / x ] : s . Now, we apply the definition of the parallel substitution, and perform con-traction on all pairs of corresponding (i.e. obtained by the renaming of the samevariable) elements of D ′ j and D ′′ k by introducing again the original names of thefree variables of N from D i and finally get what we need: G , D ⊤ ⊓ D ⊓ . . . ⊓ D n ⊢ Fv ( N ) < Fv ( N ) Fv ( N ) P [ N / x , N / x ] : s . Proposition 11 (Subject reduction and equivalence) . For every l r -term M: if G ⊢ M : s and M → M ′ or M ≡ M, then G ⊢ M ′ : s . Proof.
The proof is done by the case analysis on the applied reduction. Since the prop-erty is stable by context, we can without losing generality assume that the reductiontakes place at the outermost position of the term. Here we just show several cases. Wewill use GL as an abbreviation for Generation lemma 9. • Case ( b ) : Let G ⊢ ( l x . M ) N : s . We want to show that G ⊢ M [ N / x ] : s . From G ⊢ ( l x . M ) N : s and from GL(ii) it follows that G = G ′ , D ⊤ ⊓ D ⊓ . . . ⊓ D n ,and that there is a type ∩ ni t i such that for all i = , . . . , n , D i ⊢ N : t i , and G ′ ⊢ l x . M : ∩ ni t i → s . Further, by GL(i) we have that G ′ , x : ∩ ni t i ⊢ M : s . Now, allthe assumptions of Substitution lemma 10 hold, yielding G ′ , D ⊤ ⊓ D ⊓ . . . ⊓ D n ⊢ M [ N / x ] : s which is exactly what we need, since G = D ⊤ ⊓ G ′ , D ⊓ . . . ⊓ D n .13 Case ( gw ) : Let G ⊢ x < x x x ⊙ M : s . We are showing that G ⊢ M [ x / x ] : s .From the first sequent by GL(iii) we have that G = G ′ , x : a ∩ b and G ′ , x : a , x : b ⊢ x ⊙ M : s . Further, by GL(iv) we conclude that a ≡ ⊤ , x : ⊤ ∩ b ≡ b and G ′ , x : b ⊢ M : s . Since b = ∩ ni t i for some n ≥
0, by applying Substitutionlemma 10 to G ′ , x : b ⊢ M : s and x : t i ⊢ x : t i , i = , . . . , n we get G ⊢ M [ x / x ] : s . • The other rules are easy since they do not essentially change the structure of theterm.Due to this property, equivalent terms have the same type. ⇒ SN in l r ∩ In various type assignment systems, the reducibility method can be used to prove manyreduction properties of typeable terms. It was first introduced by Tait [58] for provingthe strong normalisation of simply typed l -calculus, and developed further to prove strong normalisation of various calculi in [59, 30, 41, 25, 29], confluence (the Church-Rosser property) of bh -reduction in [40, 57, 44, 45, 29] and to characterise certainclasses of l -terms such as strongly normalising, normalising, head normalising, andweak head normalising terms (and their persistent versions) by their typeability in var-ious intersection type systems in [23, 17, 15, 16].The main idea of the reducibility method is to interpret types by suitable sets oflambda terms which satisfy some realizability properties and prove the soundness oftype assignment with respect to these interpretations. A consequence of soundness isthat every typeable term belongs to the interpretation of its type, hence satisfying adesired reduction property.In the remainder of the paper we consider L r as the applicative structure whosedomain are l r -terms and where the application is just the application of l r -terms.The set of strongly normalizing terms is defined as the smallest subset of L r such that: M ′ ∈ S N M → M ′ M ∈ S N
Definition 12.
For M , N ⊆ L r , we define M / / N ⊆ L r as M / / N = { N ∈ L r | ∀ M ∈ M NM ∈ N ) } . Definition 13.
The type interpretation [[ − ]] : Types → L r is defined by:( I [[ p ]] = S N , where p is a type atom;( I [[ a → s ]] = [[ a ]] / / [[ s ]] ;( I [[ ∩ ni s i ]] = ∩ ni [[ s i ]] and [[ ∩ i s i ]] = S N .14ext, we introduce the notions of variable property, reduction property, expansionproperty, weakening property and contraction property.
Variable property and expan-sion property correspond to the saturation property given in [5], whereas reductionproperty corresponds to the property CR 2 in Chapter 6 of [32]. To this aim we willuse the following notation: recall that r denotes the set of reductions given in Fig-ure 2. If µ ∈ r , then redex V µ denotes a redex, that is a term which is an instance by themeta-substitution V of the left hand side of the reduction µ . Whereas contr V µ denotes theinstance of the right hand side of the same reduction µ by the same meta-substitution V . Definition 14. • A set X ⊆ L r satisfies the variable property , notation VAR ( X ) , if X contains allthe terms of the form xM . . . M n for M i ∈ S N . • A set X ⊆ L r satisfies the reduction property , notation RED ( X ) , if X is stableby reduction, in other words M ∈ X and M → M ′ imply M ′ ∈ X . • A set X ⊆ L r satisfies the expansion property , notation EXP µ ( X ) where µ is arule in r , if : M ∈ S N . . . M n ∈ S N contr V µ M . . . M n ∈ X EXP µ ( X ) redex V µ M . . . M n ∈ X . • A set X ⊆ L r satisfies the weakening property , notation WEAK ( X ) if: M ∈ X WEAK ( X ) x ⊙ M ∈ X . • A set X ⊆ L r satisfies the contraction property , notation CONT ( X ) if: M ∈ X CONT ( X ) x < yz M ∈ X . Remark.
In the previous definition (Definition 14) it is not necessary to explicitly writethe conditions about free variables since we work with l r -terms. Definition 15 ( r -Saturated set) . A set X ⊆ L r is called r -saturated , if • X ⊆ S N and • X satisfies the variable, reduction, expansion, weakening and contraction prop-erties. Proposition 16.
Let M , N ⊆ L r . Meta-substitution is a substitution that assigns values to meta-variables. Notice that we do not need a condition that N ∈ SN in EXP b ( X ) , as in ordinary l -calculus, since weonly work with linear terms, hence if the contractum M [ N / x ] ∈ SN , then N ∈ SN . i) S N is r -saturated.(ii) If M and N are r -saturated, then M / / N is r -saturated.(iii) If M and N are r -saturated, then M ∩ N is r -saturated.(iv) For all types j ∈ Types, [[ j ]] is r -saturated.Proof. (i) • S N ⊆ S N , VAR ( S N ) and RED ( S N ) trivially hold. • EXP b ( S N ) . Suppose that M [ N / x ] M . . . M n ∈ S N and M , . . . , M n ∈ S N . Since M [ N / x ] is a subterm of a term in S N , we know that M ∈ S N . Also, since M [ N / x ] ∈ S N and M is linear, N ∈ S N . By assumption, M , . . . , M n ∈ S N ,so the reductions inside of these terms terminate. After finitely many reductionsteps, we obtain ( l x . M ) NM . . . M n → . . . → ( l x . M ′ ) N ′ M ′ . . . M ′ n where M → M ′ , N → N ′ , M → M ′ , . . . , M n → M ′ n . After contracting ( l x . M ′ ) N ′ M ′ . . . M ′ n to M ′ [ N ′ / x ] M ′ . . . M ′ n , we obtain a reduct of M [ N / x ] M . . . M n ∈ S N . Hence, ( l x . M ) NM . . . M n ∈ S N . • EXP µ ( S N ) . Analogous to EXP b ( S N ) . • WEAK ( S N ) . Suppose that M ∈ S N and x Fv ( M ) . Then trivially x ⊙ M ∈ S N ,since no new redexes are formed. • CONT ( S N ) . Suppose that M ∈ S N , y = z , y , z ∈ Fv ( M ) , x Fv ( M ) \ { y , z } .We prove x < yz M ∈ S N by induction on the structure of M . – M = l w . N . Then N ∈ S N and x < yz M = x < yz ( l w . N ) → g l w . x < yz N ∈ S N , since x < yz N ∈ S N by IH. – M = PQ . Then P , Q ∈ S N and if y , z Fv ( Q ) , x < yz M = x < yz ( PQ ) → g ( x < yz P ) Q ∈ S N , since by IH x < yz P ∈ S N .The case of → g reduction is analogous. – M = w ⊙ N . Then x < yz M = x < yz ( w ⊙ N ) → gw w ⊙ ( x < yz N ) . By IH x < yz N ∈ S N and w ⊙ ( x < yz N ) does not introduce any new redexes. – M = y ⊙ N . Then x < yz M = x < yz ( y ⊙ N ) → gw N [ x / z ] ∈ S N , since N ∈ S N by IH.(ii) • M / / N ⊆ S N . Suppose that M ∈ M / / N . Then, for all N ∈ M , MN ∈ N . Since M is r -saturated, VAR ( M ) holds so x ∈ M and Mx ∈ N ⊆ S N . From here we can deduce that M ∈ S N . • VAR ( M / / N ) . Suppose that x ∈ var , and M , . . . , M n ∈ S N , n ≥
0, such that x ∩ Fv ( M ) ∩ . . . ∩ Fv ( M n ) = /0 . We need to show that xM . . . M n ∈ M / / N , i.e. ∀ N ∈ M , xM . . . M n N ∈ N . This holds since by IH M ⊆ S N and N is r -saturated, i.e. VAR ( N ) holds. 16 RED ( M / / N ) . Let M ∈ M / / N and M ′ be such that M → M ′ and let N ∈ M . We know that MN ∈ N and MN → M ′ N . By IH, M ′ N ∈ N hence M ′ ∈ M / / N . • EXP b ( M / / N ) . Suppose that M [ N / x ] M . . . M n ∈ M / / N and M , . . . , M n ∈ S N . This means that for all P ∈ M , M [ N / x ] M . . . M n P ∈ N . But N is r -saturated, so EXP b ( N ) holds and we have that for all P ∈ N , ( l x . M ) NM . . . M n P ∈ N . This means that ( l x . M ) NM . . . M n ∈ M / / N . • EXP µ ( M / / N ) . Analogous to EXP b ( M / / N ) . • WEAK ( M / / N ) . Suppose that M ∈ M / / N and x Fv ( M ) . This meansthat for all N ∈ M , MN ∈ N . But N is r -saturated, i.e. WEAK ( N ) holds, hence x ⊙ ( MN ) ∈ N . Also EXP w ( N ) holds so we obtain for all N ∈ M , ( x ⊙ M ) N ∈ N , i.e x ⊙ M ∈ M / / N . • CONT ( M / / N ) . Let M ∈ M / / N . We want to prove that x < yz M ∈ M / / N for y = z , y , z ∈ Fv ( M ) and x Fv ( M ) . Let P be any term in M .We have to prove that ( x < yz M ) P ∈ N . Since M ∈ M / / N , we know that M P ∈ N . By IH x < yz ( M P ) ∈ N . By reduction g and hence by RED ( N ) wehave ( x < yz M ) P ∈ N . Therefore x < yz M ∈ M / / N .(iii) • M ∩ N ⊆ S N is straightforward, since M , N ⊆ S N by IH. • VAR ( M ∩ N ) . Since VAR ( M ) and VAR ( N ) hold, we have that ∀ M , . . . , M n ∈ S N , n ≥ xM . . . M n ∈ M and xM . . . M n ∈ N . We deduce that ∀ M , . . . , M n ∈ S N , n ≥ xM . . . M n ∈ M ∩ N , i.e. VAR ( M ∩ N ) holds. • RED ( M ∩ N ) is straightforward. • EXP b ( M ∩ N ) and EXP µ ( M ∩ N ) are straightforward. • WEAK ( M ∩ N ) . Let M ∈ M ∩ N and x Fv ( M ) . Then M ∈ M and M ∈ N .Since both M and N are r -saturated WEAK ( M ) and WEAK ( N ) hold, henceby IH x ⊙ M ∈ M and x ⊙ M ∈ N , i.e. x ⊙ M ∈ M ∩ N . • CONT ( M ∩ N ) . Suppose that M ∈ M ∩ N , y = z , y , z ∈ Fv ( M ) , x Fv ( M ) \{ y , z } . Since both M and N are r -saturated CONT ( M ) and CONT ( N ) hold,hence by IH x < yz M ∈ M and x < yz M ∈ N , i.e. x < yz M ∈ M ∩ N .(iv) By induction on the construction of j ∈ Types . • If j ≡ p , p a type atom, then [[ j ]] = S N , so it is r -saturated using (i). • If j ≡ a → s , then [[ j ]] = [[ a ]] / / [[ s ]] . Since [[ a ]] and [[ s ]] are r -saturated byIH, we can use (ii). • If j ≡ ∩ ni s i , then [[ j ]] = [[ ∩ ni s i ]] = ∩ ni [[ s i ]] and for all i = , . . . , n , [[ s i ]] are r -saturated by IH, so we can use (iii). If j ≡ ∩ i s i , then [[ j ]] = S N
17e further define a valuation of terms [[ − ]] r : L r → L r and the semantic satisfia-bility relation | = connecting the type interpretation with the term valuation. Definition 17.
Let r : var → L r be a valuation of term variables in L r . For M ∈ L r ,with Fv ( M ) = { x , . . . , x n } the term valuation [[ − ]] r : L r → L r is defined as follows: [[ M ]] r = M [ r ( x ) / x , . . . , r ( x n ) / x n ] . providing that x = y ⇒ Fv ( r ( x )) ∩ Fv ( r ( y )) = /0 . Notation: r ( N / x ) is the valuation defined as: r ( N / x )( y ) = (cid:26) r ( y ) if x = yN otherwise Lemma 18. (i) [[ MN ]] r = [[ M ]] r [[ N ]] r (ii) [[ l x . M ]] r N → [[ M ]] r ( N / x ) .(iii) [[ x ⊙ M ]] r = Fv ( r ( x )) ⊙ [[ M ]] r . (iv) [[ z < xy M ]] r = Fv ( N ) < Fv ( N ) Fv ( N ) [[ M ]] r ( N / x , N / y ) where N = r ( z ) , N , N are obtained from N by renaming its free variables.Proof. (i) Straightforward from the definition of substitution given in Figure 3.(ii) If Fv ( l x . M ) = { x , . . . , x n } , then [[ l x . M ]] r N = ( l x . M )[ r ( x ) / x , . . . , r ( x n ) / x n ] N → ( M [ r ( x ) / x , . . . , r ( x n ) / x n ])[ N / x ] = M [ r ( x ) / x , . . . , r ( x n ) / x n , N / x ] =[[ M ]] r ( N / x ) ,(iii) If Fv ( M ) = { x , . . . , x n } , then [[ x ⊙ M ]] r = ( x ⊙ M )[ r ( x ) / x , r ( x ) / x , . . . , r ( x n ) / x n ] = Fv ( r ( x )) ⊙ M [ r ( x ) / x , . . . , r ( x n ) / x n ] = Fv ( r ( x )) ⊙ [[ M ]] r . (iv) If Fv ( M ) = { x , . . . , x n } , then [[ z < xy M ]] r = ( z < xy M )[ N / z , r ( x ) / x , . . . , r ( x n ) / x n ] = Fv ( N ) < Fv ( N ) Fv ( N ) M [ N / x , N / y , r ( x ) / x , . . . , r ( x n ) / x n ] == Fv ( N ) < Fv ( N ) Fv ( N ) [[ M ]] r ( N / x , N / y ) . Definition 19. (i) r | = M : s ⇐⇒ [[ M ]] r ∈ [[ s ]] ;(ii) r | = G ⇐⇒ ( ∀ ( x : a ) ∈ G ) r ( x ) ∈ [[ a ]] ;18iii) G | = M : s ⇐⇒ ( ∀ r , r | = G ⇒ r | = M : s ) . Lemma 20.
Let G (cid:15) M : s and D (cid:15) M : t , then r (cid:15) G ⊓ D if and only if r (cid:15) G and r (cid:15) D . Proof.
The proof is a straightforward consequence of the Definition 7 of bases inter-section ⊓ . Proposition 21 (Soundness of l r ∩ ) . If G ⊢ M : s , then G | = M : s .Proof. By induction on the derivation of G ⊢ M : s . • If the last rule applied is ( Ax ) , i.e. x : s ⊢ x : s the proof is trivial. • The last rule applied is ( → I ) , i.e., G , x : a ⊢ M : s ⇒ G ⊢ l x . M : a → s . By the IH G , x : a | = M : s . Suppose that r | = G and we want to show that r | = l x . M : a → s . We have to show that [[ l x . M ]] r ∈ [[ a → s ]] = [[ a ]] / / [[ s ]] i.e. ∀ N ∈ [[ a ]] . [[ l x . M ]] r N ∈ [[ s ]] . Suppose that N ∈ [[ a ]] . We have that r ( N / x ) | = G , x : a since r | = G , x G and r ( N / x )( x ) = N ∈ [[ a ]] . By IH r ( N / x ) | = M : s , hence we can conclude that [[ M ]] r ( N / x ) ∈ [[ s ]] . Using Lemma 18(ii) we get [[ l x . M ]] r N → [[ M ]] r ( N / x ) . Since [[ M ]] r ( N / x ) ∈ [[ s ]] and [[ s ]] is r -saturated, we obtain [[ l x . M ]] r N ∈ [[ s ]] . • The last rule applied is ( → E ) , i.e. G ⊢ M : ∩ ni t i → s , D ⊢ N : t . . . D n ⊢ N : t n ⇒ G , D ⊤ ⊓ D ⊓ . . . ⊓ D n ⊢ MN : s . Let r be any valuation.Assuming that G ⊢ M : ∩ ni t i → s , D ⊢ N : t , . . . , D n ⊢ N : t n , we have to provethat if r (cid:15) G , D ⊤ ⊓ D ⊓ ... ⊓ D n , then r (cid:15) M N : s .By IH, G | = M : ∩ ni t i → s and D | = N : t , . . . , D n | = N : t n . Assume that r | = G , D ⊤ ⊓ D ⊓ . . . ⊓ D n . This means that r | = G and r | = D ⊤ ⊓ D ⊓ . . . ⊓ D n . From r | = G we deduce by Definition 19 (iii) r | = M : ∩ ni t i → s and by Defini-tion 19 (i) [[ M ]] r ∈ [[ ∩ ni t i → s ]] . By Definition 17 [[ M ]] r ∈ T ni [[ t ]] / / [[ s ]] .Using Lemma 20 r | = D ⊤ ⊓ D ⊓ ... ⊓ D n implies ( r | = D ⊤ ) ∧ ( V ni = r | = D i ) ,hence by Definition 19 (i) and (iii) we get ([[ N ]] r ∈ [[ ⊤ ]]) ∧ V ni = ([[ N ]] r ∈ [[ t i ]]) ,i.e. [[ N ]] r ∈ S N ∩ ∩ ni [[ t i ]] = ∩ ni [[ t i ]] , since [[ t i ]] ⊆ S N by Proposition 16(iv).By Definition 12 of / / , [[ M N ]] r = [[ M ]] r [[ N ]] r ∈ [[ s ]] and by Definition 19 (i) r (cid:15) M N : s . • The last rule applied is ( Weak ) , i.e., G ⊢ M : s ⇒ G , x : ⊤ ⊢ x ⊙ M : s . By the IH G | = M : s . Suppose that r | = G , x : ⊤ ⇔ r | = G and r | = x : ⊤ . From r | = G we obtain [[ M ]] r ∈ [[ s ]] . Using multiple times the weakening property WEAK and Lemma 18(iii) we obtain Fv ( r ( x )) ⊙ [[ M ]] r = [[ x ⊙ M ]] r ∈ [[ s ]] , since Fv ( r ( x )) ∩ Fv ([[ M ]] r ) = /0 . 19 The last rule applied is ( Cont ) , i.e., G , x : a , y : b ⊢ M : s ⇒ G , z : a ∩ b ⊢ z < xy M : s . By the IH G , x : a , y : b | = M : s . Suppose that r | = G , z : a ∩ b .This means that r | = G and r | = z : a ∩ b ⇔ r ( z ) ∈ [[ a ]] and r ( z ) ∈ [[ b ]] . For the sake of simplic-ity let r ( z ) ≡ N . We define a new valuation r ′ such that r ′ = r ( N / x , N / y ) ,where N and N are obtained by renaming the free variables of N . Then r ′ | = G , x : a , y : b since x , y Dom ( G ) , N ∈ [[ a ]] and N ∈ [[ b ]] . By the IH [[ M ]] r ′ =[[ M ]] r ( N / x , N / y ) ∈ [[ s ]] . Using the contraction property CONT we have that Fv ( N ) < Fv ( N ) Fv ( N ) [[ M ]] r ( N / x , N / y ) = [[ z < xy M ]] r ∈ [[ s ]] . Theorem 22 ( S N for l r ∩ ) . If G ⊢ M : s , then M is strongly normalizing, i.e. M ∈ S N .Proof.
Suppose G ⊢ M : s . By Proposition 21 G | = M : a . According to Defini-tion 19(iii), this means that ( ∀ r | = G ) r | = M : s . We can choose a particular r ( x ) = x for all x ∈ var . By Proposition 16(iv), [[ b ]] is r -saturated for each type b , hence x = [[ x ]] r ∈ [[ b ]] (variable condition for n = r | = G and we can concludethat [[ M ]] r ∈ [[ s ]] . On the other hand, M = [[ M ]] r and [[ s ]] ⊆ S N (Proposition 16),hence M ∈ S N . ⇒ Typeability in l r ∩ We want to prove that if a l r -term is SN, then it is typeable in the system l r ∩ . Weproceed in two steps: 1) we show that all l r -normal forms are typeable and 2) weprove the head subject expansion. First, let us observe the structure of the l r -normalforms, given by the following abstract syntax: M n f :: = x | l x . M n f | l x . x ⊙ M n f | xM n f . . . M nn f | x < x x M n f N n f , with x ∈ Fv ( M n f ) , x ∈ Fv ( N n f ) W n f :: = x ⊙ M n f | x ⊙ W n f Notice that it is necessary to distinguish normal forms W n f since the term l x . y ⊙ M n f is not a normal form, since l x . y ⊙ M n f → w y ⊙ l x . M n f . Proposition 23. l r -normal forms are typeable in the system l r ∩ .Proof. By induction on the structure of M n f and W n f . Lemma 24 (Inverse substitution lemma) . Let G ⊢ M [ N / x ] : s and N typeable. Then,there are D j and t j , j = , . . . , n such that D j ⊢ N : t j , and G ′ , x : ∩ ni t i ⊢ M : s , where G = G ′ , D ⊤ ⊓ D ⊓ . . . ⊓ D n .Proof. By induction on the structure of M . Proposition 25 (Head subject expansion) . For every l r -term M: if M → M ′ , M is acontracted redex and G ⊢ M ′ : s , then G ⊢ M : s , provided that if M ≡ ( l x . N ) P → b N [ P / x ] ≡ M ′ , P is typeable. roof. By case study according to the applied reduction.
Theorem 26 (SN ⇒ typeability) . All strongly normalising l r -terms are typeable inthe l r ∩ system.Proof. The proof is by induction on the length of the longest reduction path out of astrongly normalising term M , with a subinduction on the size of M . • If M is a normal form, then M is typeable by Proposition 23. • If M is itself a redex, let M ′ be the term obtained by contracting the redex M . M ′ is also strongly normalising, hence by IH it is typeable. Then M is typeable, byProposition 25. Notice that, if M ≡ ( l x . N ) P → b N [ P / x ] ≡ M ′ , then, by IH, P istypeable, since the length of the longest reduction path out of P is smaller thanthat of M , and the size of P is smaller than the size of M . • Next, suppose that M is not itself a redex nor a normal form. Then M is ofone of the following forms: l x . N , l x . x ⊙ N , xM . . . M n , x ⊙ N , or x < x x NP , x ∈ Fv ( N ) , x ∈ Fv ( P ) (where M , . . . , M n , N , and NP are not normal forms). M , . . . , M n and NP are typeable by IH, as subterms of M . Then, it is easy to build the typingfor M . For instance, let us consider the case x < x x NP with x ∈ Fv ( N ) , x ∈ Fv ( P ) . By induction NP is typeable, hence N is typeable with say G , x : b ⊢ N : ∩ ni t i → s and P is typeable with say D j , x : g j ⊢ P : t j , for all j = , . . . , n . Thenusing the rule ( E → ) we obtain G , D ⊤ ⊓ D ⊓ . . . ⊓ D n , x : b , x : ∩ ni g i ⊢ NP : s .Finally, the rule ( Cont ) yields G , D ⊤ ⊓ D ⊓ . . . ⊓ D n , x : b ∩ ( ∩ ni g i ) ⊢ x < x x NP : s .Finally, we can give a characterisation of strong normalisation in l r -calculus. Theorem 27. In l r -calculus, the term M is strongly normalising if and only if it istypeable in l r ∩ .Proof. Immediate consequence of Theorems 22 and 26. l Gtz r In this section we focus on the sequent resource control lambda calculus l Gtz r . Firstwe revisit its syntax and operational semantics; further we introduce an intersectiontype assignment system and finally we prove that typeability in the proposed systemcompletely characterises the set of strongly normalising l Gtz r -expressions.21 .1 Resource control sequent lambda calculus l Gtz r The resource control lambda Gentzen calculus l Gtz r is derived from the l Gtz -calculus(more precisely its confluent sub-calculus l Gtz V ) by adding the explicit operators forweakening and contraction. It is proposed in [26]. The abstract syntax of l Gtz r pre-expressions is the following:Pre-values F :: = x | l x . f | x ⊙ f | x < x x f Pre-terms f :: = F | f c Pre-contexts c :: = b x . f | f :: c | x ⊙ c | x < x x c where x ranges over a denumerable set of term variables.A pre-value can be a variable, an abstraction, a weakening or a contraction; a pre-term is either a value or a cut (an application). A pre-context is one of the following:a selection, a context constructor (usually called cons), a weakening on pre-context or acontraction on a pre-context. Pre-terms and pre-contexts are together referred to as the pre-expressions and will be ranged over by E . Pre-contexts x ⊙ c and x < x x c behaveexactly like corresponding pre-terms x ⊙ f and x < x x f in the untyped calculus, so theywill mostly not be treated separately. The set of free variables of a pre-expression isdefined analogously to the free variables in l r -calculus with the following additions: Fv ( f c ) = Fv ( f ) ∪ Fv ( c ) ; Fv ( b x . f ) = Fv ( f ) \ { x } ; Fv ( f :: c ) = Fv ( f ) ∪ Fv ( c ) . Like in l r -calculus, the set of l Gtz r -expressions (namely values, terms and con-texts), denoted by L Gtz r ∪ L Gtz r , C , is a subset of the set of pre-expressions, defined inFigure 6. Values are denoted by T , terms by t , u , v ... , contexts by k , k ′ , ... and expres-sions by e , e ′ .The computation over the set of l Gtz r -expressions reflects the cut-elimination pro-cess. Four groups of reductions in l Gtz r -calculus are given in Figure 7.The first group consists of b g , p , s and µ reductions from the l Gtz . New reductionsare added to deal with explicit contraction ( g reductions) and weakening ( w reduc-tions). The groups of g and w reductions consist of rules that perform propagation ofcontraction into the expression and extraction of weakening out of the expression. Thisdiscipline allows us to optimize the computation by delaying the duplication of termson the one hand, and by performing the erasure of terms as soon as possible on theother. The equivalencies in l Gtz r are the ones given in Figure 4, except for the fact thatthey refer to l Gtz r -expressions.The meta-substitution t [ u / x ] is defined as in Figure 3 with the following additions: ( tk )[ u / x ] = t [ u / x ] k , x / ∈ Fv ( k ) ( tk )[ u / x ] = tk [ u / x ] , x / ∈ Fv ( t )( b y . t )[ u / x ] = b y . t [ u / x ]( t :: k )[ u / x ] = t [ u / x ] :: k , x / ∈ Fv ( k ) ( t :: k )[ u / x ] = t :: k [ u / x ] , x / ∈ Fv ( t ) In the p rule, the meta-operator @, called append , joins two contexts and is defined as: ( b x . t ) @ k ′ = b x . tk ′ ( u :: k ) @ k ′ = u :: ( k @ k ′ )( x ⊙ k ) @ k ′ = x ⊙ ( k @ k ′ ) ( x < yz k ) @ k ′ = x < yz ( k @ k ′ ) . ∈ L Gtz r f ∈ L Gtz r x ∈ Fv ( f ) l x . f ∈ L Gtz r f ∈ L Gtz r c ∈ L Gtz r , C Fv ( f ) ∩ Fv ( c ) = /0 f c ∈ L Gtz r f ∈ L Gtz r x ∈ Fv ( f ) b x . f ∈ L Gtz r , C f ∈ L Gtz r c ∈ L Gtz r , C Fv ( f ) ∩ Fv ( c ) = /0 f :: c ∈ L Gtz r , C E ∈ L Gtz r ∪ L Gtz r , C x / ∈ Fv ( E ) x ⊙ E ∈ L Gtz r ∪ L Gtz r , C E ∈ L Gtz r ∪ L Gtz r , C x = x x , x ∈ Fv ( E ) x / ∈ Fv ( E ) \ { x , x } x < x x E ∈ L Gtz r ∪ L Gtz r , C Figure 6: L Gtz r ∪ L Gtz r , C : l Gtz r -expressions l Gtz r The type assignment system l Gtz r ∩ that assigns strict types to l Gtz r -expressions is givenin Figure 8. Due to the sequent flavour of the l Gtz r -calculus, here we distinguish twosorts of type assignments:- G ⊢ t : s for typing a term and- G ; b ⊢ k : s , a type assignment with a stoup , for typing a context.A stoup is a place for the last formula in the antecedent, after the semi-colon. Theformula in the stoup is the place where computation will continue.The syntax of types and the related definitions are the same as in l r ∩ . The l Gtz r ∩ system is also syntax-directed i.e. the intersection is incorporated into already existingrules of the simply-typed system. In the style of sequent calculus, left intersectionintroduction is managed by the contraction rules ( Cont t ) and ( Cont k ) , whereas the rightintersection introduction is performed by the cut rule ( Cut ) and left arrow introductionrule ( → L ) . In these two rules Dom ( G ) = . . . = Dom ( G n ) . The role of G ⊤ has beenalready explained in subsection 1.2.The Generation lemma induced by the proposed system is the following: Lemma 28 (Generation lemma for l Gtz r ∩ ) . (i) G ⊢ l x . t : t iff there exist a and s such that t ≡ a → s and G , x : a ⊢ t : s . (ii) G ; g ⊢ t :: k : r iff G = G ′ ⊤ ⊓ G ′ ⊓ ... ⊓ G ′ n , D , g ≡ ∩ mj ( ∩ ni s i → t j ) , D ; ∩ mj t j ⊢ k : r and G ′ l ⊢ t : s l for all l ∈ { , . . . , n } . b g ) ( l x . t )( u :: k ) → u ( b x . tk )( s ) T ( b x . v ) → v [ T / x ]( p ) ( tk ) k ′ → t ( k @ k ′ )( µ ) b x . xk → k ( g ) x < x x ( l y . t ) → l y . x < x x t ( g ) x < x x ( tk ) → ( x < x x t ) k , if x , x / ∈ Fv ( k )( g ) x < x x ( tk ) → t ( x < x x k ) , if x , x / ∈ Fv ( t )( g ) x < x x ( b y . t ) → b y . ( x < x x t )( g ) x < x x ( t :: k ) → ( x < x x t ) :: k , if x , x / ∈ Fv ( k )( g ) x < x x ( t :: k ) → t :: ( x < x x k ) , if x , x / ∈ Fv ( t )( w ) l x . ( y ⊙ t ) → y ⊙ ( l x . t ) , x = y ( w ) ( x ⊙ t ) k → x ⊙ ( tk )( w ) t ( x ⊙ k ) → x ⊙ ( tk )( w ) b x . ( y ⊙ t ) → y ⊙ ( b x . t ) , x = y ( w ) ( x ⊙ t ) :: k → x ⊙ ( t :: k )( w ) t :: ( x ⊙ k ) → x ⊙ ( t :: k )( gw ) x < x x ( y ⊙ e ) → y ⊙ ( x < x x e ) x = y = x ( gw ) x < x x ( x ⊙ e ) → e [ x / x ] Figure 7: Reduction rules of l Gtz r -calculus (iii) G ⊢ tk : s iff G = G ′ ⊤ ⊓ G ′ ⊓ ... ⊓ G ′ n , D , and there exist t j , j = , . . . , n suchthat for all j ∈ { , . . . , n } the following holds: G ′ j ⊢ t : t j , and D ; ∩ ni t i ⊢ k : s . (iv) G ; a ⊢ b x . t : s iff G , x : a ⊢ t : s . (v) G ⊢ z < xy t : s iff there exist G ′ , a , b such that G = G ′ , z : a ∩ b and G ′ , x : a , y : b ⊢ t : s . (vi) G ⊢ x ⊙ t : s iff G = G ′ , x : ⊤ and G ′ ⊢ t : s . (vii) G ; g ⊢ z < xy k : s iff there exist G ′ , a , b such that G = G ′ , z : a ∩ b and G ′ , x : a , y : b ; g ⊢ k : s . (viii) G ; g ⊢ x ⊙ k : s iff G = G ′ , x : ⊤ and G ′ ; g ⊢ k : s . The proposed system satisfies the following properties.
Lemma 29. (i) If G ⊢ t : s , then Dom ( G ) = Fv ( t ) . (ii) If G ; a ⊢ k : s , then Dom ( G ) = Fv ( k ) . Proof.
Similar to the proof of Lemma 8.
Lemma 30 (Substitution lemma for l Gtz r ∩ ) . : s ⊢ x : s ( Ax ) G , x : a ⊢ t : sG ⊢ l x . t : a → s ( → R ) G , x : a ⊢ t : sG ; a ⊢ b x . t : s ( Sel ) G ⊢ t : s ... G n ⊢ t : s n D ; ∩ mj t j ⊢ k : rG ⊤ ⊓ G ⊓ ... ⊓ G n , D ; ∩ mj ( ∩ ni s i → t j ) ⊢ t :: k : r ( → L ) G ⊢ t : s ... G n ⊢ t : s n D ; ∩ ni s i ⊢ k : tG ⊤ ⊓ G ⊓ ... ⊓ G n , D ⊢ tk : t ( Cut ) G , x : a , y : b ⊢ t : sG , z : a ∩ b ⊢ z < xy t : s ( Cont t ) G ⊢ t : sG , x : ⊤ ⊢ x ⊙ t : s ( Weak t ) G , x : a , y : b ; g ⊢ k : sG , z : a ∩ b ; g ⊢ z < xy k : s ( Cont k ) G ; g ⊢ k : sG , x : ⊤ ; g ⊢ x ⊙ k : s ( Weak k ) Figure 8: l Gtz r ∩ : l Gtz r -calculus with intersection types (i) If G , x : ∩ ni t i ⊢ t : s and for all j = , . . . , n, D j ⊢ u : t j , then G , D ⊤ ⊓ D ⊓ ... ⊓ D n ⊢ t [ u / x ] : s . (ii) If G , x : ∩ ni t i ; a ⊢ k : s and for all j = , . . . , n, D j ⊢ u : t j , then G , D ⊤ ⊓ D ⊓ ... ⊓ D n ; a ⊢ k [ u / x ] : s . Proof.
By mutual induction on the structure of terms and contexts.
Proposition 31 (Append lemma) . If G j ; a ⊢ k : t j for all j = , . . . , n, and D ; ∩ ni t i ⊢ k ′ : s , then G ⊤ ⊓ G ⊓ . . . ⊓ G n , D ; a ⊢ k @ k ′ : s . Proof.
By induction on the structure of the context k . Proposition 32 (Subject equivalence for l Gtz r ∩ ) . (i) For every l Gtz r -term t: if G ⊢ t : s and t ≡ l Gtz r t ′ , then G ⊢ t ′ : s . (ii) For every l Gtz r -context k: if G ; a ⊢ k : s and k ≡ l Gtz r k ′ , then G ; a ⊢ k ′ : s . Proof.
By case analysis on the applied equivalence.
Proposition 33 (Subject reduction for l Gtz r ∩ ) . (i) For every l Gtz r -term t: if G ⊢ t : s and t → t ′ , then G ⊢ t ′ : s . (ii) For every l Gtz r -context k: if G ; a ⊢ k : s and k → k ′ , then G ; a ⊢ k ′ : s . roof. By case analysis on the applied reduction, using Lemmas 30 and 31 for thecases of ( s ) and ( p ) rule, respectively. ⇒ SN in l Gtz r ∩ In this section, we prove the strong normalisation of the l Gtz r -calculus with intersectiontypes. The termination is proved by showing that the reduction on the set L Gtz r ∪ L Gtz r , C of the typeable l Gtz r -expressions is included in a particular well-founded relation, whichwe define as the lexicographic product of three well-founded component relations. Thefirst one is based on the mapping of l Gtz r -expressions into l r -terms. We show that thismapping preserves types and that every l Gtz r -reduction can be simulated either by a l r -reduction or by an equality and each l Gtz r -equivalence can be simulated by an l r -equivalence. The other two well-founded orders are based on the introduction of quan-tities designed to decrease a global measure associated with specific l Gtz r -expressionsduring the computation. Definition 34.
The mapping ⌊ ⌋ : L Gtz r → L r is defined together with the auxiliarymapping ⌊ ⌋ k : L Gtz r , C → ( L r → L r ) in the following way: ⌊ x ⌋ = x ⌊ b x . t ⌋ k ( M ) = ( l x . ⌊ t ⌋ ) M ⌊ l x . t ⌋ = l x . ⌊ t ⌋ ⌊ t :: k ⌋ k ( M ) = ⌊ k ⌋ k ( M ⌊ t ⌋ ) ⌊ x ⊙ t ⌋ = x ⊙ ⌊ t ⌋ ⌊ x ⊙ k ⌋ k ( M ) = x ⊙ ⌊ k ⌋ k ( M ) ⌊ x < yz t ⌋ = x < yz ⌊ t ⌋ ⌊ x < yz k ⌋ k ( M ) = x < yz ⌊ k ⌋ k ( M ) ⌊ tk ⌋ = ⌊ k ⌋ k ( ⌊ t ⌋ ) Lemma 35. (i) Fv ( t ) = Fv ( ⌊ t ⌋ ) , for t ∈ L Gtz r .(ii) ⌊ v [ t / x ] ⌋ = ⌊ v ⌋ [ ⌊ t ⌋ / x ] , for v , t ∈ L Gtz r . We prove that the mappings ⌊ ⌋ and ⌊ ⌋ k preserve types. In the sequel, the notation L r ( G ⊢ l r s ) stands for { M | M ∈ L r & G ⊢ l r M : s } . Proposition 36 (Type preservation by ⌊ ⌋ ) . (i) If G ⊢ t : s , then G ⊢ l r ⌊ t ⌋ : s .(ii) If G ; ∩ ni t i ⊢ k : s , then ⌊ k ⌋ k : L r ( D j ⊢ l r t j ) → L r ( G , D ⊢ l r s ) , for all j ∈ { , . . . , n } and for some D = D ⊤ ⊓ D ⊓ ... ⊓ D n .Proof. The proposition is proved by simultaneous induction on derivations. We distin-guish cases according to the last typing rule used. • Cases ( Ax ) , ( → R ) , ( Weak t ) and ( Cont t ) are easy, because the intersection typeassignment system of l r has exactly the same rules.26 Case ( Sel ) : the derivation ends with the rule G , x : a ⊢ t : sG ; a ⊢ b x . t : s ( Sel ) By IH we have that G , x : a ⊢ l r ⌊ t ⌋ : s , where a = ∩ ni t i . For any M ∈ L r suchthat D j ⊢ l r M : t i , for all j ∈ { , . . . , n } , we have G , x : ∩ ni t i ⊢ l r ⌊ t ⌋ : s ( → I ) G ⊢ l r l x . ⌊ t ⌋ : ∩ ni t i → s D ⊢ l r M : t . . . D n ⊢ l r M : t n ( → E ) G , D ⊤ ⊓ D ⊓ . . . ⊓ D n ⊢ l r ( l x . ⌊ t ⌋ ) M : s Since ( l x . ⌊ t ⌋ ) M = ⌊ b x . t ⌋ k ( M ) , we conclude that ⌊ b x . t ⌋ k : L r ( D j ⊢ l r t j ) → L r ( G , D ⊤ ⊓ D ⊓ ... ⊓ D n ⊢ l r s ) . • Case ( → L ) : the derivation ends with the rule G ⊢ t : s ... G n ⊢ t : s n D ; ∩ mj t j ⊢ k : rG , D ; ∩ mj ( ∩ ni s i → t j ) ⊢ t :: k : r ( → L ) for G = G ⊤ ⊓ G ⊓ . . . ⊓ G n . By IH we have that G l ⊢ l r ⌊ t ⌋ : s l , for l ∈ { , . . . , n } .For any M ∈ L r such that G ′ j ⊢ L r M : ∩ ni s i → t j , j = , . . . , m we have G ′ j ⊢ l r M : ∩ ni s i → t j G ⊢ l r ⌊ t ⌋ : s . . . G n ⊢ l r ⌊ t ⌋ : s n G ⊤ ⊓ G ⊓ . . . ⊓ G n , G ′ j ⊢ l r M ⌊ t ⌋ : t j ( → E ) From the right-hand side premise in the ( → L ) rule, by IH, we get that ⌊ k ⌋ k isthe function with the scope ⌊ k ⌋ k : L r ( G ′′′ j ⊢ l r t j ) → L r ( G ′′′ , G ′′⊢ l r r ) , for some G ′′′ = G ′′′ ⊤ ⊓ G ′′′ ⊓ ... ⊓ G ′′′ n . For G ′′′ ≡ G , G ′ and by taking M ⌊ t ⌋ as the argument ofthe function ⌊ k ⌋ k , we get G , D , G ′ ⊢ l r ⌊ k ⌋ k ( M ⌊ t ⌋ ) : r . Since ⌊ k ⌋ k ( M ⌊ t ⌋ ) = ⌊ t :: k ⌋ k ( M ) , we have that G , D , G ′ ⊢ l r ⌊ t :: k ⌋ k ( M ) : r . This holds for any M of theappropriate type, yielding ⌊ t :: k ⌋ k : L r ( G ′⊢ l r ∩ ni s i → t j ) → L r ( G , D , G ′⊢ l r r ) , which is exactly what we need. Case ( Cut ) : the derivation ends with the rule G ⊢ t : t . . . G n ⊢ t : t n D ; ∩ t ni ⊢ k : sG ⊤ ⊓ G ⊓ . . . ⊓ G n , D ⊢ tk : s ( Cut ) By IH we have that G j ⊢ l r ⌊ t ⌋ : t j and ⌊ k ⌋ k : L r ( G ′ j ⊢ l r t j ) → L r ( G ′ , D ⊢ l r s ) for all j = , . . . , n and for G ′ = G ⊤ ⊓ G ′ ⊓ . . . ⊓ G ′ n . Hence, for any M ∈ L r such that G ′ j ⊢ l r M : t j , G ′ , D ⊢ l r ⌊ k ⌋ k ( M ) : s holds. By taking M ≡ ⌊ t ⌋ and G ′ ≡ G , weget G , D ⊢ l r ⌊ k ⌋ k ( ⌊ t ⌋ ) : s . But ⌊ k ⌋ k ( ⌊ t ⌋ ) = ⌊ tk ⌋ , so the proof is done.27 Case ( Weak k ) : the derivation ends with the rule G ; b ⊢ k : sG , x : ⊤ ; b ⊢ x ⊙ k : s ( Weak k ) By IH we have that ⌊ k ⌋ k is the function with the scope ⌊ k ⌋ k : L r ( G ′ j ⊢ l r t j ) → L r ( G , G ′ ⊤⊓ G ′ ⊓ ... ⊓ G ′ n ⊢ l r s ) , meaning that for each M ∈ L r such that G ′ j ⊢ l r M : t j for all j ∈ { , . . . , n } holds G ′ ⊤ ⊓ G ′ ⊓ . . . ⊓ G ′ n , G ⊢ l r ⌊ k ⌋ k ( M ) : s . Now, we canapply ( Weak ) rule: G , G ′ ⊤ ⊓ G ′ ⊓ . . . ⊓ G ′ n ⊢ ⌊ k ⌋ k ( M ) : sG , G ′ ⊤ ⊓ G ′ ⊓ . . . ⊓ G ′ n , x : ⊤ ⊢ x ⊙ ⌊ k ⌋ k ( M ) : s ( Weak ) Since x ⊙ ⌊ k ⌋ k ( M ) = ⌊ x ⊙ k ⌋ k ( M ) , this means that ⌊ x ⊙ k ⌋ k : L r ( G ′ j ⊢ l r t j ) → L r ( G , G ′ ⊤⊓ G ′ ⊓ ... ⊓ G ′ n , x : ⊤⊢ l r s ) , which is exactly what we wanted to get. • Case ( Cont k ) : similar to the case ( Weak k ) , relying on the rule ( Cont ) in l r .For the given encoding ⌊ ⌋ , we show that each l Gtz r -reduction step can be simulatedby an l r -reduction or by an equality. In order to do so, we prove the following lemmas.The proofs of Lemma 38 and Lemma 39, according to [21], use Regnier’s s reductions,investigated in [51]. (( l x . M ) N ) P → ( l x . ( MN )) P x / ∈ P ( l xy . M ) N → l y . (( l x . M ) N ) y / ∈ NM (( l x . P ) N ) → ( l x . MP ) N x / ∈ M Lemma 37.
If M → l r M ′ , then ⌊ k ⌋ k ( M ) → l r ⌊ k ⌋ k ( M ′ ) . Lemma 38. ⌊ k ⌋ k (( l x . P ) N ) → l r ( l x . ⌊ k ⌋ k ( P )) N . Lemma 39.
If M ∈ L r and k , k ′ ∈ L Gtz r , C , then ⌊ k ′ ⌋ k ◦ ⌊ k ⌋ k ( M ) → l r ⌊ k @ k ′ ⌋ k ( M ) . Lemma 40. (i) If x / ∈ Fv ( k ) , then ( ⌊ k ⌋ k ( M ))[ N / x ] = ⌊ k ⌋ k ( M [ N / x ]) . (ii) If x , y / ∈ Fv ( k ) , then z < xy ( ⌊ k ⌋ k ( M )) → l r ⌊ k ⌋ k ( z < xy M ) . (iii) ⌊ k ⌋ k ( x ⊙ M ) → l r x ⊙ ⌊ k ⌋ k ( M ) . Now we can prove that the reduction rules of l Gtz r can be simulated by the reductionrules or an equality in the l r -calculus. Moreover, the equivalences of l Gtz r -calculusare preserved in l r -calculus. Theorem 41 (Simulation of l Gtz r -reduction by l r -reduction) . (i) If a term t → l Gtz r t ′ , then ⌊ t ⌋ → l r ⌊ t ′ ⌋ . ii) If a context k → l Gtz r k ′ by g or w reduction, then ⌊ k ⌋ k ( M ) ≡ ⌊ k ′ ⌋ k ( M ) , for anyM ∈ L r .(iii) If a context k → l Gtz r k ′ by some other reduction, then ⌊ k ⌋ k ( M ) → l r ⌊ k ′ ⌋ k ( M ) ,for any M ∈ L r .(iv) If t ≡ l Gtz r t ′ , then ⌊ t ⌋ ≡ l r ⌊ t ′ ⌋ , and if k ≡ l Gtz r k ′ , then ⌊ k ⌋ k ( M ) ≡ l r ⌊ k ′ ⌋ k ( M ) , forany M ∈ L r .Proof. The proof goes by case analysis on the outermost reduction or equivalence per-formed, using Definition 34.The previous proposition shows that b g , p , s , µ , g - g , w - w , gw and gw l Gtz r -reductions are interpreted by l r -reductions and that g and w l Gtz r -reductionsare interpreted by an identity in the l r . Since the set of equivalences of the twocalculi coincide, they are trivially preserved. If one wants to prove that there is noinfinite sequence of l Gtz r -reductions one has to prove that there cannot exist an infinitesequence of l Gtz r -reductions which are all interpreted as equalities. To prove this, oneshows that if a term is reduced with such a l Gtz r -reduction, it is reduced for anotherorder that forbids infinite decreasing chains. This order is itself composed of severalorders, free of infinite decreasing chains (Definition 45). Definition 42.
The functions S ( ) , || || c , || || w : L Gtz r → N are defined as follows: S ( x ) = S ( tk ) = S ( t ) + S ( k ) S ( l x . t ) = + S ( t ) S ( b x . t ) = + S ( t ) S ( x ⊙ e ) = + S ( e ) S ( t :: k ) = S ( t ) + S ( k ) S ( x < yz e ) = + S ( e ) || x || c = || x || w = || l x . t || c = || t || c || l x . t || w = + || t || w || x ⊙ e || c = || e || c || x ⊙ e || w = || x < yz e || c = || e || c + S ( e ) || x < yz e || w = + || e || w || tk || c = || t || c + || k || c || tk || w = + || t || w + || k || w || b x . t || c = || t || c || b x . t || w = + || t || w || t :: k || c = || t || c + || k || c || t :: k || w = + || t || w + || k || w Lemma 43.
For all e , e ′ ∈ L Gtz r :(i) If e → g e ′ , then || e || c > || e ′ || c .(ii) If e → w e ′ , then || e || c = || e ′ || c .(iii) If e ≡ l Gtz r e ′ , then || e || c = || e ′ || c . Lemma 44. (i) For all e , e ′ ∈ L Gtz r : If e → w e ′ , then || e || w > || e ′ || w . ii) If e ≡ l Gtz r e ′ , then || e || w = || e ′ || w . Now we can define the following orders based on the previously introduced map-ping and norms.
Definition 45.
We define the following strict orders and equivalencies on L Gtz r ∩ :(i) t > l r t ′ iff ⌊ t ⌋ → + l r ⌊ t ′ ⌋ ; t = l r t ′ iff ⌊ t ⌋ ≡ l r ⌊ t ′ ⌋ k > l r k ′ iff ⌊ k ⌋ k ( M ) → + l r ⌊ k ′ ⌋ ( M ) for every l r term M ; k = l r k ′ iff ⌊ k ⌋ k ( M ) ≡ l r ⌊ k ′ ⌋ k ( M ) or ⌊ k ⌋ k ( M ) ≡ ⌊ k ′ ⌋ ( M ) for every l r term M ;(ii) e > c e ′ iff || e || c > || e ′ || c ; e = c e ′ iff || e || c = || e ′ || c ;(iii) e > w e ′ iff || e || w > || e ′ || w ; e = w e ′ iff || e || w = || e ′ || w ;The lexicographic product of two orders > and > is defined as [2]: a > × lex > b ⇔ a > b or ( a = b and a > b ) . Definition 46.
We define the relation ≫ on L Gtz r as the lexicographic product: ≫ = > l r × lex > c × lex > w . The following propositions proves that the reduction relation on the set of typed l Gtz r -expressions is included in the given lexicographic product ≫ . Proposition 47.
For each e ∈ L Gtz r : if e → e ′ , then e ≫ e ′ .Proof. By case analysis on the kind of reduction and the structure of ≫ .If e → e ′ by b g , s , p , µ , g , g , g , g g , gw , gw , w , w , w w or w reduction, then e > l r e ′ by Proposition 41.If e → e ′ by g , then e = l r e ′ by Proposition 41, and e > c e ′ by Lemma 43.Finally, if e → e ′ by w , then e = l r e ′ by Proposition 41, e = c e ′ by Lemma 43 and e > w e ′ by Lemma 44.Strong normalisation of → is another terminology for the well-foundness of therelation → and it is well-known that a relation included in a well-founded relationis well-founded and that the lexicographic product of well-founded relations is well-founded. Theorem 48 (Strong normalisation of the l Gtz r ∩ ) . Each expression in L Gtz r ∩ is stronglynormalising.Proof. The reduction → is well-founded on L Gtz r ∩ as it is included (Proposition 47)in the relation ≫ which is well-founded as the lexicographic product of the well-founded relations > l r , > c and > w . Relation > l r is based on the interpretation ⌊ ⌋ : L Gtz r → L r . By Proposition 36 typeability is preserved by the interpretation ⌊ ⌋ and → l r is strongly normalising (i.e., well-founded) on L r ∩ (Section 1.3), hence > l r iswell-founded on L Gtz r ∩ . Similarly, > c and > w are well-founded, as they are based oninterpretations into the well-founded relation > on the set N of natural numbers.30 .4 SN ⇒ Typeability in l Gtz r ∩ Now, we want to prove that if a l Gtz r -term is SN, then it is typeable in the system l Gtz r ∩ . We follow the procedure used in Section 1.4. The proofs are similar to the onesin Section 1.4.The abstract syntax of l Gtz r -normal forms is the following: t n f :: = x | l x . t n f | l x . x ⊙ t n f | x ( t n f :: k n f ) | x < yz y ( t n f :: k n f ) k n f :: = b x . t n f | b x . x ⊙ t n f | t n f :: k n f | x < yz ( t n f :: k n f ) , y ∈ Fv ( t n f ) , z ∈ Fv ( k n f ) w n f :: = x ⊙ e n f | x ⊙ w n f We use e n f for any l Gtz r -expression in the normal form. Proposition 49. l Gtz r -normal forms are typeable in the system l Gtz r ∩ .Proof. By mutual induction on the structure of t n f , k n f and w n f .The following two lemmas explain the behavior of the meta operators [ / ] and @during expansion. Lemma 50 (Inverse substitution lemma) . (i) Let G ⊢ t [ u / x ] : s and u typeable. Then, there exist D j and t j , j = , . . . , n suchthat D j ⊢ u : t j and G ′ , x : ∩ ni t i ⊢ t : s , where G = G ′ , D ⊤ ⊓ D ⊓ . . . ⊓ D n .(ii) Let G ; g ⊢ k [ u / x ] : s and u typeable. Then, there are D j and t j , j = , . . . , n suchthat D j ⊢ u : t j and G ′ , x : ∩ ni t i ; g ⊢ k : s , where G = G ′ , D ⊤ ⊓ D ⊓ . . . ⊓ D n .Proof. By mutual induction on the structure of terms and contexts.
Lemma 51 (Inverse append lemma) . If G ; a ⊢ k @ k ′ : s , then there are D j and t j , j = , . . . , n such that D j ; a ⊢ k : t j and G ′ ; ∩ ni t i ⊢ k ′ : s , where G = G ′ , D ⊤ ⊓ D ⊓ . . . ⊓ D n .Proof. By induction on the structure of the context k .Now we prove that the type of a term is preserved during the expansion. Proposition 52 (Head subject expansion) . For every l Gtz r -term t: if t → t ′ , t is con-tracted redex and G ⊢ t ′ : s , then G ⊢ t : s .Proof. By case study according to the applied reduction.
Theorem 53 (SN ⇒ typeability) . All strongly normalising l Gtz r terms are typeable inthe l Gtz r ∩ system.Proof. Analogous to the proof of Theorem 26.Now we give a characterisation of strong normalisation in l Gtz r -calculus. Theorem 54. In l Gtz r -calculus, the term t is strongly normalising if and only if it istypeable in l Gtz r ∩ .Proof. Immediate consequence of Theorems 48 and 53.31
Intersection types for the resource control lambda cal-culus with explicit substitution l x r l x r The resource control lambda calculus with explicit substitution l x r , is an extension ofthe l x -calculus with explicit operators for weakening and contraction. It correspondsto the l lxr -calculus of Kesner and Lengrand, proposed in [35], and also represents avertex of “the prismoid of resources”.The pre-terms of l x r -calculus are given by the following abstract syntax:Pre-terms f :: = x | l x . f | f f | f h x : = f i | x ⊙ f | x < x x f The only point of difference with respect to l r -calculus is the operator of explicitsubstitution h : = i .The set of free variables of a pre-term f , denoted by Fv ( f ) , is defined as follows: Fv ( x ) = x ; Fv ( l x . f ) = Fv ( f ) \ { x } ; Fv ( f g ) = Fv ( f ) ∪ Fv ( g ) ; Fv ( f h x : = g i ) = ( Fv ( f ) \ { x } ) ∪ Fv ( g ) Fv ( x ⊙ f ) = { x } ∪ Fv ( f ) ; Fv ( x < x x f ) = { x } ∪ Fv ( f ) \ { x , x } . In f h x : = g i , the substitution binds the variable x in f .The set of l x r - terms , denoted by L x r and ranged over by M , N , P , M , ... . is a subsetof the set of pre-terms, defined by the rules in Figure 9. x ∈ L x r f ∈ L x r x ∈ Fv ( f ) l x . f ∈ L x r f ∈ L x r g ∈ L x r Fv ( f ) ∩ Fv ( g ) = /0 f g ∈ L x r f ∈ L x r g ∈ L x r x ∈ Fv ( f ) ( Fv ( f ) \ { x } ) ∩ Fv ( g ) = /0 f h x : = g i ∈ L x r f ∈ L x r x / ∈ Fv ( f ) x ⊙ f ∈ L x r f ∈ L x r x = x , x , x ∈ Fv ( f ) x / ∈ Fv ( f ) \ { x , x } x < x x f ∈ L x r Figure 9: L x r : l x r -termsThe notion of terms corresponds to the notion of linear terms in [35].The reduction rules of l x r -calculus are presented in Figure 10.In the l x r , one works modulo equivalencies given in Figure 11. l x r In this subsection we introduce intersection type assignment system which assigns strict types to l x r -terms. The system is syntax-directed, hence significantly different32 b x ) ( l x . M ) N → M h x : = N i ( s ) x h x : = N i → N ( s ) ( l y . M ) h x : = N i → l y . M h x : = N i ( s ) ( MP ) h x : = N i → M h x : = N i P , if x / ∈ Fv ( P )( s ) ( MP ) h x : = N i → MP h x : = N i , if x / ∈ Fv ( M )( s ) ( x ⊙ M ) h x : = N i → Fv ( N ) ⊙ M ( s ) ( y ⊙ M ) h x : = N i → y ⊙ M h x : = N i , if x = y ( s ) ( x < x x M ) h x : = N i → Fv ( N ) < Fv ( N ) Fv ( N ) M h x : = N ih x : = N i ( s ) ( M h x : = N i ) h y : = P i → M h x : = N h y : = P ii , if y / ∈ Fv ( M ) \ { x } ( g ) x < x x ( l y . M ) → l y . x < x x M ( g ) x < x x ( MN ) → ( x < x x M ) N , if x , x Fv ( N )( g ) x < x x ( MN ) → M ( x < x x N ) , if x , x Fv ( M )( g ) x < x x ( M h y : = N i ) → M h y : = x < x x N i , if x , x / ∈ Fv ( M ) \ { y } ( w ) l x . ( y ⊙ M ) → y ⊙ ( l x . M ) , x = y ( w ) ( x ⊙ M ) N → x ⊙ ( MN )( w ) M ( x ⊙ N ) → x ⊙ ( MN )( w ) M h y : = x ⊙ N i → x ⊙ ( M h y : = N i )( gw ) x < x x ( y ⊙ M ) → y ⊙ ( x < x x M ) , y = x , x ( gw ) x < x x ( x ⊙ M ) → M h x : = x i Figure 10: Reduction rules of l x r -calculus ( e ) x ⊙ ( y ⊙ M ) ≡ l x r y ⊙ ( x ⊙ M )( e ) x < x x M ≡ l x r x < x x M ( e ) x < yz ( y < uv M ) ≡ l x r x < yu ( y < zv M )( e ) x < x x ( y < y y M ) ≡ l x r y < y y ( x < x x M ) , x = y , y , y = x , x ( e ) M h x : = N ih y : = P i ≡ l x r M h y : = P ih x : = N i , x / ∈ Fv ( P ) , y / ∈ Fv ( M )( e ) ( y < y y M ) h x : = N i ≡ l x r y < y y M h x : = N i , x = y , y , y / ∈ Fv ( N ) Figure 11: Equivalences in l x r -calculus33rom the one proposed in [42].The syntax of types and the definitions of type assignment, basis, etc. are the sameas in the case of the system l r ∩ . The type assignment system l x r ∩ is given in Fig-ure 12. The only difference with respect to the l r ∩ is the presence of one new typeassignment rule, namely ( Subst ) for typing the explicit substitution. The rules ( → E ) and ( Subst ) are constructed in the same manner, as explained in subsection 1.2. x : s ⊢ x : s ( Ax ) G , x : a ⊢ M : sG ⊢ l x . M : a → s ( → I ) G ⊢ M : ∩ ni t i → s D ⊢ N : t ... D n ⊢ N : t n G , D ⊤ ⊓ D ⊓ ... ⊓ D n ⊢ MN : s ( → E ) G , x : ∩ ni t i ⊢ M : s D ⊢ N : t ... D n ⊢ N : t n G , D ⊤ ⊓ D ⊓ ... ⊓ D n ⊢ M h x : = N i : s ( Subst ) G , x : a , y : b ⊢ M : sG , z : a ∩ b ⊢ z < xy M : s ( Cont ) G ⊢ M : sG , x : ⊤ ⊢ x ⊙ M : s ( Weak ) Figure 12: l x r ∩ : l x r -calculus with intersection types Proposition 55 (Generation lemma for l x r ∩ ) . (i) G ⊢ l x . M : t iff there exist a and s such that t ≡ a → s and G , x : a ⊢ M : s . (ii) G ⊢ MN : s iff there exist D j and t j , j = , . . . , n such that D j ⊢ N : t j and G ′ ⊢ M : ∩ ni t i → s , moreover G = G ′ , D ⊤ ⊓ D ⊓ . . . ⊓ D n .(iii) G ⊢ M h x : = N i : s iff there exist a type a = ∩ nj = t j , such that for all j ∈{ , . . . , n } , D j ⊢ N : t j and G ′ , x : ∩ ni t i ⊢ M : s , moreover G = G ′ , x : a , D ⊤ ⊓ D ⊓ . . . ⊓ D n .(iv) G ⊢ z < xy M : s iff there exist G ′ , a , b such that G = G ′ , z : a ∩ b and G ′ , x : a , y : b ⊢ M : s . (v) G ⊢ x ⊙ M : s iff G = G ′ , x : ⊤ and G ′ ⊢ M : s . The proposed system also satisfies preservation of free variables, bases intersectionand subject reduction and equivalence.
In this paper, we have proposed intersection type assignment systems for: • resource control lambda calculus l r , which corresponds to l CW of [36];34 resource control sequent lambda calculus l Gtz r of [26] and • resource control calculus with explicit substitution l x r of [35].The three intersection type assignment systems proposed here give a complete char-acterization of strongly normalizing terms for these three calculi. The strong normal-isation of typeable resource control lambda terms is proved directly by an appropriatemodification of the reducibility method, whereas the same property for resource controlsequent lambda terms is proved by well-founded lexicographic order based on suitableembedding into the former calculus and the strong normalisation of the calculus withexplicit substitution is given by its interpretation in the resource control lambda cal-culus. This paper expands the range of the intersection type techniques and combinesdifferent methods in the strict types environment. It should be noticed that the strictcontrol on the way variables are introduced determines the way terms are typed in agiven environment. Basically, in a given environment no irrelevant intersection typesare introduced. The flexibility on the choice of a type for a term, as it is used in rule ( → E ) in Figure 5, comes essentially from the choice one has in invoking the axiom.Unlike the approach of introducing non-idempotent intersection types into the calculuswith some kind of resource management [47], our intersection is idempotent. As aconsequence, our type assignment system corresponds to full intuitionistic logic, whilenon-idempotent intersection type assignment systems correspond to intuitionistic lin-ear logic.The three presented calculi l r , l Gtz r and l x r are good candidates to investigatethe computational content of substructural logics [56], both in natural deduction andsequent calculus. The motivation for these logics comes from philosophy (RelevantLogics), linguistics (Lambek Calculus) to computing (Linear Logic). Since the basicidea of resource control is to explicitly handle structural rules, the control operatorscould be used to handle the absence of (some) structural rules in substructural logicssuch as weakening, contraction, commutativity, associativity. This would be an inter-esting direction for further research. Another direction will involve the investigation ofthe use of intersection types, being a powerful means for building models of lambdacalculus [6, 16], in constructing models for sequent lambda calculi. Finally, one maywonder how the strict control on the duplication and the erasure of variables influencesthe type reconstruction of terms [11, 38]. Acknowledgements:
We would like to thank the ICTAC 2011 anonymous refereesfor their careful reading and many valuable comments, which helped us improve thefinal version of the paper. We would also like to thank Dragiˇsa ˇZuni´c for participatingin the earlier stages of the work.
References [1] S. Abramsky. Computational interpretations of linear logic.
Theoretical Com-puter Science , 111(1&2):3–57, 1993.[2] F. Baader and T. Nipkow.
Term Rewriting and All That . Cambridge UniversityPress, UK, 1998. 353] F. Barbanera and S. Berardi. A symmetric lambda calculus for classical programextraction.
Information and Computation , 125(2):103–117, 1996.[4] H. P. Barendregt.
The Lambda Calculus: its Syntax and Semantics . North-Holland, Amsterdam, revised edition, 1984.[5] H. P. Barendregt. Lambda calculi with types. In S. Abramsky, D. M. Gabbay,and T. S. E. Maibaum, editors,
Handbook of Logic in Computer Science , pages117–309. Oxford University Press, UK, 1992.[6] H. P. Barendregt, M. Coppo, and M. Dezani-Ciancaglini. A filter lambda modeland the completeness of type assignment.
Journal of Symbolic Logic , 48(4):931–940 (1984), 1983.[7] N. Benton, G. Bierman, V. de Paiva, and M. Hyland. A term calculus for intuition-istic linear logic. In Marc Bezem and Jan Friso Groote, editors, , volume 664 of
Lecture Notesin Computer Science , pages 75–90. Springer, 1993.[8] R. Bloo and K. H. Rose. Preservation of strong normalisation in named lambdacalculi with explicit substitution and garbage collection. In
Computer Science inthe Netherlands, CSN ’95 , pages 62–72, 1995.[9] G. Boudol. The lambda-calculus with multiplicities (abstract). In E. Best, editor, , volume 715of
Lecture Notes in Computer Science , pages 1–6. Springer, 1993.[10] G. Boudol, P.-L. Curien, and C. Lavatelli. A semantics for lambda calculi withresources.
Mathematical Structures in Computer Science , 9(4):437–482, 1999.[11] G. Boudol and P. Zimmer. On type inference in the intersection type discipline.
Electronic Notes in Theoretical Computer Science , 136:23–42, 2005.[12] M. Coppo and M. Dezani-Ciancaglini. A new type-assignment for lambda terms.
Archiv f¨ur Mathematische Logik , 19:139–156, 1978.[13] M. Coppo and M. Dezani-Ciancaglini. An extension of the basic functionalitytheory for the l -calculus. Notre Dame Journal of Formal Logic , 21(4):685–693,1980.[14] P.-L. Curien and H. Herbelin. The duality of computation. In , pages 233–243. ACM Press,2000.[15] M. Dezani-Ciancaglini and S. Ghilezan. Two behavioural lambda models. InH. Geuvers and F. Wiedijk, editors,
Types for Proofs and Programs , volume 2646of
Lecture Notes in Computer Science , pages 127–147. Springer, 2003.[16] M. Dezani-Ciancaglini, S. Ghilezan, and S. Likavec. Behavioural Inverse LimitModels.
Theoretical Computer Science , 316(1–3):49–74, 2004.3617] M. Dezani-Ciancaglini, F. Honsell, and Y. Motohama. Compositional charac-terization of l -terms using intersection types. In , volume 1893 of Lecture Notes in Computer Science , pages 304–314. Springer, 2000.[18] D. J. Dougherty, S. Ghilezan, and P. Lescanne. Characterizing strong normal-ization in the Curien-Herbelin symmetric lambda calculus: extending the Coppo-Dezani heritage.
Theoretical Computer Science , 398:114–128, 2008.[19] T. Ehrhard and L. Regnier. The differential lambda-calculus.
Theoretical Com-puter Science , 309(1-3):1–41, 2003.[20] J. Esp´ırito Santo. Completing Herbelin’s programme. In S. Ronchi Della Rocca,editor, , volume 4583 of
Lecture Notes in Computer Science , pages 118–132.Springer, 2007.[21] J. Esp´ırito Santo, S. Ghilezan, and J. Iveti´c. Characterising strongly normalisingintuitionistic sequent terms. In
International Workshop TYPES’07 (Selected Pa-pers) , volume 4941 of
Lecture Notes in Computer Science , pages 85–99. Springer,2008.[22] J. Esp´ırito Santo, J. Iveti´c, and S. Likavec. Characterising strongly normalisingintuitionistic terms.
Fundamenta Informaticae , 2011. To appear.[23] J. Gallier. Typing untyped l -terms, or reducibility strikes again! Annals of Pureand Applied Logic , 91:231–270, 1998.[24] G. Gentzen. Untersuchungen ¨uber das logische Schließen.
MathematischeZeitschrift , 39:176–210, 405–431, 1935.[25] S. Ghilezan. Strong normalization and typability with intersection types.
NotreDame Journal of Formal Logic , 37(1):44–52, 1996.[26] S. Ghilezan, J. Iveti´c, P. Lescanne, and D. ˇZuni´c. Intuitionistic sequent-stylecalculus with explicit structural rules. In , volume 6618 of
LNAI , pages 101–124, 2011.[27] S. Ghilezan and S. Likavec. Computational interpretations of logics. In Z. Ogn-janovi´c, editor,
Collection of Papers, special issue Logic in Computer Science20(12) , pages 159–215. Mathematical Institute of Serbian Academy of Sciencesand Arts, 2009.[28] Silvia Ghilezan, Jelena Iveti´c, Pierre Lescanne, and Silvia Likavec. Intersectiontypes for the resource control lambda calculi. In Antonio Cerone and Pekka Pih-lajasaari, editors, , volume 6916 of
Lecture Notes in Computer Science , pages116–134. Springer, 2011. 3729] Silvia Ghilezan and Silvia Likavec. Reducibility: A Ubiquitous Method inLambda Calculus with Intersection Types. In Steffen van Bakel, editor,
ITRS ’02 ,volume 70 of
Electronic Notes in Theoretical Computer Science , pages 106–123,2002.[30] J.-Y. Girard. Une extension de l’interpr´etation de G¨odel `a l’analyse, et son ap-plication `a l’elimination des coupures dans l’analyse et la th´eorie des types. InJ. E. Fenstad, editor, , pages 63–92. North-Holland, 1971.[31] J.-Y. Girard. Linear logic.
Theoretical Computer Science , 50:1–102, 1987.[32] J.-Y. Girard, Y. Lafont, and P. Taylor.
Proofs and Types , volume 7 of
CambridgeTracts in Theoret Computer Science . Cambridge University Press, 1989.[33] H. Herbelin. A lambda calculus structure isomorphic to Gentzen-style sequentcalculus structure. In L. Pacholski and J. Tiuryn, editors,
Computer ScienceLogic, CSL ’94 , volume 933 of
Lecture Notes in Computer Science , pages 61–75. Springer, 1995.[34] W. A. Howard. The formulas-as-types notion of construction. In J. P. Seldin andJ. R. Hindley, editors,
To H. B. Curry: Essays on Combinatory Logic, LambdaCalculus and Formalism , pages 479–490. Academic Press, London, 1980.[35] D. Kesner and S. Lengrand. Resource operators for lambda-calculus.
Informationand Computation , 205(4):419–473, 2007.[36] D. Kesner and F. Renaud. The prismoid of resources. In R. Kr´aloviˇc andD. Niwi´nski, editors, , volume 5734 of
Lecture Notes in Com-puter Science , pages 464–476. Springer, 2009.[37] D. Kesner and F. Renaud. A prismoid framework for languages with resources.
Theoretical Computer Science , 412(37):4867–4892, 2011.[38] A. J. Kfoury and J. B. Wells. Principality and type inference for intersection typesusing expansion variables.
Theoretical Computer Science , 311(1-3):1–70, 2004.[39] K. Kikuchi. Simple proofs of characterizing strong normalisation for explicitsubstitution calculi. In F. Baader, editor, , volume 4533 of
Lecture Notes in ComputerScience , pages 257–272. Springer, 2007.[40] G. Koletsos. Church-Rosser theorem for typed functionals.
Journal of SymbolicLogic , 50:782–790, 1985.[41] J.-L. Krivine.
Lambda-calcul types et mod`eles . Masson, Paris, 1990.[42] S. Lengrand, P. Lescanne, D. Dougherty, M. Dezani-Ciancaglini, and S. vanBakel. Intersection types for explicit substitutions.
Information and Computa-tion , 189(1):17–42, 2004. 3843] Ralph Matthes. Characterizing strongly normalizing terms of a calculus withgeneralized applications via intersection types. In
ICALP Satellite Workshops ,pages 339–354, 2000.[44] J. C. Mitchell. Type systems for programming languages. In J. van Leeuwen,editor,
Handbook of Theoretical Computer Science , Volume B, pages 415–431.Elsevier, Amsterdam, 1990.[45] J. C. Mitchell.
Foundation for Programmimg Languages . MIT Press, Boston,1996.[46] P. M. Neergaard. Theoretical pearls: A bargain for intersection types: a simplestrong normalization proof.
Journal of Functional Programming , 15(5):669–677,2005.[47] M. Pagani and S. Ronchi Della Rocca. Solvability in resource lambda-calculus. InC.-H. L. Ong, editor, , volume 6014 of
LectureNotes in Computer Science , pages 358–373. Springer, 2010.[48] M. Parigot. Lambda-mu-calculus: An algorithmic interpretation of classical nat-ural deduction. In A. Voronkov, editor, , volume 624 of
Lecture Notesin Computer Science , pages 190–201. Springer, 1992.[49] Luis Pinto and Roy Dyckhoff. Sequent calculi for the normal terms of the lp and lps calculi. Electronic Notes in Theoretical Computer Science , 17:1–14, 1998.[50] G. Pottinger. A type assignment for the strongly normalizable l -terms. InJ. P. Seldin and J. R. Hindley, editors, To H. B. Curry: Essays on Combina-tory Logic, Lambda Calculus and Formalism , pages 561–577. Academic Press,London, 1980.[51] L. Regnier. Une ´equivalence sur les lambda-termes.
Theoretical Computer Sci-ence , 126(2):281–292, 1994.[52] K H. Rose. CRSX - Combinatory Reduction Systems with Extensions. In Man-fred Schmidt-Schauß, editor, , volume 10 of
Leibniz International Proceed-ings in Informatics (LIPIcs) , pages 81–90. Schloss Dagstuhl–Leibniz-Zentrumfuer Informatik, 2011.[53] K. H. Rose. Implementation Tricks That Make CRSX Tick. Talk at IFIP 1.6workshop, RDP’2011, 2011.[54] Kristoffer Rose, Roel Bloo, and Fr´ed´eric Lang. On explicit substitution withnames.
Journal of Automated Reasoning , pages 1–26, 2011.3955] P. Sall´e. Une extension de la th´eorie des types en lambda-calcul. In G. Ausielloand C. B¨ohm, editors, , volume 62 of
Lecture Notes in Computer Science ,pages 398–410. Springer, 1978.[56] P. Schroeder-Heister and K. Doˇsen.
Substructural Logics . Oxford UniversityPress, UK, 1993.[57] R. Statman. Logical relations and the typed l -calculus. Information and Control ,65:85–97, 1985.[58] W. W. Tait. Intensional interpretations of functionals of finite type I.
Journal ofSymbolic Logic , 32:198–212, 1967.[59] W. W. Tait. A realizability interpretation of the theory of species. In R. Parikh,editor,
Logic Colloquium , volume 453 of
Lecture Notes in Mathematics , pages240–251. Springer, 1975.[60] S. van Bakel. Complete restrictions of the intersection type discipline.
TheoreticalComputer Science , 102(1):135–163, 1992.[61] V. van Oostrom. Net-calculus. Course notes, Utrecht University, 2001.[62] D. ˇZuni´c.
Computing with sequents and diagrams in classical logic - calculi ∗ X , d X and c (cid:13) X . Phd thesis, ´Ecole Normale Sup´erieure de Lyon, 2007.40. Phd thesis, ´Ecole Normale Sup´erieure de Lyon, 2007.40