Characterisation of Approximation and (Head) Normalisation for λμ using Strict Intersection Types
NN. Kobayashi (Ed.): Eighth Workshopon Intersection Types and Related Systems (ITRS 2016).EPTCS 242, 2017, pp. 20–30, doi:10.4204/EPTCS.242.4 c (cid:13)
Steffen van BakelThis work is licensed under theCreative Commons Attribution License.
Characterisation of Approximation and(Head) Normalisation for λµ using Strict Intersection Types Steffen van Bakel
Department of Computing, Imperial College London, 180 Queen’s Gate, London SW7 2BZ, UK
We study the strict type assignment for λµ that is presented in [7]. We define a notion of approx-imants of λµ -terms, show that it generates a semantics, and that for each typeable term there is anapproximant that has the same type. We show that this leads to a characterisation via assignable typesfor all terms that have a head normal form, and to one for all terms that have a normal form, as wellas to one for all terms that are strongly normalisable. Introduction
The Intersection Type Discipline [13] is an extension of the standard, implicative type assignment knownas Curry’s system [16] for the λ -calculus [15, 12]; the extension made consists of relaxing the require-ment that a parameter for a function should have a single type, adding the type constructor ∩ next to → .This simple extension allows for a great leap in complexity: not only can a (filter) model be built forthe λ -calculus using intersection types, also strong normalisation (termination) can be characterised viaassignable types; however, type assignment becomes undecidable.A natural question is whether or intersection type assignment yields a semantics also for other calculi,like λµ [19]. To answer that, in [8, 9, 10] a notion of intersection type assignment was defined for λµ that is a variant of the union-intersection system defined in [5]. Inspired by Streicher and Reus’sdomain [23], λµ -terms are separated into terms and streams ; then λµ ’s names act as the destination ofstreams, the same way variables are the destination of terms. A type theory is defined following thedomain construction; the main results for that system are the definition of a filter model, closure underconversion, and that the system is an extension of Parigot’s [8]; and that, in a restricted system, the termsthat are typeable are exactly the strongly normalising ones [9].One of the main disadvantages of taking the domain-directed approach to type assignment is that,naturally, intersection becomes a ‘top level’ type constructor, that lives at the same level as arrow, forexample, which induces a contra-variant type inclusion relation ‘ ≤ ’ and type assignment rule ( ≤ ) thatgreatly hinder proofs and gives an intricate generation lemma. This problem is addressed in [7] wherea strict version of the system of [10] is defined, in the spirit of that of [1, 6] that allows for more easilyconstructed proofs. The main restriction with respect to the system of [10] is limiting the type inclusionrelation to a relation that is no longer contra-variant, and allows only for the selection of a componentof an intersection type; this is accompanied by a restriction of the type language, essentially no longerallowing intersection on the right of an arrow. The main results shown in [7] are that the system isclosed under conversion (i.e. under reduction and expansion), and that all terms typeable in a systemthat excludes the type constant ω are strongly normalisable. To that aim it shows that, in this system,cut-elimination is strongly normalisable, using the technique of derivation reduction [3] (see also [4, 6]).In this paper, we will elaborate further on the strict system. As in [4, 6], in this paper we willshow that the fact that derivation reduction is strongly normalisable also here leads to an approximationteffen van Bakel 21result. For that, we define a notion of approximation for λµ , and show that this yields a semantics(Thm. 13). We then show that for every typeable term there exists an approximant of that term that canbe assigned exactly the same types (Thm. 17). We then show that this approximation result naturallygives a characterisation of head normalisation (Thm 18), as well as a characterisation of normalisation(Thm 24). We also revisit the proof of characterisation of strong normalisation of terms through theassignable types (Thm 28), which thanks to the approximation result has a more elegant proof.Because of the restricted available space, most of the (full) proofs are not presented here. A versionof this paper with the proofs added in an appendix can be found at . Note:
We will write n for the set {
1, . . . , n } and use a vector notation for the abbreviation of sequences,so write X n for X , . . . , X n , and X if the number of elements in the sequence is not important. λµ -calculus In this section we present Parigot’s pure λµ -calculus as introduced in [19]. It is an extension of theuntyped λ -calculus obtained by adding names and a name-abstraction operator µ and was intended as aproof calculus for a fragment of classical logic. Derivable statements have the shape Γ ⊢ M : A | ∆ , where A is the main ( active ) conclusion of the statement, and ∆ contains the alternative conclusions, consistingof pairs of names and types; the left-hand context Γ , as usual, is a mapping from term variables to types,and represents the assumptions about free variables of M . Definition 1 (T ERM S YNTAX [19]) Let x , y , z , . . . range over term variables , and α , β , γ , δ , . . . rangeover names . The terms , ranged over by M , N , P , Q , . . . are defined by the grammar: M , N :: = x | λ y . M | MN | µα . [ β ] M As usual, we consider λ and µ to be binders; the sets fv ( M ) and fn ( M ) of, respectively, free variables and free names in a term M are defined in the usual way. We adopt Barendregt’s convention on terms,and will assume that free and bound variables and names are different. Definition 2 (S UBSTITUTION [19]) Substitution takes two forms: term substitution: M [ N / x ] ( N is substituted for x in M ) structural substitution: M [ L · γ / α ] (every ‘subterm’ [ α ] N of M is replaced by [ γ ] NL )As usual, both substitutions are capture avoiding, using α -conversion when necessary. Definition 3 (R EDUCTION [19]) Reduction in λµ is based on the following rules: ( β ) : ( λ x . M ) N → M [ N / x ] ( logical reduction )( µ ) : (cid:26) ( µβ . [ β ] P ) Q → µγ . [ γ ]( P [ Q · γ / β ] ) Q ( µβ . [ δ ] P ) Q → µγ . [ δ ] P [ Q · γ / β ] , if δ = β ( structural reduction )( R EN ) : (cid:26) µα . [ β ] µγ . [ γ ] M → µα . [ β ] M [ β / γ ] µα . [ β ] µγ . [ δ ] M → µα . [ δ ] M [ β / γ ] , if δ = γ ( renaming ) We write M → βµ N for the reduction relation that is the compatible closure of these rules, and = βµ forthe equivalence relation generated by it. A more common notation for the second rule, for example, would be ( µβ . [ δ ] M ) N → µβ . [ δ ] M [ N / β ] . This implicitly usesthe fact that β disappears during reduction, and through α -conversion can be picked as name for the newly created applicationsinstead of γ . But, in fact, this is not the same β (and the named term has changed), as reflected in the fact that its type changesduring reduction. Moreover, when making the substitution explicit as in [11], it becomes clear that this other approach in factis a short-cut, which our definition does without. λµ using Strict Intersection TypesConfluence for this notion of reduction has been shown in [20].We will need the concept of head-normal form for λµ , which is defined as follows: Definition 4 (H EAD - NORMAL FORMS ) The λµ head-normal forms (with respect to our notion of re-duction → βµ ) are defined through the grammar: H :: = xM · · · M n ( n ≥ ) | λ x . H | µα . [ β ] H ( H = µγ . [ δ ] H ′ ) Intersection (and union) type assignment for λµ was first defined in [5]; this was followed by [8], inwhich an intersection type theory is developed departing from Streicher and Reus’s domain construction[23]. Terms can be typed with functional types δ and streams by continuation types κ that are of theshape δ ×· · ·× δ n × ω , so essentially is a sequence of δ s. This later [9] was followed by the proof that, asfor the λ -calculus, the underlying intersection type system for λµ allows for the full characterisation ofstrongly normalisable terms; in that paper, renaming is not considered. These papers were later combined(and revised) into [10]. One of the main disadvantages of taking the domain-directed approach to typeassignment is that, naturally, intersection becomes a ‘top level’ type constructor, that lives at the samelevel as arrow, for example. This in itself is not negative, since it gives readable types and easy-to-understand type assignment rules, but it also induces a contra-variant type inclusion relation ‘ ≤ ’ andtype assignment rule ( ≤ ) that hinder proofs and give an intricate generation lemma (see [10] for details).Therefore, in [7], a strict restriction of the system of [10] was presented, where the occurrence ofintersections is limited to only appear as components of continuation types (so no intersections of con-tinuation types), and type inclusion is no longer contra-variant and only allows for the selection of acomponent in an intersection type. It also uses Ω rather than ω to mark the end of a continuation type.But, more importantly, it removed the inference rule ( ≤ ) , and changed the type assignment rules toexplicitly state when a ≤ -step is allowed, as in rule ( Ax ) .This system is defined as follows: Definition 5 (S TRICT T YPES [7]) 1. Let υ range over a countable, infinite set of type constants. Wedefine our strict types by the grammar: A , B :: = C → υ basic types R , S , T :: = ω | A ∩ · · · ∩ A n ( n ≥ ) intersection types C , D :: = Ω | S × C continuation types
2. On strict types, the type inclusion relation ≤ S is the smallest partial order satisfying the rules: ( j ∈ n , n ≥ ) A ∩ · · · ∩ A n ≤ A j S ≤ A i ( ∀ i ∈ n ) ( n ≥ ) S ≤ A ∩ · · · ∩ A n S ≤ ω C ≤ Ω S ≤ T C ≤ D S × C ≤ T × D For convenience, we will write ∩ I A i for A i ∩ · · · ∩ A i n where I = { i , . . . , i n } , ∩ A i for ω , so thesecond and third rule combine to S ≤ A i ( ∀ i ∈ n ) ( n ≥ ) S ≤ A ∩ · · · ∩ A n and ∩ n A i for A ∩ . . . ∩ A n . Notice that for any continuation type C there are n ≥ and S i ( i ∈ n ) suchthat C = S ×· · · S n × Ω .teffen van Bakel 23 Definition 6 (S TRICT T YPE A SSIGNMENT [7]) 1. A variable context Γ is a mapping from term vari-ables to intersection types, denoted as a finite set of statements x : S , such that the subject of thestatements ( x ) are distinct.2. We write Γ , x : S for the context defined by: Γ , x : S = ∆ Γ ∪ { x : S } , if Γ is not defined on x = ∆ Γ , if x : S ∈ Γ We write x Γ if there exists no S such that x : S ∈ Γ .3. Name contexts ∆ and the notions α : C , ∆ and α ∆ are defined in a similar way.4. We define strict type assignment for λµ -terms through the following natural deduction system: ( Ax ) : ( S ≤ S A ) Γ , x : S ⊢ x : A | ∆ ( ∩ ) : Γ ⊢ M : A i | ∆ ( ∀ i ∈ I ) ( I = ∨ | I | ≥ ) Γ ⊢ M : ∩ I A i | ∆ ( Abs ) : Γ , x : S ⊢ M : C → υ | ∆ ( x Γ ) Γ ⊢ λ x . M : S × C → υ | ∆ ( µ ) : Γ ⊢ M : D → υ | α : C , ∆ ( α ∆ , C ≤ S D ) Γ ⊢ µα . [ α ] M : C → υ | ∆ ( App ) : Γ ⊢ M : S × C → υ | ∆ Γ ⊢ N : S | ∆Γ ⊢ MN : C → υ | ∆ ( µ ′ ) : Γ ⊢ M : D → υ | α : C , β : C ′ , ∆ ( β = α & α ∆ , C ′ ≤ S D ) Γ ⊢ µα . [ β ] M : C → υ | β : C ′ , ∆ We write Γ ⊢ S M : S | ∆ for judgements derivable using these rules, and prefix this with ‘ D :: ’ ifwe want to name the derivation.5. The relation ≤ S is naturally extended to variable contexts as follows: Γ ≤ S Γ ′ = ∆ ∀ x : S ∈ Γ ′ ∃ x : T ∈ Γ [ T ≤ S S ] ; ∆ ≤ S ∆ ′ is defined similarly. Definition 7
By abuse of notation, we allow the notation S ∩ T , where S = ∩ n A i and T = ∩ m B j , whichstands for A ∩ · · · ∩ A n ∩ B ∩ · · · ∩ B m . Given two contexts Γ and Γ , we define the context Γ ∩ Γ asfollows: Γ ∩ Γ = ∆ { x : S ∩ S | x : S ∈ Γ & x : S ∈ Γ } ∪{ x : S | x : S ∈ Γ & x Γ } ∪ { x : S | x : S ∈ Γ & x Γ } and write ∩ n Γ i for Γ ∩ · · · ∩ Γ n . We will also allow intersection of continuation types as short-handnotation: let D = S ×· · ·× S n × Ω , and C = T ×· · ·× T m × Ω and assume, that n < m ; we define D ∩ C = ∆ S ∩ T ×· · ·× S n ∩ T n × T n + ×· · ·× T m × Ω . (we need this notion in the proof of Thm. 18). Then ∆ ∩ ∆ is defined the same way as Γ ∩ Γ .In [7] it is then shown that this notion of type assignment is closed under conversion, so can be usedto define a (filter) semantics. That paper also defines a notion of cut-elimination, by defining derivationreduction → D ER , where only those redexes in terms are contracted that are typed with a type differentfrom ω ; it shows that this notion is strongly normalisable, which then leads to the proof that all termstypeable in a restriction of ⊢ S that eliminates the type constant ω , are strongly normalisable.The main results shown in [7] that are relevant to this paper are: Theorem 8 ([7])
1. If Γ ⊢ S M : S | ∆ , Γ ′ ≤ S Γ , ∆ ′ ≤ S ∆ , and S ≤ S T , then Γ ′ ⊢ S M : T | ∆ ′ . The condition ∆ ′ ≤ S ∆ might seem counterintuitive, since one might expect the inclusion relation to be reversed. Tosupport intuition, we can see types in name contexts as negations, and α : A × Ω as α : ¬ A . Notice that A ∩ B × Ω ≤ S A × Ω ;obviously we have α : A ∩ B × Ω ≤ S α : A × Ω and ¬ A ≤ ¬ A ∪ ¬ B . λµ using Strict Intersection Types
2. If Γ ⊢ S M : A | ∆ and M = βµ N , then Γ ⊢ S N : A | ∆ .3. Let D :: Γ ⊢ S M : S | ∆ , and D → ∗ D ER D ′ :: Γ ⊢ S N : S | ∆ , then M → ∗ βµ N .4. If D :: Γ ⊢ S M : S | ∆ , then SN ( D ) ( D is strongly normalisable). λµ Following the approach of [24], we now define an approximation semantics for λµ with respect to → βµ .Essentially, approximants are partially evaluated expressions in which the locations of incompleteevaluation ( i.e. where reduction may still take place) are explicitly marked by the element ⊥ ; thus, they approximate the result of computations.Approximation for Λµ (a variant of λµ where naming and µ -binding are separated [17]) has beenstudied by others as well [22, 18]; weak approximants for λµ are studied in [11]. Definition 9 (A PPROXIMATION FOR λµ ) 1. We define λµ ⊥ as an extension of λµ by adding the termconstant ⊥ .2. The set of λµ ’s approximants A with respect to → βµ is defined through the grammar: A :: = ⊥ | xA · · · A n ( n ≥ ) | λ x . A ( A = ⊥ ) | µα . [ β ] A ( A = µγ [ δ ] A ′ , A = ⊥ )
3. The relation ⊑ ⊆ λµ ⊥ is the smallest preorder that is the compatible extension of ⊥ ⊑ M .4. The set of approximants of M , A ( M ) , is defined as A ( M ) = ∆ { A ∈ A | ∃ N ∈ λµ [ M → ∗ βµ N & A ⊑ N ] } . Approximation equivalence between terms is defined through: M ∼ A N = ∆ A ( M ) = A ( N ) . The relationship between the approximation relation and reduction is characterised by:
Lemma 10 1. If A ⊑ M and M → ∗ βµ N , then A ⊑ N .2. H is a head-normal form if and only if there exists A ∈ A such that A ⊑ H and A = ⊥ . The following definition introduces an operation of join on λµ ⊥ -terms. Definition 11 (J OIN , COMPATIBLE TERMS ) 1. The partial mapping join , ⊔ : λµ ⊥ → λµ ⊥ , is definedby: ⊥ ⊔ M ≡ M ⊔ ⊥ ≡ Mx ⊔ x ≡ x ( λ x . M ) ⊔ ( λ x . N ) ≡ λ x . ( M ⊔ N )( µα . [ β ] M ) ⊔ ( µα . [ β ] N ) ≡ µα . [ β ]( M ⊔ N )( M M ) ⊔ ( N N ) ≡ ( M ⊔ N ) ( M ⊔ N )
2. If M ⊔ N is defined, then M and N are called compatible .It is easy to show that ⊔ is associative and commutative; we will use ⊔ n M i for the term M ⊔ · · · ⊔ M n .Note that ⊥ can be defined as the empty join, i.e. if M ≡ ⊔ M i , then M ≡ ⊥ .The following lemma shows that the join acts as least upper bound of compatible terms. The last alternative in the definition of ⊔ defines the join on applications in a more general way than Scott’s, that wouldstate that ( M M ) ⊔ ( N N ) ⊑ ( M ⊔ N ) ( M ⊔ N ) , since it is not always sure if a join of two arbitrary terms exists.Since we will use our more general definition only on terms that are compatible, there is no real conflict. teffen van Bakel 25 Lemma 12 1. If P ⊑ M , and Q ⊑ M , then P ⊔ Q is defined, and: P ⊑ P ⊔ Q , Q ⊑ P ⊔ Q , and P ⊔ Q ⊑ M .
2. If A , A ∈ A ( M ) , then A and A are compatible. We can also define M = ⊔ { A | A ∈ A ( M ) } (which by the previous lemma is well defined); then · corresponds to (a λµ variant of) B ¨ohm trees [14, 12].As is standard in other settings, interpreting a λµ -term M through its set of approximants A ( M ) gives a semantics. Theorem 13 (A PPROXIMATION SEMANTICS FOR λµ ) If M = βµ N , then M ∼ A N .Proof: By induction on the definition of = βµ , of which we only show the case M → ∗ βµ N . ( A ( M ) ⊆ A ( N )) : If A ∈ A ( M ) , then there exists L such that M → ∗ βµ L and A ⊑ L . Since → βµ isChurch-Rosser, there exists R such that L → ∗ βµ R and N → ∗ βµ R , so also M → ∗ βµ R . Then byLem. 10, A ⊑ R , and since N → ∗ βµ R , we have A ∈ A ( N ) . ( A ( N ) ⊆ A ( M )) : If A ∈ A ( N ) , then there exists L such that N → ∗ βµ L and A ⊑ L . But then also M → ∗ βµ L , so A ∈ A ( M ) .The reverse implication of this result does not hold, since terms without head-normal form (which haveonly ⊥ as approximant) are not all related by reduction, so approximation semantics is not fully abstract. ⊢ S In this section we will show an approximation result, i.e. for every M , Γ , S , and ∆ such that Γ ⊢ S M : S | ∆ , there exists an A ∈ A ( M ) such that Γ ⊢ S A : S | ∆ . From this, the well-known characterisation of(head-)normalisation of λµ -terms using intersection types follows easily, i.e. all terms having a (head)normal form are typeable in ⊢ S (with a type without ω -occurrences). Another result is the well-knowncharacterisation of strong normalisation of typeable λµ -terms, i.e. all terms, typeable in ⊢ S without usingthe rule ( ∩ ) with I = , are strongly normalisable.First we give some auxiliary definitions and results.The rules of the system ⊢ S are generalised to λµ ⊥ ; therefore, if ⊥ occurs in a term M and D :: Γ ⊢ S M : S | ∆ , in that derivation ⊥ has to appear in a position where the rule ( ∩ ) is used with I = , i.e.,in a sub-term typed with ω . Notice that λ x . ⊥ , ⊥ M · · · M n , and µα . [ β ] ⊥ are typeable by ω only.First we show that ⊢ S is closed for ⊑ . Lemma 14 Γ ⊢ S M : S | ∆ and M ⊑ N then Γ ⊢ S N : S | ∆ . Next we define a notion of type assignment that is similar to that of Def. 6, but differs in that it assigns ω only to the term ⊥ . Definition 15 ⊥ -type assignment and ⊥ -derivations are defined as ⊢ S , with the exception of: ( ∩ ⊥ ) : Γ ⊢ M i : A i | ∆ ( ∀ i ∈ n ) ( n = ∨ n ≥ ) Γ ⊢ ⊔ n M i : ∩ n A i | ∆ We write Γ ⊢ ⊥ M : S | ∆ if this statement is derivable using a ⊥ -derivation.Notice that, by rule ( ∩ ⊥ ) , Γ ⊢ ⊥ ⊥ : ω | ∆ , and that this is the only way to assign ω to a term. Moreover,in that rule, the terms M j need to be compatible (otherwise their join would not be defined).6 Approximation and (Head) Normalisation for λµ using Strict Intersection Types Lemma 16 1. If D :: Γ ⊢ ⊥ M : S | ∆ , then D :: Γ ⊢ S M : S | ∆ .2. If D :: Γ ⊢ S M : S | ∆ , then there exists M ′ ⊑ M such that D :: Γ ⊢ ⊥ M ′ : S | ∆ . Notice that, since M ′ need not be the same as M , the second derivation in part (2) is not exactly thesame; however, it has the same structure in terms of applied derivation rules.Using Thm. 8 (4) and Lem. 16, as for the BCD-system (see [21]) and the system of [2], the relationbetween types assignable to a λµ -term and those assignable to its approximants can be formulated as: Theorem 17 (A PPROXIMATION ) Γ ⊢ S M : S | ∆ ⇐⇒ ∃ A ∈ A ( M ) [ Γ ⊢ S A : S | ∆ ] .Proof: ( ⇒ ) : If D :: Γ ⊢ S M : S | ∆ , then, by Thm. 8 (4), SN ( D ) . Let D ′ :: Γ ⊢ S N : S | ∆ be a normalform of D with respect to → D ER , then by Thm. 8 (3), M → ∗ β N and, by Lem. 16 (2), there exists N ′ ⊑ N such that D ′ :: Γ ⊢ ⊥ N ′ : S | ∆ . So, in particular, N ′ contains no redexes (no redexes typedwith a type different form ω since D ′ is in normal form, and none typed with ω since only ⊥ canbe typed with ω ), so N ′ ∈ A , and therefore N ′ ∈ A ( M ) . ( ⇐ ) : Let A ∈ A ( M ) be such that Γ ⊢ S A : S | ∆ . Since A ∈ A ( M ) , there exists N such that M → ∗ βµ N and A ⊑ N . Then, by Lem. 14, Γ ⊢ S N : S | ∆ , and, by Thm. 8 (2), also Γ ⊢ S M : S | ∆ .Using this last result, the characterisation of head-normalisation becomes easy to show. Theorem 18 (H EAD - NORMALISATION ) There exists Γ , A , and ∆ such that Γ ⊢ S M : A | ∆ , if and onlyif M has a head normal form.Proof: ( only if ) : If Γ ⊢ S M : A | ∆ , then, by Thm. 17, there exists an A ∈ A ( M ) such that Γ ⊢ ⊥ A : A | ∆ .Then, by Def. 9, there exists N such that M → ∗ βµ N and A ⊑ N . Since A = ω , A ⊥ , so weknow that A is either xA · · · A n ( n ≥ ) , λ x . A ′ , or µα . [ β ] A ′ with A ′ = µγ . [ δ ] A ′′ . Since A ⊑ N , N is either xM · · · M n ( n ≥ ) , λ x . P , or µα . [ β ] P with P = µγ . [ δ ] Q . Then N is in head-normalfrom and M has a head-normal form. ( if ) : If M has a head-normal form, then there exists N such that M → ∗ βµ N and either: ( N ≡ xM · · · M n ) : Take Γ = x : ω ×· · ·× ω × Ω → υ (with n times ω ) and A = Ω → υ . ( N ≡ λ x . P ) : Since P is in head-normal form, by induction there are Γ ′ , C , υ , and ∆ ′ such that Γ ′ ⊢ S P : C → υ | ∆ ′ . If x : S ∈ Γ ′ , take Γ = Γ ′ \ x , and A = S × C → υ ; otherwise take Γ = Γ ′ and A = ω × C → υ . In either case, by rule ( Abs ) , Γ ⊢ S λ x . P : A | ∆ ′ ( N = µα . [ α ] P ) : Since P is in head-normal form, by induction there are Γ ′ , C , D , υ , and ∆ ′ suchthat Γ ′ ⊢ S P : D → υ | α : C , ∆ ′ . Take C ′ = C ∩ D , then by Thm. 8 (1) also Γ ′ ⊢ S P : D → υ | α : C ′ , ∆ ′ ,and since C ′ ≤ S D , by rule ( µ ) we get Γ ′ ⊢ S µα . [ α ] P : C ′ → υ | ∆ ′ . ( N = µα . [ β ] P , with α = β ) : Since P is in head-normal form, by induction there are C , C ′ , D suchthat Γ ′ ⊢ S P : D → υ | α : C , β : C ′ , ∆ and C ′ ≤ S D . Take C ′′ = C ′ ∩ D , then by Thm. 8 (1) also Γ ′ ⊢ S P : D → υ | α : C , β : C ′′ , ∆ , and since C ′′ ≤ S D we get Γ ′ ⊢ S µα . [ β ] P : C ′ → υ | β : C ′′ , ∆ ′ by ( µ ′ ) .Notice that in all cases, Γ ⊢ S N : A | ∆ , for some A , and by Thm. 8 (2), Γ ⊢ S M : A | ∆ . In this section we show the characterisation of both normalisation and strong normalisation, for whichwe first define a notion of derivability obtained from ⊢ S by restricting the use of the type assignment rule ( ∩ ) to at least two sub-derivations, thereby eliminating the possibility to assign ω to a term.teffen van Bakel 27 Definition 19 (SN
TYPE ASSIGNMENT ) 1. We define the ω -free types by the grammar: A , B :: = C → υ R , S , T :: = A ∩ · · · ∩ A n ( n ≥ ) C , D :: = Ω | S × C SN type assignment is defined using the natural deduction system of Def. 6, but allowing only ω -free types, so restricting rule ( ∩ ) to: ( ∩ ) : Γ ⊢ M : A i | ∆ ( ∀ i ∈ n ) ( n ≥ ) Γ ⊢ M : ∩ n A i | ∆ We write Γ ⊢ SN M : S | ∆ if this judgement is derivable using this system.Notice that the only real change in the system compared to ⊢ S is that ω is no longer an intersection type,so in rule ( ∩ ) , the empty intersection ω is excluded. The following properties hold:
Lemma 20 1. If S ≤ T , then S = ∩ I A i , T = ∩ J B j , and for every j ∈ J there exists i ∈ I such that A i = B j .2. Γ , x : S ⊢ SN x : T | ∆ , if and only if S ≤ S T .3. Γ ⊢ SN M : S | ∆ ⇒ { x : T ∈ Γ | x ∈ fv ( M ) } ⊢ SN M : S | { α : C ∈ ∆ | α ∈ fn ( M ) } .4. Γ ⊢ SN M : S | ∆ & Γ ′ ⊇ Γ & ∆ ′ ⊇ ∆ ⇒ Γ ′ ⊢ SN M : S | ∆ ′ .5. D :: Γ ⊢ SN M : S | ∆ ⇒ D :: Γ ⊢ S M : S | ∆ . As for ⊢ S , we can show that ( ≤ S ) is an admissible rule in ⊢ SN . Lemma 21 If Γ ⊢ SN M : S | ∆ , and Γ ′ , T , and ∆ ′ are all ω -free and satisfy Γ ′ ≤ S Γ , ∆ ′ ≤ S ∆ , and S ≤ S T ,then Γ ′ ⊢ SN M : T | ∆ ′ .Proof: Much the same as the proof for Thm. 8 (1) in [7].The following lemma shows a (limited) subject expansion result for ⊢ SN : it states that if a contractionof a redex is typeable, then so is the redex, provided that the operand N is typeable in its own right; since N might not appear in the contractum, we need to assume that separately. Notice that we demand that N is typeable in the same contexts as the redex itself; this property would not hold once we considercontextual closure (in particular, when the reduction takes place under an abstraction); it might be thatfree names or variables in N get bound in the context. Lemma 22 If Γ ⊢ SN M [ N · γ / α ] : T | γ : C , ∆ and Γ ⊢ SN N : B | ∆ , then there exists S such that Γ ⊢ SN M : T | α : S × C , ∆ and Γ ⊢ SN N : S | ∆ .Proof: By nested induction; the outermost is on the structure of types, and the innermost on the structureof terms. We only show: ( M ≡ x ) : Then x [ N · γ / α ] = x . Take S = B , then by Lem. 20, also Γ ⊢ SN x : C ′ → υ | α : S × C , ∆ .All other cases follow by induction. With the aim of the characterisation of strong normalisation, it would have sufficed to only restrict rule ( ∩ ) ; we restrict theset of types as well in order to be able to characterise normalisation as well. λµ using Strict Intersection TypesTo prepare the characterisation of terms by their assignable types, we first prove that a term in λµ ⊥ -normal form is typeable without ω , if and only if it does not contain ⊥ . This forms the basis for theresult that all normalisable terms are typeable without ω . Notice that the first result is stated for ⊢ S . Lemma 23 1. If Γ ⊢ S A : A | ∆ , and Γ , A , and ∆ are ω -free, then A is ⊥ -free.2. If A is ⊥ -free, then there are Γ , A , and ∆ , such that Γ ⊢ SN A : A | ∆ . Now, as also shown in [1], it is possible to characterise normalisable terms.
Theorem 24 (C HARACTERISATION OF N ORMALISATION ) There exists ω -free Γ , ∆ , and A such that Γ ⊢ S M : A | ∆ , if and only if M has a normal form.Proof: ( ⇒ ) : If Γ ⊢ S M : A | ∆ , by Thm. 17 there exists A ∈ A ( M ) such that Γ ⊢ S A : A | ∆ . Since Γ , A , and ∆ are ω -free, by Lem. 23 (1), this A is ⊥ -free. By Def. 9 there exists N such that M → ∗ βµ N and A ⊑ N . Since A contains no ⊥ , A ≡ N , so N is a normal form, so M has a normal form. ( ⇐ ) : If N is the normal form of M , then it is a ⊥ -free approximate normal form. By Lem. 23 (2) thereare Γ , A , and ∆ such that Γ ⊢ SN N : S | ∆ . By Lem. 20 (5) also Γ ⊢ S N : S | ∆ , and by Thm. 8 (2), Γ ⊢ S M : S | ∆ , and Γ , S , and ∆ are ω -free.In [7] it is shown that it is possible to characterise the set of all terms that are strongly normalisablewith respect to → βµ , using Thm. 8 (4), and the proof for the property that all terms in normal form canbe typed in ⊢ SN , a property that follows here from Lem. 23 (see the proof of the previous result). Otherthan that, the proof is identical.The following lemma shows that ⊢ SN is closed under the expansion of redexes (notice that the resultis not stated for arbitrary reduction steps, but only for terms that are proper redexes). Lemma 25 1. If Γ ⊢ SN M [ N / x ] : A | ∆ and Γ ⊢ SN N : B | ∆ , then Γ ⊢ SN ( λ x . M ) N : A | ∆ .2. If Γ ⊢ SN µγ . [ γ ] P [ Q · γ / β ] Q : A | ∆ and Γ ⊢ SN Q : B | ∆ , then Γ ⊢ SN ( µβ . [ β ] P ) Q : A | ∆ .3. If Γ ⊢ SN µγ . [ δ ] P [ Q · γ / β ] : A | ∆ (with β = δ ) and Γ ⊢ SN Q : B | ∆ , then Γ ⊢ SN ( µβ . [ δ ] P ) Q : A | ∆ .4. If Γ ⊢ SN µα . ([ δ ] P )[ β / γ ] : A | ∆ , then Γ ⊢ SN µα . [ β ] µγ . [ δ ] P : A | ∆ . Thm. 28 below shows that the set of strongly normalisable terms is exactly the set of terms typeablein the intersection system without using the type constant ω . The proof goes by induction on the leftmostoutermost reduction path. First we introduce the notion of leftmost, outer-most reduction. Definition 26
An occurrence of a redex R in a term M is called the leftmost, outermost redex of M ( lor ( M ) ), if:1. There is no redex R ′ in M such that R ′ = C [ R ] with C [ − ] = [ − ] ( outer-most );2. There is no redex R ′ in M such that M = C [ C [ R ′ ] C [ R ] ] ( leftmost ).We write M → lor N is used to indicate that M reduces to N by contracting lor ( M ) .The following lemma formulates a subject expansion result for ⊢ SN with respect to left-most outer-most reduction. Lemma 27 Assume M → lor N , and Γ ⊢ SN N : C → υ | ∆ ; if lor ( M ) = PQ also assume that Γ ⊢ SN Q : B | ∆ . Then there exists Γ ′ , ∆ ′ , C ′ such that Γ ′ ⊢ SN M : C ′ → υ | ∆ ′ . We can now show that all strongly normalisable terms are exactly those typeable in ⊢ SN .teffen van Bakel 29 Theorem 28 ∃ Γ , ∆ , A [ Γ ⊢ SN M : A | ∆ ] ⇐⇒ M is strongly normalisable with respect to → βµ .Proof: ( ⇒ ) : If D :: Γ ⊢ SN M : A | ∆ , then by Lem. 20 (5), also D :: Γ ⊢ S M : A | ∆ . Then, by Thm. 8 (4), D is strongly normalisable with respect to → D ER . Since D contains no ω , all redexes in M corre-spond to redexes in D , a property that is preserved by derivation reduction (it does not introduce ω ). So also M is strongly normalisable with respect to → βµ . ( ⇐ ) : By induction on the maximum of the lengths of reduction sequences for a strongly normalisableterm M to its normal form (denoted by M ).a. If M = , then M is in normal form, and by Lem. 23 (2), there exist Γ , ∆ and A such that Γ ⊢ SN M : A | ∆ .b. If M ≥ , so M contains a redex, then let M → lor N by contracting the redex PQ . Then N < M , and Q < M (since Q is a proper sub-term of a redex in M ), so by induction,for some Γ , Γ ′ , ∆ , ∆ ′ , A , and B , we have Γ ⊢ SN M : A | ∆ and Γ ′ ⊢ SN Q : B | ∆ ′ . Then, byLem. 27, there exist Γ , ∆ , C such that Γ ⊢ SN M : C | ∆ . If the redex is µα . [ β ] µγ . [ δ ] P , then µα . [ β ] µγ . [ δ ] P > µα . ([ δ ] P )[ β / γ ] , so the result follows by induction. Conclusions
We have studied a strict version of the intersection type system for λµ of [10]. Using the fact thatderivation reduction (a kind of cut-elimination) is strongly normalisable, we have shown an approxima-tion theorem, and from that given a characterisation of head normalisation. We have also shown thatthe system without the type constant ω characterises the strongly normalisable terms and that we cancharacterise normalisation as well. References [1] S. van Bakel (1992):
Complete restrictions of the Intersection Type Discipline . TheoreticalComputerScience102(1), pp. 135–163, doi: .[2] S. van Bakel (1995):
Intersection Type Assignment Systems . TheoreticalComputerScience151(2), pp. 385–435, doi: .[3] S. van Bakel (2004):
Cut-Elimination in the Strict Intersection Type Assignment System is Strongly Normal-ising . NotreDamejournalofFormalLogic 45(1), pp. 35–63, doi: .[4] S. van Bakel (2008):
The Heart of Intersection Type Assignment; Normalisation proofs revisited . TheoreticalComputerScience 398, pp. 82–94, doi: .[5] S. van Bakel (2010):
Sound and Complete Typing for λµ . In: Proceedingsof5thInternationalWorkshop In-tersection Types and Related Systems (ITRS’10),Edinburgh,Scotland, ElectronicProceedingsinTheoreticalComputerScience 45, pp. 31–44, doi: .[6] S. van Bakel (2011): Strict intersection types for the Lambda Calculus . ACM Computing Surveys 43, pp.20:1–20:49, doi: .[7] S. van Bakel (2016):
Approximation and (Head) Normalisation for λµ using Strict Intersection Types . Avail-able at .[8] S. van Bakel, F. Barbanera & U. de’Liguoro (2011): A Filter Model for λµ . In L. Ong, editor: Proceedingsof 10th International Conference on Typed Lambda Calculi and Applications (TLCA’11), Lecture Notes inComputerScience 6690, Springer Verlag, pp. 213–228, doi: . λµ using Strict Intersection Types [9] S. van Bakel, F. Barbanera & U. de’Liguoro (2012): Characterisation of Strongly Normalising λµ -Terms . In:Proceedingsof 6th InternationalWorkshop Intersection Types and Related Systems (ITRS’12), Dubrovnik,Croatia,June29th, ElectronicProceedingsinTheoreticalComputerScience121, pp. 31–44, doi: .[10] S. van Bakel, F. Barbanera & U. de’Liguoro (2015): Intersection types for λµ . LogicalMethodsinComputerScience. To appear.[11] S. van Bakel & M.G. Vigliotti (2014): A fully abstract semantics of λµ in the π -calculus . In: Proceedingsof Sixth International Workshop on Classical Logic and Computation 2014 (CL&C’14), Vienna, Austria,ElectronicProceedingsinTheoreticalComputerScience 164, pp. 33–47, doi: .[12] H. Barendregt (1984): The Lambda Calculus: its Syntax and Semantics , revised edition. North-Holland,Amsterdam, doi: .[13] H. Barendregt, M. Coppo & M. Dezani-Ciancaglini (1983):
A filter lambda model and the completeness oftype assignment . JournalofSymbolicLogic 48(4), pp. 931–940, doi: .[14] C. B¨ohm (1968):
Alcune propiet´a delle forme βη -normali nel λ k -calcolo . Pubblicazioni 696, InstitutoNazionaleperleApplicazionidelCalcolo.Roma.[15] A. Church (1936): A Note on the Entscheidungsproblem . JournalofSymbolicLogic1(1), pp. 40–41, doi: .[16] H.B. Curry & R. Feys (1958):
Combinatory Logic . 1, North-Holland, Amsterdam.[17] Ph. de Groote (1994):
On the Relation between the λµ -Calculus and the Syntactic Theory of SequentialControl . In: Proceedingsof5thInternationalConferenceonLogicforProgramming,ArtificialIntelligence,and Reasoning (LPAR’94), Lecture Notes in Computer Science 822, Springer Verlag, pp. 31–43, doi: .[18] U. de’Liguoro (2016): The Approximation Theorem for the Λµ -Calculus . MathematicalStructuresin Com-puterScience FirstView, pp. 1–21, doi: .[19] M. Parigot (1992): An algorithmic interpretation of classical natural deduction . In: Proceedingsof3rdInter-national Conferenceon Logic for Programming,Artificial Intelligence, and Reasoning (LPAR’92), LectureNotesinComputerScience 624, Springer Verlag, pp. 190–201, doi: .[20] W. Py (1998):
Confluence en λµ -calcul . Th`ese de doctorat, Universit´e de Savoie.[21] S. Ronchi Della Rocca & B. Venneri (1984): Principal type schemes for an extended type theory . TheoreticalComputerScience 28, pp. 151–169, doi: .[22] A. Saurin (2010):
Standardization and B¨ohm Trees for λµ -calculus . In M. Blume, N. Kobayashi& G. Vidal, editors: Functional and Logic Programming, 10th International Symposium, (FLOPS’10),Sendai, Japan, Lecture Notes in Computer Science 6009, Springer Verlag, pp. 134–149, doi: .[23] Th. Streicher & B. Reus (1998): Classical logic: Continuation Semantics and Abstract Machines . JournalofFunctionalProgramming11(6), pp. 543–572, doi: .[24] C.P. Wadsworth (1976):
The Relation Between Computational and Denotational Properties for Scott’s D ∞ -Models of the Lambda-Calculus . SIAMJournalonComputing5(3), pp. 488–521, doi:10.1137/0205036