Abstract
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’s higher-kinded types. F··ω extends F<:ω with interval kinds, which afford a unified treatment of important type- and kind-level abstraction mechanisms found in Scala, such as bounded quantification, bounded operator abstractions, translucent type definitions and first-class subtyping constraints. The result is a flexible and general theory of higher-order subtyping. We prove type and kind safety of F··ω, as well as weak normalization of types and undecidability of subtyping. All our proofs are mechanized in Agda using a fully syntactic approach based on hereditary substitution.
Supplemental Material
Available for Download
Extended version. This version of the paper has a number of appendices containing detailed human-readable descriptions of metatheoretic results that have been omitted from the paper, and an overview of the Agda formalization, establishing the connection to the theory presented in the paper.
- Andreas Abel. 2008. Polarized Subtyping for Sized Types. Mathematical Structures in Computer Science, 18 (2008), 10, 797–822. issn:1469-8072 https://doi.org/10.1017/S0960129508006853 Google Scholar
Cross Ref
- Andreas Abel and Dulma Rodriguez. 2008. Syntactic Metatheory of Higher-Order Subtyping. In Proceedings of the 22nd International Workshop on Computer Science Logic (CSL 2008), 17th Annual Conference of the EACSL, Bertinoro, Italy, Michael Kaminski and Simone Martini (Eds.) (LNCS, Vol. 5213). Springer, Berlin, Heidelberg. 446–460. isbn:978-3-540-87531-4 https://doi.org/10.1007/978-3-540-87531-4_32 Google Scholar
Digital Library
- Robin Adams. 2006. Pure type systems with judgemental equality. Journal of Functional Programming, 16, 2 (2006), 219–246. https://doi.org/10.1017/S0956796805005770 Google Scholar
Digital Library
- Nada Amin. 2016. Dependent Object Types. Ph.D. Dissertation. School of Computer and Communication Sciences, École polytechnique fédérale de Lausanne. Lausanne, Switzerland. https://doi.org/10.5075/epfl-thesis-7156 EPFL thesis no. 7156. Google Scholar
Cross Ref
- Nada Amin, Samuel Grütter, Martin Odersky, Tiark Rompf, and Sandro Stucki. 2016. The Essence of Dependent Object Types. In A List of Successes That Can Change the World: Essays Dedicated to Philip Wadler on the Occasion of His 60th Birthday, Sam Lindley, Conor McBride, Phil Trinder, and Don Sannella (Eds.) (LNCS, Vol. 9600). Springer International Publishing, Cham. 249–272. isbn:978-3-319-30936-1 https://doi.org/10.1007/978-3-319-30936-1_14 Google Scholar
Cross Ref
- Nada Amin, Tiark Rompf, and Martin Odersky. 2014. Foundations of Path-dependent Types. In Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & Applications (OOPSLA 2014), Portland, Oregon, USA. ACM, New York, NY, USA. 233–249. isbn:978-1-4503-2585-1 https://doi.org/10.1145/2660193.2660216 Google Scholar
Digital Library
- David Aspinall and Adriana Compagnoni. 2001. Subtyping dependent types. Theoretical Computer Science, 266, 1-2 (2001), 273–309. issn:0304-3975 https://doi.org/10.1016/S0304-3975(00)00175-4 Google Scholar
Digital Library
- Hendrik P. Barendregt. 1992. Lambda Calculi with Types. In Handbook of Logic in Computer Science, Samson Abramsky, Dov M. Gabbay, and Thomas S. E Maibaum (Eds.). 2, Oxford University Press, Oxford, UK. 117–309. isbn:0-19-853761-1Google Scholar
- Luca Cardelli. 1988. Structural Subtyping and the Notion of Power Type. In Proceedings of the 15th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 1988), San Diego, California, USA. ACM, New York, NY, USA. 70–79. isbn:0-89791-252-7 https://doi.org/10.1145/73560.73566 Google Scholar
Digital Library
- Luca Cardelli. 1990. Notes about F^ω. October, Unpublished manuscript.Google Scholar
- Luca Cardelli and Giuseppe Longo. 1991. A Semantic Basis for Quest. Journal of Functional Programming, 1, 4 (1991), 417–458. https://doi.org/10.1017/S0956796800000198 Google Scholar
Cross Ref
- Luca Cardelli, Simone Martini, John C. Mitchell, and Andre Scedrov. 1991. An extension of system F with subtyping. In Proceedings of the International Conference on Theoretical Aspects of Computer Software (TACS 1991), Sendai, Japan, Takayasu Ito and Albert R. Meyer (Eds.). Springer, Berlin, Heidelberg. 750–770. isbn:978-3-540-47617-7 https://doi.org/10.1007/3-540-54415-1_73 Google Scholar
Cross Ref
- Luca Cardelli and Peter Wegner. 1985. On Understanding Types, Data Abstraction, and Polymorphism. Comput. Surveys, 17, 4 (1985), Dec., 471–523. issn:0360-0300 https://doi.org/10.1145/6041.6042 Google Scholar
Digital Library
- Simon Castellan, Pierre Clairambault, and Peter Dybjer. 2015. Undecidability of Equality in the Free Locally Cartesian Closed Category. In 13th International Conference on Typed Lambda Calculi and Applications, (TLCA 2015), Warsaw, Poland, Thorsten Altenkirch (Ed.) (LIPIcs, Vol. 38). Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl, Germany. 138–152. https://doi.org/10.4230/LIPIcs.TLCA.2015.138 Google Scholar
Cross Ref
- Adriana Compagnoni and Healfdene Goguen. 1999. Anti-Symmetry of Higher-Order Subtyping. In Proceedings of the 13th International Workshop on Computer Science Logic (CSL 1999), 8th Annual Conference of the EACSL Madrid, Spain, Jörg Flum and Mario Rodriguez-Artalejo (Eds.) (LNCS, Vol. 1683). Springer, Berlin, Heidelberg. 420–438. isbn:978-3-540-48168-3 https://doi.org/10.1007/3-540-48168-0_30 Google Scholar
Cross Ref
- Adriana Compagnoni and Healfdene Goguen. 2003. Typed operational semantics for higher-order subtyping. Information and Computation, 184, 2 (2003), 242–297. issn:0890-5401 https://doi.org/10.1016/S0890-5401(03)00062-2 Google Scholar
Digital Library
- Adriana B. Compagnoni. 1995. Decidability of higher-order subtyping with intersection types. In Computer Science Logic, 8th International Workshop, (CSL 1994), Kazimierz, Poland, September 25–30, 1994, Selected Papers, Leszek Pacholski and Jerzy Tiuryn (Eds.) (LNCS, Vol. 933). Springer, Berlin, Heidelberg. 46–60. isbn:978-3-540-49404-1 https://doi.org/10.1007/BFb0022246 Google Scholar
Cross Ref
- Karl Crary. 1997. Foundations for the Implementation of Higher-order Subtyping. In Proceedings of the Second ACM SIGPLAN International Conference on Functional Programming (ICFP 1997), Amsterdam, The Netherlands. ACM, New York, NY, USA. 125–135. isbn:0-89791-918-1 https://doi.org/10.1145/258948.258961 Google Scholar
Digital Library
- Karl Crary. 2009. A Syntactic Account of Singleton Types via Hereditary Substitution. In Proceedings of the Fourth International Workshop on Logical Frameworks and Meta-Languages, Theory and Practice (LFMTP 2009), Montreal, Quebec, Canada. ACM, New York, NY, USA. 21–29. isbn:978-1-60558-529-1 https://doi.org/10.1145/1577824.1577829 Google Scholar
Digital Library
- Julien Cretin and Didier Rémy. 2014. System F with Coercion Constraints. In Proceedings of the Joint Meeting of the Twenty-Third EACSL Annual Conference on Computer Science Logic (CSL 2014) and the Twenty-Ninth Annual ACM/IEEE Symposium on Logic in Computer Science (LICS 2014), Vienna, Austria. ACM, New York, NY, USA. Article 34, 10 pages. isbn:978-1-4503-2886-9 https://doi.org/10.1145/2603088.2603128 Google Scholar
Digital Library
- 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), March, 55–91. https://doi.org/10.1017/S0960129500001134 Google Scholar
Cross Ref
- The Dotty Team. 2020. Scala 3 – A next-generation compiler for Scala –. http://dotty.epfl.ch Source code available from.Google Scholar
- Paolo G. Giarrusso, Léo Stefanesco, Amin Timany, Lars Birkedal, and Robbert Krebbers. 2020. Scala Step-by-Step: Soundness for DOT with Step-Indexed Logical Relations in Iris. PACMPL, 4, ICFP (2020), Article 114, Aug., 29 pages. https://doi.org/10.1145/3408996 Google Scholar
Digital Library
- Jean-Yves Girard. 1972. Interprétation fonctionnelle et élimination des coupures de l’arithmétique d’ordre supérieur. Ph.D. Dissertation. Université Paris VII.Google Scholar
- Robert Harper and Daniel R. Licata. 2007. Mechanizing Metatheory in a Logical Framework. Journal of Functional Programming, 17, 4-5 (2007), July, 613–673. issn:0956-7968 https://doi.org/10.1017/S0956796807006430 Google Scholar
Digital Library
- Robert Harper and Mark Lillibridge. 1994. A Type-theoretic Approach to Higher-order Modules with Sharing. In Proceedings of the 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 1994), Portland, Oregon, USA. ACM, New York, NY, USA. 123–137. isbn:0-89791-636-0 https://doi.org/10.1145/174675.176927 Google Scholar
Digital Library
- Robert Harper and Frank Pfenning. 2005. On Equivalence and Canonical Forms in the LF Type Theory. ACM Transactions on Computational Logic, 6, 1 (2005), Jan., 61–101. issn:1529-3785 https://doi.org/10.1145/1042038.1042041 Google Scholar
Digital Library
- Jason Z. S. Hu and Ondřej Lhoták. 2019. Undecidability of D: And Its Decidable Fragments. PACMPL, 4, POPL (2019), Article 9, Dec., 30 pages. https://doi.org/10.1145/3371077 Google Scholar
Digital Library
- Chantal Keller and Thorsten Altenkirch. 2010. Hereditary Substitutions for Simple Types, Formalized. In Proceedings of the Third ACM SIGPLAN Workshop on Mathematically Structured Functional Programming (MSFP 2010), Baltimore, Maryland, USA. ACM, New York, NY, USA. 3–10. isbn:978-1-4503-0255-5 https://doi.org/10.1145/1863597.1863601 Google Scholar
Digital Library
- Daniel K. Lee, Karl Crary, and Robert Harper. 2007. Towards a Mechanized Metatheory of Standard ML. In Proceedings of the 34th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2007), Nice, France. ACM, New York, NY, USA. 173–184. isbn:1-59593-575-4 https://doi.org/10.1145/1190216.1190245 Google Scholar
Digital Library
- Adriaan Moors, Frank Piessens, and Martin Odersky. 2008. Generics of a Higher Kind. In Proceedings of the 23rd ACM SIGPLAN Conference on Object-oriented Programming Systems Languages and Applications (OOPSLA 2008), Nashville, TN, USA. ACM, New York, NY, USA. 423–438. isbn:978-1-60558-215-3 https://doi.org/10.1145/1449764.1449798 Google Scholar
Digital Library
- Adriaan Moors, Frank Piessens, and Martin Odersky. 2008. Safe type-level abstraction in Scala. In Proceedings of the International Workshop on Foundations of Object-Oriented Languages (FOOL 2008), San Francisco, CA, USA. 1–13. https://www.cs.cmu.edu/~aldrich/FOOL/fool08/moors.pdfGoogle Scholar
- Bengt Nordström, Kent Petersson, and Jan M. Smith. 1990. Programming in Martin-Löf’s type theory. 200, Oxford University Press, Oxford, UK.Google Scholar
Digital Library
- Ulf Norell. 2007. Towards a practical programming language based on dependent type theory. Ph.D. Dissertation. Department of Computer Science and Engineering, Chalmers University of Technology. Göteborg, Sweden.Google Scholar
- Martin Odersky, Guillaume Martres, and Dmitry Petrashko. 2016. Implementing Higher-kinded Types in Dotty. In Proceedings of the 7th ACM SIGPLAN Symposium on Scala ([email protected] 2016), Amsterdam, Netherlands. ACM, New York, NY, USA. 51–60. isbn:978-1-4503-4648-1 https://doi.org/10.1145/2998392.2998400 Google Scholar
Digital Library
- Lionel Parreaux, Aleksander Boruch-Gruszecki, and Paolo G. Giarrusso. 2019. Towards Improved GADT Reasoning in Scala. In Proceedings of the Tenth ACM SIGPLAN Symposium on Scala (Scala 2019), London, United Kingdom. ACM, New York, NY, USA. 12–16. isbn:9781450368247 https://doi.org/10.1145/3337932.3338813 Google Scholar
Digital Library
- Benjamin Pierce and Martin Steffen. 1997. Higher-order subtyping. Theoretical Computer Science, 176, 1–2 (1997), 235–282. issn:0304-3975 https://doi.org/10.1016/S0304-3975(96)00096-5 Google Scholar
Digital Library
- Benjamin C. Pierce. 1992. Bounded Quantification is Undecidable. In Proceedings of the 19th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 1992), Albuquerque, NM, USA. Association for Computing Machinery, New York, NY, USA. 305–315. isbn:0897914538 https://doi.org/10.1145/143165.143228 Google Scholar
Digital Library
- Benjamin C. Pierce. 2002. Types and programming languages. MIT Press, Cambridge, MA, USA.Google Scholar
Digital Library
- Marianna Rapoport and Ondřej Lhoták. 2019. A Path to DOT: Formalizing Fully Path-Dependent Types. PACMPL, 3, OOPSLA (2019), Article 145, Oct., 29 pages. https://doi.org/10.1145/3360571 Google Scholar
Digital Library
- 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 (OOPSLA 2016), Amsterdam, Netherlands. ACM, New York, NY, USA. 624–641. isbn:978-1-4503-4444-9 https://doi.org/10.1145/2983990.2984008 Google Scholar
Digital Library
- Gabriel Scherer and Didier Rémy. 2015. Full Reduction in the Face of Absurdity. In Proceedings of the 24th European Symposium on Programming on Programming Languages and Systems (ESOP 2015), Held as Part of the European Joint Conferences on Theory and Practice of Software (ETAPS 2015), London, UK, Jan Vitek (Ed.) (LNCS, Vol. 9032). Springer, Berlin, Heidelberg. 685–709. isbn:978-3-662-46669-8 https://doi.org/10.1007/978-3-662-46669-8_28 Google Scholar
Cross Ref
- Christopher A. Stone and Robert Harper. 2000. Deciding Type Equivalence in a Language with Singleton Kinds. In Proceedings of the 27th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2000), Boston, MA, USA. ACM, New York, NY, USA. 214–227. isbn:1-58113-125-9 https://doi.org/10.1145/325694.325724 Google Scholar
Digital Library
- Sandro Stucki. 2017. Higher-Order Subtyping with Type Intervals. Ph.D. Dissertation. School of Computer and Communication Sciences, École polytechnique fédérale de Lausanne. Lausanne, Switzerland. https://doi.org/10.5075/epfl-thesis-8014 Google Scholar
Cross Ref
- Sandro Stucki and Paolo G. Giarrusso. 2021. A Theory of Higher-order Subtyping with Type Intervals – Agda Formalization. https://doi.org/10.5281/zenodo.4775731 Google Scholar
Cross Ref
- Kevin Watkins, Iliano Cervesato, Frank Pfenning, and David Walker. 2004. A Concurrent Logical Framework: The Propositional Fragment. In International Workshop on Types for Proofs and Programs (TYPES 2003), Torino, Italy, April 30–May 4, 2003, Revised Selected Papers, Stefano Berardi, Mario Coppo, and Ferruccio Damiani (Eds.) (LNCS, Vol. 3085). Springer, Berlin, Heidelberg. 355–377. isbn:978-3-540-24849-1 https://doi.org/10.1007/978-3-540-24849-1_23 Google Scholar
Cross Ref
- Andrew K. Wright and Matthias Felleisen. 1994. A Syntactic Approach to Type Soundness. Information and Computation, 115, 1 (1994), Nov., 38–94. issn:0890-5401 https://doi.org/10.1006/inco.1994.1093 Google Scholar
Digital Library
- Yanpeng Yang and Bruno C. d. S. Oliveira. 2017. Unifying Typing and Subtyping. PACMPL, 1, OOPSLA (2017), Article 47, Oct., 26 pages. https://doi.org/10.1145/3133871 Google Scholar
Digital Library
- Jan Zwanenburg. 1999. Pure Type Systems with Subtyping. In Proceedings of the 4th International Conference on Typed Lambda Calculi and Applications (TLCA 1999), L’Aquila, Italy, Jean-Yves Girard (Ed.) (LNCS, Vol. 1581). Springer, Berlin, Heidelberg. 381–396. isbn:978-3-540-65763-7 https://doi.org/10.1007/3-540-48959-2_27 Google Scholar
Cross Ref
Index Terms
A theory of higher-order subtyping with type intervals
Recommendations
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 ...
On the power of coercion abstraction
POPL '12: Proceedings of the 39th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languagesErasable 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 ...
System F with coercion constraints
CSL-LICS '14: Proceedings of the Joint Meeting of the Twenty-Third EACSL Annual Conference on Computer Science Logic (CSL) and the Twenty-Ninth Annual ACM/IEEE Symposium on Logic in Computer Science (LICS)We present a second-order λ-calculus with coercion constraints that generalizes a previous extension of System F with parametric coercion abstractions by allowing multiple but simultaneous type and coercion abstractions, as well as recursive coercions ...






Comments