Abstract
Dunfield showed that a simply typed core calculus with intersection types and a merge operator is able to capture various programming language features. While his calculus is type-safe, it is not coherent: different derivations for the same expression can elaborate to expressions that evaluate to different values. The lack of coherence is an important disadvantage for adoption of his core calculus in implementations of programming languages, as the semantics of the programming language becomes implementation-dependent.
This paper presents λ_i: a coherent and type-safe calculus with a form of intersection types and a merge operator. Coherence is achieved by ensuring that intersection types are disjoint and programs are sufficiently annotated to avoid type ambiguity. We propose a definition of disjointness where two types A and B are disjoint only if certain set of types are common supertypes of A and B. We investigate three different variants of λ_i, with three variants of disjointness. In the simplest variant, which does not allow ⊤ types, two types are disjoint if they do not share any common supertypes at all. The other two variants introduce ⊤ types and refine the notion of disjointness to allow two types to be disjoint when the only the set of common supertypes are top-like. The difference between the two variants with ⊤ types is on the definition of top-like types, which has an impact on which types are allowed on intersections. We present a type system that prevents intersection types that are not disjoint, as well as an algorithmic specifications to determine whether two types are disjoint for all three variants.
- N. Amin, A. Moors, and M. Odersky. Dependent object types. In 19th International Workshop on Foundations of Object-Oriented Languages, 2012.Google Scholar
- N. Amin, T. Rompf, and M. Odersky. Foundations of path-dependent types. In Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & Applications, 2014. Google Scholar
Digital Library
- B. E. Aydemir, A. Charguéraud, B. C. Pierce, R. Pollack, and S. Weirich. Engineering formal metatheory. In G. C. Necula and P. Wadler, editors, Proceeding of the 35th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), pages 3–15. ACM, 2008. Google Scholar
Digital Library
- V. Benzaken, G. Castagna, and A. Frisch. CDuce: An XML-centric general-purpose language. In Proceedings of the Eighth ACM SIGPLAN International Conference on Functional Programming, ICFP ’03, 2003. Google Scholar
Digital Library
- L. Cardelli. A semantics of multiple inheritance. Information and Computation, 76:138–164, 1988. Google Scholar
Digital Library
- G. Castagna, G. Ghelli, and G. Longo. A calculus for overloaded functions with subtyping. In Proceedings of the 1992 ACM Conference on LISP and Functional Programming, LFP ’92, 1992. Google Scholar
Digital Library
- G. Castagna, K. Nguyen, Z. Xu, H. Im, S. Lenglet, and L. Padovani. Polymorphic functions with set-theoretic types: Part 1: Syntax, semantics, and evaluation. In Proceedings of the 41st ACM SIGPLANSIGACT Symposium on Principles of Programming Languages, POPL ’14, 2014. Google Scholar
Digital Library
- A. B. Compagnoni and B. C. Pierce. Higher-order intersection types and multiple inheritance. Mathematical Structures in Computer Science, 1996.Google Scholar
Cross Ref
- M. Coppo, M. Dezani-Ciancaglini, and B. Venneri. Functional characters of solvable terms. Mathematical Logic Quarterly, 27(2–6):45–58, 1981.Google Scholar
Cross Ref
- P.-L. Curienl and G. Ghelli. Coherence of subsumption. In CAAP’90: 15th Colloquium on Trees in Algebra and Programming, Copenhagen, Denmark, May 15-18, 1990, Proceedings, volume 431, page 132. Springer Science & Business Media, 1990. Google Scholar
Digital Library
- R. Davies. Practical refinement-type checking. PhD thesis, Carnegie Mellon University, 2005. Google Scholar
Digital Library
- R. Davies and F. Pfenning. Intersection types and computational effects. In Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming (ICFP’00), 2000. Google Scholar
Digital Library
- J. Dunfield. Refined typechecking with Stardust. In A. Stump and H. Xi, editors, Programming Languages meets Program Verification (PLPV ’07), Freiburg, Germany, Oct. 2007. Google Scholar
Digital Library
- J. Dunfield. Elaborating intersection and union types. Journal of Functional Programming, 2014.Google Scholar
Cross Ref
- J. Dunfield and F. Pfenning. Type assignment for intersections and unions in call-by-value languages. In A. Gordon, editor, Foundations of Software Science and Computation Structures (FOSSACS ’03), pages 250–266, Warsaw, Poland, Apr. 2003. Springer-Verlag LNCS 2620. Google Scholar
Digital Library
- J. Dunfield and F. Pfenning. Tridirectional typechecking. In Proceedings of the 31st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’04, 2004. Google Scholar
Digital Library
- T. Freeman and F. Pfenning. Refinement types for ML. In Proceedings of the SIGPLAN ’91 Symposium on Language Design and Implementation, Toronto, Ontario, June 1991. ACM Press. Google Scholar
Digital Library
- M. P. Jones. Coherence for Qualified Types. Technical Report YALEU/DCS/RR-989, Yale University, 1993.Google Scholar
- M. P. Jones. Qualified Types: Theory and Practice. Cambridge University Press, Cambridge, England, 1994. Google Scholar
Digital Library
- M. Odersky et al. An overview of the Scala programming language. Technical Report IC/2004/64, EPFL Lausanne, Switzerland, 2004.Google Scholar
- F. Pfenning and C. Schürmann. System description: Twelf — A metalogical framework for deductive systems. In H. Ganzinger, editor, Proceedings of the International Conference on Automated Deduction, pages 202–206, 1999. Google Scholar
Digital Library
- B. C. Pierce. Programming with intersection types, union types, and polymorphism. Technical Report CMU-CS-91-106, Carnegie Mellon University, 1991.Google Scholar
- B. C. Pierce. Programming with Intersection Types and Bounded Polymorphism. PhD thesis, Carnegie Mellon University, December 1991. Google Scholar
Digital Library
- B. C. Pierce. Intersection types and bounded polymorphism. Mathematical Structures in Computer Science, 1997. Google Scholar
Digital Library
- B. C. Pierce and D. N. Turner. Local type inference. ACM Trans. Program. Lang. Syst., 22(1), Jan. 2000. Google Scholar
Digital Library
- G. Pottinger. A type assignment for the strongly normalizable λ-terms. In To H. B. Curry: essays on combinatory logic, lambda calculus and formalism, pages 561–577. Academic Press, London, 1980.Google Scholar
- J. C. Reynolds. The coherence of languages with intersection types. In Proceedings of the International Conference on Theoretical Aspects of Computer Software, TACS ’91, 1991. Google Scholar
Digital Library
- J. C. Reynolds. Design of the Programming Language Forsythe, pages 173–233. Birkhäuser Boston, Boston, MA, 1997. Google Scholar
Digital Library
- J. C. Reynolds. Separation logic: A logic for shared mutable data structures. In Logic in Computer Science, 2002. Proceedings. 17th Annual IEEE Symposium on, pages 55–74. IEEE, 2002. Google Scholar
Digital Library
- S. van Bakel. Complete restrictions of the intersection type discipline. Theoretical Comput. Sci., 99, 1992. Google Scholar
Digital Library
- P. Wadler and S. Blott. How to make ad-hoc polymorphism less ad hoc. In Proceedings of the 16th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’89, 1989. Google Scholar
Digital Library
Index Terms
Disjoint intersection types
Recommendations
Disjoint intersection types
ICFP 2016: Proceedings of the 21st ACM SIGPLAN International Conference on Functional ProgrammingDunfield showed that a simply typed core calculus with intersection types and a merge operator is able to capture various programming language features. While his calculus is type-safe, it is not coherent: different derivations for the same expression ...
Gradual typing with union and intersection types
We propose a type system for functional languages with gradual types and set-theoretic type connectives and prove its soundness. In particular, we show how to lift the definition of the domain and result type of an application from non-gradual types to ...
Intersection type calculi of bounded dimension
POPL '17A notion of dimension in intersection typed λ-calculi is presented. The dimension of a typed λ-term is given by the minimal norm of an elaboration (a proof theoretic decoration) necessary for typing the term at its type, and, intuitively, measures ...







Comments