Completeness and partial soundness results for intersection and union typing for λ¯μμ̃

Steffen van Bakel
2010 Annals of Pure and Applied Logic  
This paper studies intersection and union type assignment for the calculus λµμ (Curien and Herbelin, 2000 [16]), a proof-term syntax for Gentzen's classical sequent calculus, with the aim of defining a type-based semantics, via setting up a system that is closed under conversion. We will start by investigating what the minimal requirements are for a system, for λµμ to be complete (closed under redex expansion); this coincides with System M ∩∪ , the notion defined in Dougherty et al. (2004) [18]
more » ... ; however, we show that this system is not sound (closed under subject reduction), so our goal cannot be achieved. We will then show that System M ∩∪ is also not complete, but can recover from this by presenting System M c as an extension of M ∩∪ (by adding typing rules) and showing that it satisfies completeness; it still lacks soundness. We show how to restrict M ∩∪ so that it satisfies soundness as well by limiting the applicability of certain type assignment rules, but only when limiting reduction to (confluent) call-by-name or call-by-value reduction; in restricting the system this way, we sacrifice completeness. These results when combined show that, with respect to full reduction, it is not possible to define a sound and complete intersection and union type assignment system for λµμ. Introduction The role of and the attention to Classical Logic in computer science have been changing drastically over the last few years. Given the direct relation between the (typed) λ-calculus [14, 10] and intuitionistic logic, for many years it was believed that only the constructive logics had any real computational content, and only after Griffin's discovery of the relation between double-negation elimination [25] and Felleisen's control operators [22] did the research community become aware of the computational advantages of Classical Logic. There are two main directions in proof theory: sequent calculi and natural deduction systems, both introduced by Gentzen in [23, 24]. On the one hand, the Sequent Calculus lk is a logical system in which the rules only introduce connectives (but on either side of a sequent); on the other hand, Natural Deduction uses rules that introduce or eliminate connectives in the logical formulae. Natural deduction normally derives statements with a single conclusion, whereas lk allows for multiple conclusions, deriving sequents of the form A 1 , . . . , A n B 1 , . . . , B m , where A 1 , . . . , A n is to be understood as A 1 ∧ · · · ∧A n and B 1 , . . . , B m is to be understood as B 1 ∨ · · · ∨B m . Exploring Classical Logic for Computation, research has focussed on different calculi, trying to exploit the Curry-Howard isomorphism (correspondence) for various classical logics, both in sequent style and in natural deduction. In this paper we contribute to that line of research by studying Curien and Herbelin's calculus λµμ-calculus [16] , which enjoys a Curry-Howard isomorphism for a variant (with focus, or active formulae à la Parigot's λµ [38, 39] ) of the implicative variant of Kleene's G 3 [33], itself a variant of Gentzen's lk. number of different (perhaps even incompatible, ununifiable) types, and is the universal type, i.e. all terms have type . Although this extension is conceptually simple, it is, in fact, a very powerful characterisation and semantic tool, since all the following properties have been shown to hold for a number of different systems: -If Γ M : A and M = β N, then Γ N : A. -Γ M : A and A = , iff M has a head-normal form. -Γ M : A and does not occur in Γ and A, iff M has a normal form. -Γ M : A and is not used at all in this derivation, iff M is strongly normalising. -Intersection type systems have the principal type property. -[[M ]] = {A | ∃ Γ [ Γ M : A ]} gives a (filter) λ-model. -If Γ M : A and M → η N, then Γ N : A (this property needs a contra-variant ≤-relation, which is not present in all systems). A natural question to ask now is: "Can we achieve the same for λµμ?"; to answer this question, this paper studies the addition of intersection types to the system for λµμ; union types are added for reasons of symmetry. The system we define in this paper is set up to be a conservative extension of Krivine's Système Dω of intersection type assignment for the λ-calculus [34] , in that λ-terms typeable in that system translate to λµμ-terms, while preserving the type. There are many different notions of intersection type assignment in existence (see also [11, 1, 2, 5] ), that, in the context of the λ-calculus more or less coincide; the most important difference is normally the language of types (full BCD [11, 34] , or strict types [1,2]) and the availability of a contra-variant ≤-relation (as in [11, 2] , or not [34,1]). Surprisingly, this is no longer true when bringing intersection types (and union) to the context of sequent calculi; BCD-types are needed, as will be shown in this paper. Perhaps the strongest of the above results is the characterisation of strong normalisation, which states that, in a system without the type constant , the typeable terms are exactly the strongly normalisable ones [40, 1] . This has since then been achieved in many ways for different calculi, and in order to come to a similar characterisation for the (untyped) sequent calculus λµμ, Dougherty, Ghilezan and Lescanne presented System M ∩∪ [18], that defines a notion of intersection and union typing for that calculus. With our eye on the definition of semantics, in this paper we revisit System M ∩∪ , adding as the maximal and ⊥ as the minimal type, and extending the set of derivation rules for the purpose of completeness (the property that types are preserved also going backwards with respect to reduction). The notion of typing (i.e. environment assignment) we present here will be shown to be the natural system, in that intersection, , union, and ⊥ play their expected roles for completeness, our first step towards the construction of a filter model. However, we will show that completeness does not hold directly for M ∩∪ , and that the system needs to be generalised before this property holds. As was already mentioned in [20] , also soundness does not hold for M ∩∪ , and we will argue that this is mainly caused by the non-logical foundation (i.e. typeable terms no longer correspond to proofs) of both intersection and union; this was also observed for intersection type assignment for the λ-calculus by Hindley [31]. This failure was the motivation for the restriction made to come to System M ∩ as presented in [20] ; as we will show in Section 8, this was not 1 Normally called ω; here we reserve Greek characters for context variables. → → β is the reflexive and transitive closure of → β , and = β is the equivalence relation generated by → → β . (iii) Call-by-value reduction is defined by limiting the reduction rule → β to contract only if the right-hand term is a value, i.e. is either a variable or an abstraction. Essentially following [16] , an interpretation | [ · ]| λ of the λ-calculus into λµμ can be defined as follows: Definition 6. Interpretation of the λ-calculus into λµμ via | [ · ]| λ: We can even represent substitution explicitly (so interpret Bloo and Rose's λx [13] ), by adding Notice that λ-values are interpreted by λµμ-values. Correctness of this encoding is easy to prove: 2 In [29], slots are called linear evaluation contexts. Remember that this proof would not be valid in M, since, in case (→E), A might be an intersection type. We will now show that M c is complete. First, we show some of the properties that this system satisfies. As is usual, we can constrict the environment to just those statements that are relevant, and add irrelevant statements to environments. Lemma 48 (Thinning and Weakening). (i) If c : Γ M c ∆ and Γ = {x:B ∈ Γ | x ∈ fv (c)} and ∆ = {α:B ∈ Γ | α ∈ fv (c)}, then also c : Γ M c ∆ . Similar for Γ | e : A M c ∆ and Γ M c v : A | ∆. (ii) If c : Γ M c ∆ and Γ ≤ ∩ Γ as well as ∆ ≤ ∪ ∆ , then also c : Γ M c ∆ . Also similar for Γ | e : A M c ∆ and Γ M c v : A | ∆. Proof. Both properties are shown by induction on the structure of derivations. We start by showing the following expansion lemmas that express that, given a typeable term, context or command, we can extract a subterm (which might occur more than once, i.e. the extraction is expressed via substitution) and type both the result of the extraction and the extracted term/context. First for the extraction of a term: Lemma 49 (Term Expansion Lemma). (i) If c [v/x] : Γ M c ∆ there exists B∈T such that c : Γ , x:B M c ∆ and Γ M c v : B | ∆. (ii) If Γ M c v [v/x] : A | ∆ then there exists B ∈ T such that Γ , x:B M c v : A | ∆ and Γ M c v : B | ∆. (iii) If Γ | e[v/x] : A M c ∆ then there exists B ∈ T such that Γ , x:B | e : A M c ∆ and Γ M c v : B | ∆. Proof. By simultaneous induction; we only show some of the cases.
doi:10.1016/j.apal.2010.04.010 fatcat:ugiqp72vlzcdrogztu6mqaeqhm