The Duality of Classical Intersection and Union Types

For a long time, intersection types have been admired for their surprising ability to complete the simply typed lambda calculus. Intersection types are an example of an implicit typing feature which can describe program behavior without manifesting itself within the syntax of a program. Dual to intersections, union types are another implicit typing feature which extends the completeness property of intersection types in the lambda calculus to full-fledged programming languages. However, the formalization of union types can easily break other desirable metatheoretical properties of the type system. But why should unions be troublesome when their dual, intersections, are not? We look at the issues surrounding the design of type systems for both intersection and union types through the lens of duality by formalizing them within the symmetric language of the classical sequent calculus. In order to formulate type systems which have all of our properties of interest— soundness, completeness, and type safety—we also look at the impact of evaluation strategy on typing. As a result, we present two dual type systems—one for call-by-value and one for call-byname evaluation—which have all three properties. We also consider the possibility of classical ∗This work is supported by the National Science Foundation under grants CCF-1423617 and CCF-1719158. †Courtesy Research Associate in the Global Studies Institute, University of Oregon. This work has been partly supported by MESTD under the grants ON174026 and III44006. 1002 P. Downen, Z.M. Ariola, S. Ghilezan / The Duality of Classical Intersection and Union Types non-deterministic evaluation, for which there is a choice between two different systems depending on which properties are desired: a full type system which is complete, and a simplified type system which is sound and type safe.

[1]  Antonio Bucciarelli,et al.  Inhabitation for Non-idempotent Intersection Types , 2017, Log. Methods Comput. Sci..

[2]  Alonzo Church,et al.  A formulation of the simple theory of types , 1940, Journal of Symbolic Logic.

[3]  Pawel Urzyczyn,et al.  The emptiness problem for intersection types , 1994, Proceedings Ninth Annual IEEE Symposium on Logic in Computer Science.

[4]  Pawel Urzyczyn,et al.  Type reconstruction in Fω , 1997, Mathematical Structures in Computer Science.

[5]  Takafumi Sakurai,et al.  A Translation of Intersection and Union Types for the λμ-Calculus , 2014, APLAS.

[6]  Paul Downen Sequent Calculus: A Logic and a Language for Computation and Duality , 2017 .

[7]  J. Roger Hindley,et al.  Lambda calculus with types (Perspectives in Logic) , 2014 .

[8]  K. Nakazawa,et al.  Intersection and Union Type Assignment and Polarised λ̄ μ μ̃ , 2015 .

[9]  Patrick Sale Une Extension de la Theorie des Types en lambda-Calcul , 1978, ICALP.

[10]  Frank Pfenning,et al.  Type Assignment for Intersections and Unions in Call-by-Value Languages , 2003, FoSSaCS.

[11]  Stéphane Lengrand,et al.  Non-idempotent intersection types and strong normalisation , 2013, Log. Methods Comput. Sci..

[12]  Alberto Carraro,et al.  A Semantical and Operational Account of Call-by-Value Solvability , 2014, FoSSaCS.

[13]  Jean-Yves Girard,et al.  A new constructive logic: classic logic , 1991, Mathematical Structures in Computer Science.

[14]  Steffen van Bakel,et al.  Intersection Types for the lambda-mu Calculus , 2017, Log. Methods Comput. Sci..

[15]  Hugo Herbelin,et al.  An Operational Account of Call-By-Value Minimal and Classical λ-calculus in “ Natural Deduction ” Form ( revision fixing a few errors – January 2010 ) , 2009 .

[16]  Mariangiola Dezani-Ciancaglini,et al.  The "Relevance" of Intersection and Union Types , 1997, Notre Dame J. Formal Log..

[17]  Luigi Liquori,et al.  The Delta-framework , 2018, FSTTCS.

[18]  G. Pottinger,et al.  A type assignment for the strongly normalizable |?-terms , 1980 .

