[go: up one dir, main page]
More Web Proxy on the site http://driver.im/ skip to main content
research-article
Open access

Recursive Subtyping for All

Published: 11 January 2023 Publication History

Abstract

Recursive types and bounded quantification are prominent features in many modern programming languages, such as Java, C#, Scala or TypeScript. Unfortunately, the interaction between recursive types, bounded quantification and subtyping has shown to be problematic in the past. Consequently, defining a simple foundational calculus that combines those features and has desirable properties, such as decidability, transitivity of subtyping, conservativity and a sound and complete algorithmic formulation has been a long time challenge.
This paper presents an extension of kernel ‍F, called Fµ, with iso-recursive types. F is a well-known polymorphic calculus with bounded quantification. In Fµ we add iso-recursive types, and correspondingly extend the subtyping relation with iso-recursive subtyping using the recently proposed nominal unfolding rules. We also add two smaller extensions to F. The first one is a generalization of the kernel ‍F rule for bounded quantification that accepts equivalent rather than equal bounds. The second extension is the use of so-called structural folding/unfolding rules, inspired by the structural unfolding rule proposed by Abadi, Cardelli, and Viswanathan [1996]. The structural rules add expressive power to the more conventional folding/unfolding rules in the literature, and they enable additional applications. We present several results, including: type soundness; transitivity and decidability of subtyping; the conservativity of Fµ over F; and a sound and complete algorithmic formulation of Fµ. Moreover, we study an extension of Fµ, called F≤≥µ, which includes lower bounded quantification in addition to the conventional (upper) bounded quantification of F. All the results in this paper have been formalized in the Coq theorem prover.

References

