Intersection Types and Denotational Semantics: An Extended Abstract (Invited Paper)

LIPICS - Leibniz International Proceedings in Informatics, Oct 2018

This is a short survey of the use of intersection types for reasoning in a finitary way about terms interpretations in various models of lambda-calculus.

A PDF file should load here. If you do not see its contents the file may be temporarily unavailable at the journal website or you do not have a PDF plug-in installed and enabled in your browser.

Alternatively, you can download the file locally and open with any standalone PDF reader:

http://drops.dagstuhl.de/opus/volltexte/2018/9861/pdf/LIPIcs-TYPES-2016-2.pdf

Intersection Types and Denotational Semantics: An Extended Abstract (Invited Paper)

T Y P E S Intersection Types and Denotational Semantics: An Extended Abstract Simona Ronchi Della Rocca 0 Category Invited Paper 0 0 Universita? degli Studi di Torino , dept Computer Science, Torino , Italy This is a short survey of the use of intersection types for reasoning in a finitary way about terms interpretations in various models of lambda-calculus. 2012 ACM Subject Classification Theory of computation ? Denotational semantics Intersection types have been introduced by Coppo and Dezani [6], with the aim of enforcing the typability power of simple types, but they quite immediately turned out to be a very powerful tool to reason about the semantics properties of programming languages. In the general framework of denotational semantics of ?-calculus, intersection types supply a logical description of various kind of ?-models. In particular they allow for a finitary description of the interpretation of terms, through type assignment systems, assigning types to terms starting from a context (finite assignment of types to free variables). Terms are interpreted by sets either of types or of pairs of the shape (context, type), so reasoning about the interpretation of a term can be done via type inference; in fact, in order to prove the equivalence between two terms, it is sufficient to show that they share the same type derivations. Although the type inference is usually undecidable, such a logical description of models supplies concrete tools to reason in a finitary way about the interpretation of terms, since a derivation grasps a finite piece of the semantic-interpretations. The aim of this brief survey is to illustrate how this technique can be applied to three different classes of models, in the general settings of continuous, stable and relational semantics. I recall that a ?-model is a reflexive object in a cartesian closed category, i.e., a space D such that the set of morphisms from D to D is a retract of D (in a more concise way D . [D ? D]) [2]. and phrases Lambda-calculus; Lambda-models; Intersection types Introduction The first local description of a continuous ?-model through intersection types is in [3]. Then various instances of continuous models have been studied (see, between others, [7, 8, 13, 1]). A general correspondence between intersection types and continuous ?-models has been described in [18]. where a ? C, and ? is a finite set of types. Let ? be any pre-order on TC, extended to sets in the following way: and closed under: ? ? ? ? ? ? ? ? ? ?, A ? B ? ? ? {A} ? ? ? {B} ?0 ? ?, A ? B ? ? ? A ? ?0 ? B Let '? be the congruence induced by ?, and ?? the partial order on TC/ '?. I Remark. In order to describe different approaches in a uniform manner, I do not use explicit the intersection connective. A set of types {A1, ..., An} corresponds to the more standard notation A1 ? ... ? An, where the intersection connective ? is considered modulo idempotency, associativity and commutativity. The continuous type assignment system, parametric with respect to C, ?, assigning to ?-terms types in TC is defined in Figure 1, where ?, ? (contexts) are functions from variables to finite subsets of TC , such that ?(x) 6= ? for a finite number of variables. Every type assignment system of this kind can be seen as a finitary description of the interpretation of terms in a continuous ?-model DC,?. In fact, for every set of types TC and every partial order ??, the set of subsets of TC/ '? equipped with the partial order defined as: (? vC,? ? if and only if ? ?? ?) is a prime-algebraic lattice DC,?, whose prime elements are the singleton over TC/ '?. Moreover, types are notations for step functions, interpreting ? ? A as a step function approximating f , for every continuous function f such that A ? f (? ), for each ? wC,? ?. Under this interpretation DC,? is a linear solution of the domain equation D . [D ?c D], where [. ?c .] denotes the space of continuous functions ordered pointwise, and the linearity of the solution means that both the immersion-projection functions map prime elements into prime elements. Let us call linear continuous models the models of this class. So DC,? gives rise to a linear continuous ?-model DC,?. On the other direction, every linear continuous model can be described through a set of types equipped by a suitable intersection relation. Let J.KDC,? be the interpretation function in DC,?, defined as usual: the following theorem holds. I Theorem 2. ? `C,? M : A if and only if A ? JMK?DC,? , for all ? such that ?(x) ? ?(x). So the interpretation of a term in MC,? is simply the set of types that can be assigned to it. I Remark. If we define a filter to be a set of types closed under ??, it turns out that the set of types derivable for a given term is a filter. This justifies the fact that models of this kind have been called ?filter models? in the literature. I Example 3. 1. The filter model in [3] (where C is an infinite set of type constants and ? is the preorder induced by the empty set of rules) supplies a solution of the domain equation D = C ? [D ? D], through a coding where the type constant a codes the prime element (a, ?), the type ? ? A codes the prime element (?, ? ? A), and the equation is solved by the bijection (?, ? ? A) 7? ? ? A. 2. The D? model of Scott [19] is described by C = {a} and ? is induced by the rules {a ? ? ? a, ? ? a ? a} ([18]). 3. The Park model [17] is described by C = {a}, and ? is induced by the rules {a ? {a} ? a, {a} ? a ? a} ([13]). 3 Stable semantics The stable semantics is based on the notion of stable functions, introduced by Berry [4]. Here I will consider a particular class of models based on stable functions, namely the coherence spaces of Girard [11, 10]. A general correspondence between intersection types and stable ?-model has been described in [15], based on a previous work studying the correspondence between intersection types and qualitative models [12]. I Definition 4. Let C be a countable set of constants. Types and coherence type theory are mutually defined as follows. Types (TC,?) are defined as: A, B ::= a | ? ? A where a ? C, and ? is a finite set of types, such that A, B ? ?, A 6'4 B. A coherence type theory ? is a pair ( ?, '?), where ? is a symmetric and antireflexive relation on TC,?, closed under ? (?). i.e., A ? B, for all ? ? A ? ? ? B ? either A ? B or ?A0 ? ?, ?B0 ? ? such that A0 ? B0 (where A0 ? B0 means A0 6 ? B0 and A0 6'? B0). '? is an equivalence on types, extended to sets to sets in such a way that: ? '? ? ? their elements are pairwise '? . The stable parametric type assignment system, parametric with respect to C, ? is defined in Figure 2, where ?, ? (contexts) are functions from variables to finite sets of types, such that ?(x) = ? implies ? (?) and such that ?(x) 6= ? for a finite number of variables. Moreover F?(?1, ..., ?n) means (x : ? ? ?i and x : ? ? ?j imply either ? (?, ? ) or ? '4 ? ). Every type assignment system of this kind can be seen as a finitary description of the interpretation of terms in a stable linear ?-model. In fact, for every choice of C and ?, SC,? = (TC/ '?, ), where (coherence) is the set theoretic union of ? and '?, is a coherence space. Moreover, types supply a notation for finite pieces of stable functions, interpreting ? ? A as an element of the trace of every stable function f , such that A ? f (?) and ?? ? ?, A ? f (? ) if and only if ? '? ?. Under this interpretation SC,? is a linear solution of the domain equation D . [D ?s D], where [. ?s .] denotes the space of stable functions ordered pointwise. Let define linear stable models the models of this class. So SC,? gives rise to a ?-model, let SC,?. On the other direction, every linear stable model can be described through a set of types equipped by a suitable type theory. Let J.KSC,? be the interpretation function in SC,?, defined in the usual way; the following theorem holds. I Theorem 5. ? `C,? M : A if and only if A ? JMK?SC,? , for all ? such that ?(x) ? ?(x). So the interpretation of a term in SC,? is simply the set of types that can be assigned to it. I Example 6. 1. Let C be a countable infinite set, ? = ( , '), where is the minimum relation induced by the rules: a A, ?a ? C, A ? TC,? and ' is the minimum congruence on types, satisfying the conditions of Def.4. Then (TC,?, ) supplies a solution of the equation S = C & [S ?s S], choosing the type a to describe the token (1, a), and ? ? A to describe the token (2, ? ? A). The solution is induced by the bijection (2, ? ? A) 7? ? ? A. 2. Let C = {a}, let be the minimum relation and let ' be the minimum congruence induced by {a ' ? ? a}. Then the resulting ?-model is (in some sense) the stable corresponding to D?, built in [12]. 3. Let C = {a}, let be as in the previous point, and let ' be the minimum congruence induced by {a ' {a} ? a}. Then the resulting ?-model is (in some sense) the stable corresponding to the Park model, built in [12]. 4 Relational semantics The relational semantics has been developed by Bucciarelli, Manzonetto and Ehrhard ([5]). A general correspondence between intersection types and relational ?-model has been described in [16]. A '? B ? `C,? M : B '? A, B ::= a | ? ? A where ? is a finite multiset of types. A relational type theory '? is a congruence on types, behaving on multisets in the following way: ? '? ? ? ? = [A1, ..., An], ? = [B1, ..., Bn] and Ai '? Bi and closed under: ? ? A '? ?0 ? B ? ? '? ?0, A ' B I Remark. The multisets of types [A1, ..., An] is an alternative notation for A1 ? ... ? An, where the intersection connective enjoys associativity and commutativity, but not idempotence; so the congruence on multisets needs to take into account the multiplicity of elements. Let [ ] denote the empty multiset. The relational parametric type assignment system, parametric with respect to C, ? is defined in Figure 3, where ?, ? (contexts) are functions from variables to finite multisets of types, such that ?(x) 6= [ ] for a finite number of variables. Moreover ] denotes the multiset union. An arrow type denotes a relation from Mfin(TC/ '?) and TC/ '?, where Mfin(.) is the set of finite multisets. It turns out that TC/ '? supplies a solution of the equation U . [U ?r U], where U is a set and [. ?r .] denotes the space of relations between Mfin(U) and U. But this space does not supply directly a ?-model, as shown in [9], since it has not enough points. It is necessary to consider the space F in(UV ar, U), which consists of the finitary morphisms from UV ar to U, where V ar is a countable set of variables, and gives rise to a ?-model. An element of such a space can be represented by a pre-typing, which is a pair (?; A) of a context and a type, both considered modulo '?: in fact pre-typings are elements of a space RC,? = F in((TC/ '?)V ar, TC/ '?) which supplies a ?-model RC,?; let J.KRC,? be its interpretation function, defined in the usual way. The following theorem holds. I Theorem 8. ? `C,? M : A if and only if (?0; A) ? JMK?RC,? , where ?0 = ]i?i, (?i; Ai) ? ?(xi), for every Ai ? ?(xi). I Example 9. Choosing C = {a} and the type theory induced by [ ] ? a ' a, we obtain the model studied in [5]. Choosing C = {a} and the type theory induced by [a] ? a ' a, we obtain the model studied in [14]. 5 Conclusion Comparing the three parametric type assignment systems in Figure 1, 2 and 3, it turns out that the three systems are quite different, from a proof theoretical point of view. The continuous system uses idempotent intersection, it enjoys weakening, and requires a subsumption rule. The stable system uses idempotent intersection too, but it is relevant (in the sense that weakening is unsound) and requires an equivalence rule. Finally, the relational system uses non-idempotent intersection, is relevant, and requires an equivalence rule. Moreover the interpretation of a term is the set of types derivable for it in the first two systems, while is the set of pre-typings in the third one. Despite these differences, they supply a logical tools for reasoning in a uniform way about the denotational semantics of terms, in particular for comparing terms from a semantics point of view. In fact, the following theorem holds. I Theorem 10. Let MC,? be a (continous, stable, relational) ?-model, and let vMC,? be the order relation between interpretations of terms in it. Then: (??, A. ? `C,? M : A implies ? `C,? N : A) if and only if M vMC,? N. 1 2 3 4 5 6 7 8 9 10 11 Fabio Alessi , Mariangiola Dezani-Ciancaglini, and Furio Honsell . A complete characterization of complete intersection-type preorders . ACM Transactions on Computational Logic , 4 ( 1 ): 120 - 147 , jan 2003 . Henk Barendregt . The Lambda Calculus: Its Syntax and Semantics , volume 103 of Studies in logic and the foundation of mathematics . North-Holland, revised edition , 1984 . Henk Barendregt , Mario Coppo, and Mariangiola Dezani-Ciancaglini. A filter lambda model and the completeness of type assignment . The Journal of Symbolic Logic , 48 ( 4 ): 931 - 940 , dec 1983 . G?rard Berry . Stable models of typed ?-calculi . In Giorgio Ausiello and Corrado B?hm , editors, Fifth International Colloquium on Automata, Languages and Programming - - ICALP'78 , Udine , Italy, July 17-21 , 1978 , volume 62 of Lecture Notes in Computer Science, pages 72 - 89 . Springer-Verlag, 1978 . In CSL ' 07 , volume 4646 of Lecture Notes in Computer Science, pages 298 - 312 . Springer, 2007 . Mario Coppo and Mariangiola Dezani-Ciancaglini . An extension of the basic functionality theory for the ?-calculus . Notre Dame Journal of Formal Logic , 21 ( 4 ): 685 - 693 , oct 1980 . Mario Coppo , Mariangiola Dezani-Ciancaglini, Furio Honsell , and Giuseppe Longo . Extended type structure and filter lambda models . In Logic Colloquim'82 , pages 241 - 262 , 1984 . Mario Coppo , Mariangiola Dezani-Ciancaglini, and Maddalena Zacchi . Type theories, normal forms , and D? - lambda-models. Information and Computation , 72 ( 2 ): 85 - 116 , 1987 . Daniel de Carvalho . Execution time of lambda-terms via denotational semantics and intersection types . CoRR, abs/0905.4251 , 2009 . Available also as INRIA report RR 6638 . URL: http://arxiv.org/abs/0905.4251. Jean-Yves Girard . Linear logic . Theoretical Computer Science , 50 : 1 - 102 , 1987 . Jean-Yves Girard , Yves Lafont, and Paul Taylor . Proofs and Types. Cambridge Tracts in Theoretical Computer Science. Cambridge University Press, Cambridge, 1989 . Furio Honsell and Simona Ronchi della Rocca. Reasoning about interpretation in qualitative lambda-models . In IFIP 2.2 , pages 505 - 521 , 1990 . Furio Honsell and Simona Ronchi Della Rocca . An approximation theorem for topological lambda models and the topological incompleteness of lambda calculus . Journal of Computer and System Sciences , 45 ( 1 ): 49 - 75 , aug 1992 . Giulio Manzonetto and Domenico Ruoppolo . Relational graph models, Taylor expansion and extensionality . Electronic Notes in Theoretical Computer Science , 308 : 245 - 272 , 2014 . Luca Paolini , Mauro Piccolo, and Simona Ronchi Della Rocca. Logical semantics for stability . In MFPS'09 , volume 249 of Electronic Notes in Theoretical Computer Science, pages 429 - 449 , 2009 . Luca Paolini , Mauro Piccolo, and Simona Ronchi Della Rocca. Essential and relational models . Mathematical Structures in Computer Science , FirstView: 1 - 25 , 9 2015 . doi:10. 1017/S0960129515000316. D. M. R. Park . The Y-combinator in scott's lambda-calculus models . Research Report CS-RR-013 , Department of Computer Science, University of Warwick, Coventry, UK, jun 1976 . URL: http://www.dcs.warwick.ac.uk/pub/reports/rr/013.html. Simona Ronchi Della Rocca and Luca Paolini . The Parametric ?-Calculus: a Metamodel for Computation . Texts in Theoretical Computer Science: An EATCS Series . Springer-Verlag, 2004 . Dana S. Scott . Data types as lattices . SIAM Journal of Computing , 5 : 522 - 587 , sep 1976 .


This is a preview of a remote PDF: http://drops.dagstuhl.de/opus/volltexte/2018/9861/pdf/LIPIcs-TYPES-2016-2.pdf

Simona Ronchi Della Rocca. Intersection Types and Denotational Semantics: An Extended Abstract (Invited Paper), LIPICS - Leibniz International Proceedings in Informatics, 2018, 2:1-2:7, DOI: 10.4230/LIPIcs.TYPES.2016.2