skip to main content
article

Disjoint intersection types

Published:04 September 2016Publication History
Skip Abstract Section

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.

References

  1. N. Amin, A. Moors, and M. Odersky. Dependent object types. In 19th International Workshop on Foundations of Object-Oriented Languages, 2012.Google ScholarGoogle Scholar
  2. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  5. L. Cardelli. A semantics of multiple inheritance. Information and Computation, 76:138–164, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  7. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  8. A. B. Compagnoni and B. C. Pierce. Higher-order intersection types and multiple inheritance. Mathematical Structures in Computer Science, 1996.Google ScholarGoogle ScholarCross RefCross Ref
  9. M. Coppo, M. Dezani-Ciancaglini, and B. Venneri. Functional characters of solvable terms. Mathematical Logic Quarterly, 27(2–6):45–58, 1981.Google ScholarGoogle ScholarCross RefCross Ref
  10. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  11. R. Davies. Practical refinement-type checking. PhD thesis, Carnegie Mellon University, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  13. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  14. J. Dunfield. Elaborating intersection and union types. Journal of Functional Programming, 2014.Google ScholarGoogle ScholarCross RefCross Ref
  15. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  16. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  17. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  18. M. P. Jones. Coherence for Qualified Types. Technical Report YALEU/DCS/RR-989, Yale University, 1993.Google ScholarGoogle Scholar
  19. M. P. Jones. Qualified Types: Theory and Practice. Cambridge University Press, Cambridge, England, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. M. Odersky et al. An overview of the Scala programming language. Technical Report IC/2004/64, EPFL Lausanne, Switzerland, 2004.Google ScholarGoogle Scholar
  21. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  22. B. C. Pierce. Programming with intersection types, union types, and polymorphism. Technical Report CMU-CS-91-106, Carnegie Mellon University, 1991.Google ScholarGoogle Scholar
  23. B. C. Pierce. Programming with Intersection Types and Bounded Polymorphism. PhD thesis, Carnegie Mellon University, December 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. B. C. Pierce. Intersection types and bounded polymorphism. Mathematical Structures in Computer Science, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. B. C. Pierce and D. N. Turner. Local type inference. ACM Trans. Program. Lang. Syst., 22(1), Jan. 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. 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 ScholarGoogle Scholar
  27. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  28. J. C. Reynolds. Design of the Programming Language Forsythe, pages 173–233. Birkhäuser Boston, Boston, MA, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  30. S. van Bakel. Complete restrictions of the intersection type discipline. Theoretical Comput. Sci., 99, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. 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 ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Disjoint intersection types

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        • Published in

          cover image ACM SIGPLAN Notices
          ACM SIGPLAN Notices  Volume 51, Issue 9
          ICFP '16
          September 2016
          501 pages
          ISSN:0362-1340
          EISSN:1558-1160
          DOI:10.1145/3022670
          Issue’s Table of Contents
          • cover image ACM Conferences
            ICFP 2016: Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming
            September 2016
            501 pages
            ISBN:9781450342193
            DOI:10.1145/2951913

          Copyright © 2016 ACM

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 4 September 2016

          Check for updates

          Qualifiers

          • article

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!