[19]  Mariangiola Dezani-Ciancaglini,et al.  A new type assignment for λ-terms , 1978, Arch. Math. Log..

[20]  John C. Reynolds,et al.  Design of the programming language FORSYTHE , 1997 .

[21]  Joshua Dunfield Elaborating intersection and union types , 2014, J. Funct. Program..

[22]  Mariangiola Dezani-Ciancaglini,et al.  Intersection and Union Types: Syntax and Semantics , 1995, Inf. Comput..

[23]  JEAN-MARC ANDREOLI,et al.  Logic Programming with Focusing Proofs in Linear Logic , 1992, J. Log. Comput..

[24]  Daniel J. Dougherty,et al.  Characterizing strong normalization in the Curien-Herbelin symmetric lambda calculus: Extending the Coppo-Dezani heritage , 2008, Theor. Comput. Sci..

[25]  Ugo de'Liguoro The approximation theorem for the Λμ-calculus , 2017, Math. Struct. Comput. Sci..

[26]  Michel Parigot,et al.  Strong normalization for second order classical natural deduction , 1993, [1993] Proceedings Eighth Annual IEEE Symposium on Logic in Computer Science.

[27]  Zena M. Ariola,et al.  The Duality of Construction , 2014, ESOP.

[28]  Delia Kesner,et al.  Types as Resources for Classical Natural Deduction , 2017, FSCD.

[29]  Matthias Felleisen,et al.  A Syntactic Approach to Type Soundness , 1994, Inf. Comput..

[30]  Gordon D. Plotkin,et al.  An ideal model for recursive polymorphic types , 1984, Inf. Control..

[31]  B. Pierce Programming with intersection types, union types, and polymorphism , 1991 .

[32]  Robin Milner,et al.  A Theory of Type Polymorphism in Programming , 1978, J. Comput. Syst. Sci..

[33]  Paola Giannini,et al.  Characterization of typings in polymorphic type discipline , 1988, [1988] Proceedings. Third Annual Information Symposium on Logic in Computer Science.

[34]  Zena M. Ariola,et al.  Uniform Strong Normalization for Multi-discipline Calculi , 2018, WRLA@ETAPS.

[35]  J. Roger Hindley Coppo-Dezani Types do not Correspond to Propositional Logic , 1984, Theor. Comput. Sci..

[36]  M. Felleisen,et al.  Reasoning about programs in continuation-passing style , 1993 .

[37]  Hugo Herbelin,et al.  The duality of computation , 2000, ICFP '00.

[38]  Zena M. Ariola,et al.  A tutorial on computational classical logic and the sequent calculus , 2018, Journal of Functional Programming.

[39]  Olivier Laurent,et al.  Étude de la polarisation en logique , 2001 .

[40]  Mads Tofte,et al.  Type Inference for Polymorphic References , 1990, Inf. Comput..

[41]  Grigori Mints,et al.  The Completeness of Provable Realizability , 1989, Notre Dame J. Formal Log..

[42]  Benjamin C. Pierce,et al.  Intersection types and bounded polymorphism , 1993, Mathematical Structures in Computer Science.

[43]  Hendrik Pieter Barendregt,et al.  Introduction to generalized type systems , 1991, Journal of Functional Programming.

[44]  Daniel J. Dougherty,et al.  Characterizing strong normalization in a language with control operators , 2004, PPDP '04.

[45]  Philip Wadler,et al.  Call-by-value is dual to call-by-name , 2003, ACM SIGPLAN International Conference on Functional Programming.

[46]  Steffen van Bakel Completeness and partial soundness results for intersection and union typing for lambda_µµ_ , 2010, Ann. Pure Appl. Log..

[47]  Stefano Berardi,et al.  A Symmetric Lambda Calculus for Classical Program Extraction , 1994, Inf. Comput..

[48]  Mariangiola Dezani-Ciancaglini,et al.  A filter lambda model and the completeness of type assignment , 1983, Journal of Symbolic Logic.