[1]
Martín Abadi, Luca Cardelli, and Ramesh Viswanathan. 1996. An interpretation of objects and object types. In Proceedings of the 23rd ACM SIGPLAN-SIGACT symposium on Principles of programming languages. 396–409. https://doi.org/10.1145/237721.237809
[2]
Roberto M. Amadio and Luca Cardelli. 1993. Subtyping recursive types. ACM Transactions on Programming Languages and Systems (TOPLAS), 15, 4 (1993), 575–631. https://doi.org/10.1145/155183.155231
[3]
Nada Amin and Tiark Rompf. 2017. Type soundness proofs with definitional interpreters. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages. 666–679. https://doi.org/10.1145/3093333.3009866
[4]
Nada Amin, Tiark Rompf, and Martin Odersky. 2014. Foundations of path-dependent types. Acm Sigplan Notices, 49, 10 (2014), 233–249. https://doi.org/10.1145/2714064.2660216
[5]
Brian Aydemir, Arthur Charguéraud, Benjamin C. Pierce, Randy Pollack, and Stephanie Weirich. 2008. Engineering formal metatheory. Acm sigplan notices, 43, 1 (2008), 3–15. https://doi.org/10.1145/1328897.1328443
[6]
Michael Backes, Cătălin Hriţcu, and Matteo Maffei. 2014. Union, intersection and refinement types and reasoning about type disjointness for secure protocol implementations. Journal of Computer Security, 22, 2 (2014), 301–353. https://doi.org/10.3233/JCS-130493
[7]
Paolo Baldan, Giorgio Ghelli, and Alessandra Raffaeta. 1999. Basic theory of F-bounded quantification. Information and Computation, 153, 2 (1999), 173–237. https://doi.org/10.1006/inco.1999.2802
[8]
Franco Barbanera, Mariangiola Dezani-Ciancaglini, and Ugo de’Liguoro. 1995. Intersection and Union Types: Syntax and Semantics. Information and Computation, 119, 2 (1995), June, 202–230. https://doi.org/10.1006/inco.1995.1086
[9]
Jesper Bengtson, Karthikeyan Bhargavan, Cédric Fournet, Andrew D. Gordon, and Sergio Maffeis. 2011. Refinement types for secure implementations. ACM Transactions on Programming Languages and Systems (TOPLAS), 33, 2 (2011), 1–45. https://doi.org/10.1145/1890028.1890031
[10]
Corrado Böhm and Alessandro Berarducci. 1985. Automatic synthesis of typed Lambda-programs on term algebras. Theoretical Computer Science, 39, 2-3 (1985).
[11]
François Bourdoncle and Stephan Merz. 1997. Type checking higher-order polymorphic multi-methods. In Proceedings of the 24th ACM SIGPLAN-SIGACT symposium on Principles of programming languages. 302–315. https://doi.org/10.1145/263699.263743
[12]
Michael Brandt and Fritz Henglein. 1997. Coinductive axiomatization of recursive type equality and subtyping. 1210, 63–81. Full version in Fundamenta Informaticae, 33:309–338, 1998.
[13]
Kim Bruce, Luca Cardelli, Giuseppe Castagna, Hopkins Objects Group, Gary T Leavens, and Benjamin C. Pierce. 1995. On binary methods. Theory and Practice of Object Systems, 1, 3 (1995), 221–242. https://doi.org/10.1002/j.1096-9942.1995.tb00019.x
[14]
Kim B Bruce. 1994. A paradigmatic object-oriented programming language: Design, static typing and semantics. Journal of Functional Programming, 4, 2 (1994), 127–206. https://doi.org/10.1017/S0956796800001039
[15]
Kim B. Bruce, Luca Cardelli, and Benjamin C. Pierce. 1999. Comparing Object Encodings. Information and Computation, 155, 1, https://doi.org/10.1007/BFb0014561
[16]
Peter Canning, William Cook, Walter Hill, Walter Olthoff, and John C. Mitchell. 1989. F-Bounded Polymorphism for Object-Oriented Programming. In Proceedings of the Fourth International Conference on Functional Programming Languages and Computer Architecture (FPCA 1989). 8 pages. https://doi.org/10.1145/99370.99392
[17]
Luca Cardelli. 1985. Amber. In LITP Spring School on Theoretical Computer Science. 21–47. https://doi.org/10.1007/3-540-17184-3_38
[18]
Luca Cardelli, Simone Martini, John C. Mitchell, and Andre Scedrov. 1994. An extension of system F with subtyping. Information and computation, 109, 1-2 (1994), 4–56. https://doi.org/10.1006/inco.1994.1013
[19]
Luca Cardelli and Peter Wegner. 1985. On understanding types, data abstraction, and polymorphism. ACM Computing Surveys (CSUR), 17, 4 (1985), 471–523. https://doi.org/10.1145/6041.6042
[20]
Giuseppe Castagna and Benjamin C. Pierce. 1994. Decidable Bounded Quantification. In Proceedings of the 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’94). Association for Computing Machinery, New York, NY, USA. 151–162. isbn:0897916360 https://doi.org/10.1145/174675.177844
[21]
Alonzo Church. 1932. A set of postulates for the foundation of logic. 33, 2 (1932), 346–366. https://doi.org/10.2307/1968702
[22]
Dario Colazzo and Giorgio Ghelli. 2005. Subtyping recursion and parametric polymorphism in kernel fun. Information and Computation, 198, 2 (2005), 71–147. https://doi.org/10.1016/j.ic.2004.11.003
[23]
William R. Cook, Walter Hill, and Peter S. Canning. 1989. Inheritance is Not Subtyping. In Proceedings of the 17th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’90). Association for Computing Machinery. https://doi.org/10.1145/96709.96721
[24]
Mario Coppo, Mariangiola Dezani-Ciancaglini, and Betti Venneri. 1981. Functional characters of solvable terms. Mathematical Logic Quarterly, 27, 2-6 (1981), 45–58. https://doi.org/10.1002/malq.19810270205
[25]
Pierre-Louis Curien and Giorgio Ghelli. 1992. Coherence of subsumption, minimum typing and type-checking in F≤. Mathematical structures in computer science, 2, 1 (1992), 55–91.
[26]
EPFL. 2021. Scala 3. https://www.scala-lang.org/
[27]
Vladimir Gapeyev, Michael Levin, and Benjamin C. Pierce. 2003. Recursive Subtyping Revealed. Journal of Functional Programming, 12, 6 (2003), 511–548. https://doi.org/10.1145/357766.351261 Preliminary version in International Conference on Functional Programming (ICFP), 2000. Also appears as Chapter 21 of Types and Programming Languages by Benjamin C. Pierce (MIT Press, 2002).
[28]
Giorgio Ghelli. 1993. Recursive types are not conservative over F≤. In International Conference on Typed Lambda calculi and Applications. 146–162.
[29]
Jean-Yves Girard. 1972. Interprétation fonctionnelle et elimination des coupures de l’arithmétique d’ordre supérieur. Université de Paris 7.
[30]
Haskell Development Team. 1990. Haskell. https://www.haskell.org/
[31]
Haruo Hosoya, Benjamin C. Pierce, and David N. Turner. 1998. Datatypes and subtyping. Unpublished manuscript.
[32]
Jason ZS Hu and Ondřej Lhoták. 2020. Undecidability of D<: and its decidable fragments. Proceedings of the ACM on Programming Languages, 4, POPL (2020), 1–30. https://doi.org/10.1145/3371077
[33]
INRIA. 1987. OCaml. https://ocaml.org/
[34]
Alan Jeffrey. 2001. A symbolic labelled transition system for coinductive subtyping of F_μ ≤ types. In 2001 IEEE Conference on Logic and Computer Science (LICS 2001). 323.
[35]
Jay Ligatti, Jeremy Blackburn, and Michael Nachtigal. 2017. On subtyping-relation completeness, with an application to iso-recursive types. ACM Transactions on Programming Languages and Systems (TOPLAS), 39, 1 (2017), 1–36. https://doi.org/10.1145/2994596
[36]
Julian Mackay, Alex Potanin, Jonathan Aldrich, and Lindsay Groves. 2020. Decidable subtyping for path dependent types. Proc. ACM Program. Lang., 4, POPL (2020), 66:1–66:27. https://doi.org/10.1145/3371134
[37]
Todd Millstein, Colin Bleckner, and Craig Chambers. 2004. Modular typechecking for hierarchically extensible datatypes and functions. ACM Transactions on Programming Languages and Systems (TOPLAS), 26, 5 (2004), 836–889. https://doi.org/10.1145/583852.581489
[38]
James Hiram Jr Morris. 1969. Lambda-calculus models of programming languages. Ph.D. Dissertation. Massachusetts Institute of Technology.
[39]
Bruno C. d. S. Oliveira. 2009. Modular visitor components. In European Conference on Object-Oriented Programming. 269–293. https://doi.org/10.1007/978-3-642-03013-0_13
[40]
Bruno C. d. S. Oliveira, Shaobo Cui, and Baber Rehman. 2020. The Duality of Subtyping. In 34th European Conference on Object-Oriented Programming, ECOOP 2020, November 15-17, 2020, Berlin, Germany (Virtual Conference), Robert Hirschfeld and Tobias Pape (Eds.) (LIPIcs). https://doi.org/10.4230/LIPIcs.ECOOP.2020.29
[41]
Michel Parigot. 1992. Recursive programming with proofs. Theoretical Computer Science, 94, 2 (1992), 335–356. https://doi.org/10.1016/0304-3975(92)90042-E
[42]
Benjamin C. Pierce. 1994. Bounded quantification is undecidable. Information and Computation, 112, 1 (1994), 131–165. https://doi.org/10.1006/inco.1994.1055
[43]
Benjamin C Pierce. 1997. Bounded quantification with bottom. Citeseer.
[44]
Benjamin C. Pierce. 2002. Types and programming languages. MIT press.
[45]
Benjamin C Pierce and David N Turner. 1994. Simple type-theoretic foundations for object-oriented programming. Journal of functional programming, 4, 2 (1994), 207–247. https://doi.org/10.1017/S0956796800001040
[46]
Erik Poll. 1998. Subtyping and Inheritance for Categorical Datatypes: Preliminary Report (Type Theory and its Applications to Computer Systems). Kyoto University Research Information Repository, 1023 (1998), 112–125.
[47]
Garrel Pottinger. 1980. A type assignment for the strongly normalizable λ -terms. To HB Curry: essays on combinatory logic, lambda calculus and formalism, 561–577.
[48]
John C. Reynolds. 1974. Towards a theory of type structure. In Colloque sur la Programmation. 408–425. https://doi.org/10.1007/3-540-06859-7_148
[49]
Tiark Rompf and Nada Amin. 2016. Type soundness for dependent object types (DOT). In Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications. 624–641. https://doi.org/10.1145/2983990.2984008
[50]
Davide Sangiorgi and Robin Milner. 1992. The Problem of “Weak Bisimulation up to”. In CONCUR. 630, 32–46. https://doi.org/10.1007/BFb0084781
[51]
Dana Scott. 1962. A system of functional abstraction. Lectures delivered at University of California, Berkeley, California, USA, 1962/63.
[52]
Philip Wadler. 1998. The Expression Problem. discussion on the Java Genericity mailing list.
[53]
Yaoda Zhou, Bruno C. d. S. Oliveira, and Jinxu Zhao. 2020. Revisiting Iso-Recursive Subtyping. Proc. ACM Program. Lang., 4, OOPSLA (2020), https://doi.org/10.1145/3549537
[54]
Yaoda Zhou, Jinxu Zhao, and Bruno C. d. S. Oliveira. 2022. Revisiting Iso-Recursive Subtyping. ACM Transactions on Programming Languages and Systems, 44, 4 (2022), Article 24, issn:0164-0925 https://doi.org/10.1145/3549537

Cited By

View all
  • (2024)Full Iso-Recursive TypesProceedings of the ACM on Programming Languages10.1145/36897188:OOPSLA2(192-221)Online publication date: 8-Oct-2024
  • (2024)Parametric Subtyping for Structural Parametric PolymorphismProceedings of the ACM on Programming Languages10.1145/36329328:POPL(2700-2730)Online publication date: 5-Jan-2024
  • (2024)Polymorphic Reachability Types: Tracking Freshness, Aliasing, and Separation in Higher-Order Generic ProgramsProceedings of the ACM on Programming Languages10.1145/36328568:POPL(393-424)Online publication date: 5-Jan-2024
  • Show More Cited By

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image Proceedings of the ACM on Programming Languages
Proceedings of the ACM on Programming Languages  Volume 7, Issue POPL
January 2023
2196 pages
EISSN:2475-1421
DOI:10.1145/3554308
  • Editor:
Issue’s Table of Contents
This work is licensed under a Creative Commons Attribution 4.0 International License.

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 11 January 2023
Published in PACMPL Volume 7, Issue POPL

Permissions

Request permissions for this article.

Check for updates

Badges

Author Tags

  1. Bounded Polymorphism
  2. Iso-Recursive Subtyping
  3. Object Encodings

Qualifiers

  • Research-article

Funding Sources

  • Hong Kong Research Grant Council

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)246
  • Downloads (Last 6 weeks)28
Reflects downloads up to 11 Dec 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Full Iso-Recursive TypesProceedings of the ACM on Programming Languages10.1145/36897188:OOPSLA2(192-221)Online publication date: 8-Oct-2024
  • (2024)Parametric Subtyping for Structural Parametric PolymorphismProceedings of the ACM on Programming Languages10.1145/36329328:POPL(2700-2730)Online publication date: 5-Jan-2024
  • (2024)Polymorphic Reachability Types: Tracking Freshness, Aliasing, and Separation in Higher-Order Generic ProgramsProceedings of the ACM on Programming Languages10.1145/36328568:POPL(393-424)Online publication date: 5-Jan-2024
  • (2023)Greedy Implicit Bounded QuantificationProceedings of the ACM on Programming Languages10.1145/36228717:OOPSLA2(2083-2111)Online publication date: 16-Oct-2023

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Full Access

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media