Skip to main content

Applicative Intersection Types

  • Conference paper
  • First Online:
Programming Languages and Systems (APLAS 2022)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 13658))

Included in the following conference series:

  • 200 Accesses

Abstract

Calculi with intersection types have been used over the years to model various features, including: overloading, extensible records and, more recently, nested composition and return type overloading. Nevertheless no previous calculus supports all those features at once. In this paper we study expressive calculi with intersection types and a merge operator. Our first calculus supports an unrestricted merge operator, which is able to support all the features, and is proven to be type sound. However, the semantics is non-deterministic. In the second calculus we employ a previously proposed disjointness restriction, to make the semantics deterministic. Some forms of overloading are forbidden, but all other features are supported. The main challenge in the design is related to the semantics of applications and record projections. We propose an applicative subtyping relation that enables the inference of result types for applications and projections. Correspondingly, there is an applicative dispatching relation that is used for the dynamic semantics. The two calculi and their proofs are formalized in the Coq theorem prover.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 54.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 69.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Applicative Intersection Types (Artifact). Zenodo, August 2022. https://doi.org/10.5281/zenodo.7004695

  2. Alpuim, J., Oliveira, B.C.d.S., Shi, Z.: Disjoint polymorphism. In: European Symposium on Programming. pp. 1–28. Springer (2017)

    Chapter  Google Scholar 

  3. Barendregt, H., Coppo, M., Dezani-Ciancaglini, M.: A filter lambda model and the completeness of type assignment1. The journal of symbolic logic 48(4), 931–940 (1983)

    Article  MathSciNet  MATH  Google Scholar 

  4. Bi, X., Oliveira, B.C.D.S., Schrijvers, T.: The essence of nested composition. In: 32nd European Conference on Object-Oriented Programming (ECOOP 2018). Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik (2018)

    Google Scholar 

  5. Bobrow, D.G., DeMichiel, L.G., Gabriel, R.P., Keene, S.E., Kiczales, G., Moon, D.A.: Common lisp object system specification. ACM SIGPLAN Not. 23(SI), 1–142 (1988)

    Google Scholar 

  6. Castagna, G., Ghelli, G., Longo, G.: A calculus for overloaded functions with subtyping. Information and Computation 117(1), 115–135 (1995)

    Article  MathSciNet  MATH  Google Scholar 

  7. Coppo, M., Dezani-Ciancaglini, M., Venneri, B.: Functional characters of solvable terms. Mathematical Logic Quarterly 27(2–6), 45–58 (1981)

    Article  MathSciNet  MATH  Google Scholar 

  8. Davies, R., Pfenning, F.: Intersection types and computational effects. In: Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming, pp. 198–208 (2000)

    Google Scholar 

  9. Dunfield, J.: Elaborating intersection and union types. Journal of Functional Programming 24(2–3), 133–165 (2014)

    Article  MathSciNet  MATH  Google Scholar 

  10. Dunfield, J., Krishnaswami, N.: Bidirectional typing. ACM Computing Surveys (CSUR) 54(5), 1–38 (2021)

    Article  Google Scholar 

  11. Ernst, E.: Family polymorphism. In: European Conference on Object-Oriented Programming. pp. 303–326. Springer (2001)

    Chapter  Google Scholar 

  12. Fan, A., Huang, X., Xu, H., Sun, Y., Oliveira, B.C.D.S.: Direct foundations for compositional programming. In: 36th European Conference on Object-Oriented Programming, ECOOP 2022, 6–10 June 2022, Berlin, Germany. LIPIcs, vol. 222, pp. 18:1–18:28. Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2022)

    Google Scholar 

  13. Frisch, A., Castagna, G., Benzaken, V.: Semantic subtyping: Dealing set-theoretically with function, union, intersection, and negation types. Journal of the ACM (JACM) 55(4), 1–64 (2008)

    Article  MathSciNet  MATH  Google Scholar 

  14. Huang, X., Zhao, J., Oliveira, B.C.: Taming the merge operator. J. Funct. Programm. 31 (2021)

    Google Scholar 

  15. Kaes, S.: Parametric overloading in polymorphic programming languages. In: European Symposium on Programming. pp. 131–144. Springer (1988)

    Chapter  Google Scholar 

  16. Marntirosian, K., Schrijvers, T., Oliveira, B.C.D.S., Karachalias, G.: Resolution as intersection subtyping via modus ponens. Proc. ACM Program. Lang. 4(OOPSLA) (2020)

    Google Scholar 

  17. Oliveira, B.C.D.S., Shi, Z., Alpuim, J.: Disjoint intersection types. In: Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming, pp. 364–377 (2016)

    Google Scholar 

  18. Pierce, B.C.: Programming with intersection types and bounded polymorphism. Ph.D. thesis. Citeseer (1991)

    Google Scholar 

  19. Pottinger, G.: A type assignment for the strongly normalizable \(\lambda \)-terms. In: To HB Curry: Essays on Combinatory Logic, Lambda Calculus and Formalism, pp. 561–577 (1980)

    Google Scholar 

  20. Rémy, D.: Type checking records and variants in a natural extension of ML. In: Proceedings of the 16th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 77–88 (1989)

    Google Scholar 

  21. Reynolds, J.C.: Preliminary design of the programming language Forsythe (1988)

    Google Scholar 

  22. Reynolds, J.C.: The coherence of languages with intersection types. In: International Symposium on Theoretical Aspects of Computer Software. pp. 675–700. Springer (1991)

    Chapter  Google Scholar 

  23. Reynolds, J.C.: Design of the programming language forsythe. In: O’Hearn, P.W., Tennent, R.D. (eds.) ALGOL-Like Languages, pp. 173–233. Springer, Boston (1997). https://doi.org/10.1007/978-1-4612-4118-8_9

  24. Rioux, N., Huang, X., Oliveira, B.C.D.S.: Zdancewic: a bowtie for a beast. Technical report, MS-CIS-22-02, Department of Computer and Information Science, University of Pennsylvania (2022)

    Google Scholar 

  25. Wadler, P., Blott, S.: How to make ad-hoc polymorphism less ad hoc. In: Proceedings of the 16th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 60–76 (1989)

    Google Scholar 

  26. Wadler, P., et al.: The expression problem. Posted on the Java Genericity mailing list (1998)

    Google Scholar 

  27. Wand, M.: Type inference for record concatenation and multiple inheritance. Information and Computation 93(1), 1–15 (1991)

    Article  MathSciNet  MATH  Google Scholar 

  28. Xie, N., Oliveira, B.C.d.S.: Let arguments go first. In: European Symposium on Programming. pp. 272–299. Springer (2018)

    Chapter  Google Scholar 

  29. Zhang, W., Sun, Y., Oliveira, B.C.: Compositional programming. ACM Trans. Program. Lang. Syst. (TOPLAS) 43(3), 1–61 (2021)

    Article  Google Scholar 

Download references

Acknowledgement

We thank the anonymous reviewers for their helpful comments and our colleagues of HKU Programming Languages Group for their discussions to understand this work better. We thank Chen Cui for his valuable feedback on the draft. This work has been sponsored by Hong Kong Research Grant Council projects number 17209519, 17209520 and 17209821.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Xu Xue .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Xue, X., Oliveira, B.C.d.S., Xie, N. (2022). Applicative Intersection Types. In: Sergey, I. (eds) Programming Languages and Systems. APLAS 2022. Lecture Notes in Computer Science, vol 13658. Springer, Cham. https://doi.org/10.1007/978-3-031-21037-2_8

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-21037-2_8

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-21036-5

  • Online ISBN: 978-3-031-21037-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics