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.
- 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
Google Scholar
Digital Library
- 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
Google Scholar
Digital Library
- 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
Google Scholar
Digital Library
- 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
Google Scholar
Digital Library
- 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
Google Scholar
Digital Library
- 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
Google Scholar
Cross Ref
- 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
Google Scholar
Digital Library
- 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
Google Scholar
Digital Library
- 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
Google Scholar
Digital Library
- Corrado Böhm and Alessandro Berarducci. 1985. Automatic synthesis of typed Lambda-programs on term algebras. Theoretical Computer Science, 39, 2-3 (1985).
Google Scholar
Cross Ref
- 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
Google Scholar
Digital Library
- 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.
Google Scholar
- 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
Google Scholar
Cross Ref
- 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
Google Scholar
Cross Ref
- Kim B. Bruce, Luca Cardelli, and Benjamin C. Pierce. 1999. Comparing Object Encodings. Information and Computation, 155, 1, https://doi.org/10.1007/BFb0014561
Google Scholar
Cross Ref
- 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
Google Scholar
Digital Library
- Luca Cardelli. 1985. Amber. In LITP Spring School on Theoretical Computer Science. 21–47. https://doi.org/10.1007/3-540-17184-3_38
Google Scholar
Cross Ref
- 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
Google Scholar
Digital Library
- 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
Google Scholar
Digital Library
- 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
Google Scholar
Digital Library
- Alonzo Church. 1932. A set of postulates for the foundation of logic. 33, 2 (1932), 346–366. https://doi.org/10.2307/1968702
Google Scholar
Cross Ref
- 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
Google Scholar
Cross Ref
- 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
Google Scholar
Digital Library
- 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
Google Scholar
Cross Ref
- 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.
Google Scholar
- EPFL. 2021. Scala 3. https://www.scala-lang.org/
Google Scholar
- 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).
Google Scholar
Digital Library
- Giorgio Ghelli. 1993. Recursive types are not conservative over F≤. In International Conference on Typed Lambda calculi and Applications. 146–162.
Google Scholar
Digital Library
- Jean-Yves Girard. 1972. Interprétation fonctionnelle et elimination des coupures de l’arithmétique d’ordre supérieur. Université de Paris 7.
Google Scholar
- Haskell Development Team. 1990. Haskell. https://www.haskell.org/
Google Scholar
- Haruo Hosoya, Benjamin C. Pierce, and David N. Turner. 1998. Datatypes and subtyping. Unpublished manuscript.
Google Scholar
- 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
Google Scholar
Digital Library
- INRIA. 1987. OCaml. https://ocaml.org/
Google Scholar
- 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.
Google Scholar
- 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
Google Scholar
Digital Library
- 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
Google Scholar
Digital Library
- 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
Google Scholar
Digital Library
- James Hiram Jr Morris. 1969. Lambda-calculus models of programming languages.. Ph.D. Dissertation. Massachusetts Institute of Technology.
Google Scholar
- 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
Google Scholar
Digital Library
- 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
Google Scholar
Cross Ref
- 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
Google Scholar
Digital Library
- Benjamin C. Pierce. 1994. Bounded quantification is undecidable. Information and Computation, 112, 1 (1994), 131–165. https://doi.org/10.1006/inco.1994.1055
Google Scholar
Digital Library
- Benjamin C Pierce. 1997. Bounded quantification with bottom. Citeseer.
Google Scholar
- Benjamin C. Pierce. 2002. Types and programming languages. MIT press.
Google Scholar
Digital Library
- 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
Google Scholar
Cross Ref
- 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.
Google Scholar
- Garrel Pottinger. 1980. A type assignment for the strongly normalizable λ -terms. To HB Curry: essays on combinatory logic, lambda calculus and formalism, 561–577.
Google Scholar
- 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
Google Scholar
Cross Ref
- 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
Google Scholar
Digital Library
- Davide Sangiorgi and Robin Milner. 1992. The Problem of “Weak Bisimulation up to”. In CONCUR. 630, 32–46. https://doi.org/10.1007/BFb0084781
Google Scholar
Cross Ref
- Dana Scott. 1962. A system of functional abstraction. Lectures delivered at University of California, Berkeley, California, USA, 1962/63.
Google Scholar
- Philip Wadler. 1998. The Expression Problem. discussion on the Java Genericity mailing list.
Google Scholar
- 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
Google Scholar
Digital Library
- 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
Google Scholar
Digital Library
Index Terms
Recursive Subtyping for All
Recommendations
Higher-order subtyping and its decidability
We define the typed lambda calculus F^ω (F-omega-meet), a natural generalization of Girard's system Fω (F-omega) with intersection types and bounded polymorphism. A novel aspect of our presentation is the use of term rewriting techniques to present ...
On the power of coercion abstraction
POPL '12Erasable coercions in System F-eta, also known as retyping functions, are well-typed eta-expansions of the identity. They may change the type of terms without changing their behavior and can thus be erased before reduction. Coercions in F-eta can model ...
A theory of higher-order subtyping with type intervals
The calculus of Dependent Object Types (DOT) has enabled a more principled and robust implementation of Scala, but its support for type-level computation has proven insufficient. As a remedy, we propose F··ω, a rigorous theoretical foundation for Scala’...






Comments