Abstract
The Amber rules are well-known and widely used for subtyping iso-recursive types. They were first briefly and informally introduced in 1985 by Cardelli in a manuscript describing the Amber language. Despite their use over many years, important aspects of the metatheory of the iso-recursive style Amber rules have not been studied in depth or turn out to be quite challenging to formalize.
This paper aims to revisit the problem of subtyping iso-recursive types. We start by introducing a novel declarative specification that we believe captures the “spirit” of Amber-style iso-recursive subtyping. Informally, the specification states that two recursive types are subtypes if all their finite unfoldings are subtypes. The Amber rules are shown to be sound with respect to this declarative specification. We then derive a sound, complete and decidable algorithmic formulation of subtyping that employs a novel double unfolding rule. Compared to the Amber rules, the double unfolding rule has the advantage of: 1) being modular; 2) not requiring reflexivity to be built in; and 3) leading to an easy proof of transitivity of subtyping. This work sheds new insights on the theory of subtyping iso-recursive types, and the new double unfolding rule has important advantages over the original Amber rules for both implementations and metatheoretical studies involving recursive types. All results are mechanically formalized in the Coq theorem prover. As far as we know, this is the first comprehensive treatment of iso-recursive subtyping dealing with unrestricted recursive types in a theorem prover.
Supplemental Material
- Roberto M Amadio and Luca Cardelli. 1993. Subtyping recursive types. ACM Transactions on Programming Languages and Systems (TOPLAS) 15, 4 ( 1993 ), 575-631.Google Scholar
Digital Library
- 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. Springer, 249-272.Google Scholar
- 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.Google Scholar
Digital Library
- Andrew W Appel and Amy P Felty. 2000. A semantic model of types and machine instructions for proof-carrying code. In Proceedings of the 27th ACM SIGPLAN-SIGACT symposium on Principles of programming languages. 243-253.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.Google Scholar
- Michael Backes, Cătălin Hriţcu, and Matteo Mafei. 2014. Union, intersection and refinement types and reasoning about type disjointness for secure protocol implementations. Journal of Computer Security 22, 2 ( 2014 ), 301-353.Google Scholar
Cross Ref
- Jesper Bengtson, Karthikeyan Bhargavan, Cédric Fournet, Andrew D Gordon, and Sergio Mafeis. 2011. Refinement types for secure implementations. ACM Transactions on Programming Languages and Systems (TOPLAS) 33, 2 ( 2011 ), 1-45.Google Scholar
Digital Library
- Michael Brandt and Fritz Henglein. 1997. Coinductive axiomatization of recursive type equality and subtyping, Vol. 1210. 63-81. Full version in Fundamenta Informaticae, 33 : 309-338, 1998.Google Scholar
Cross Ref
- Peter Canning, William Cook, Walter Hill, Walter Olthof, and John C. Mitchell. 1989. F-Bounded Polymorphism for ObjectOriented Programming. In Proceedings of the Fourth International Conference on Functional Programming Languages and Computer Architecture (Imperial College, London, United Kingdom) ( FPCA 1989 ). 8.Google Scholar
- Luca Cardelli. 1985. Amber. In LITP Spring School on Theoretical Computer Science. Springer, 21-47.Google Scholar
- Felice Cardone. 1991. Recursive types for Fun. Theoretical Computer Science 83, 1 ( 1991 ), 39-56.Google Scholar
- Giuseppe Castagna, Mariangiola Dezani-Ciancaglini, Elena Giachino, and Luca Padovani. 2009. Foundations of session types. In Proceedings of the 11th ACM SIGPLAN conference on Principles and practice of declarative programming. 219-230.Google Scholar
Digital Library
- Giuseppe Castagna and Alain Frisch. 2005. A Gentle Introduction to Semantic Subtyping. In Proceedings of the 7th ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming (PPDP '05).Google Scholar
Digital Library
- Tzu-Chun Chen, Mariangiola Dezani-Ciancaglini, and Nobuko Yoshida. 2014. On the preciseness of subtyping in session types. In Proceedings of the 16th International Symposium on Principles and Practice of Declarative Programming. 135-146.Google Scholar
Digital Library
- Ravi Chugh. 2015. IsoLATE: A type system for self-recursion. In European Symposium on Programming Languages and Systems. Springer, 257-282.Google Scholar
Digital Library
- Dario Colazzo and Giorgio Ghelli. 1999. Subtyping recursive types in kernel fun. In Proceedings. 14th Symposium on Logic in Computer Science (Cat. No. PR00158). IEEE, 137-146.Google Scholar
Cross Ref
- Karl Crary, Robert Harper, and Sidd Puri. 1999. What is a Recursive Module?. In Proceedings of the ACM SIGPLAN 1999 Conference on Programming Language Design and Implementation (PLDI '99).Google Scholar
Digital Library
- Nils Anders Danielsson and Thorsten Altenkirch. 2010. Subtyping, declaratively. In International Conference on Mathematics of Program Construction. Springer, 100-118.Google Scholar
Cross Ref
- Dominic Duggan. 2002. Type-safe linking with recursive DLLs and shared libraries. ACM Transactions on Programming Languages and Systems (TOPLAS) 24, 6 ( 2002 ), 711-804.Google Scholar
Digital Library
- Vladimir Gapeyev, Michael Levin, and Benjamin Pierce. 2003. Recursive Subtyping Revealed. Journal of Functional Programming 12, 6 ( 2003 ), 511-548. 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
- Simon Gay and Malcolm Hole. 2005. Subtyping for session types in the pi calculus. Acta Informatica 42, 2-3 ( 2005 ), 191-225.Google Scholar
Cross Ref
- Simon J Gay and Vasco T Vasconcelos. 2010. Linear type theory for asynchronous session types. Journal of Functional Programming 20, 1 ( 2010 ), 19-50.Google Scholar
Digital Library
- Giorgio Ghelli. 1993. Recursive types are not conservative over F ≤. In International Conference on Typed Lambda calculi and Applications. Springer, 146-162.Google Scholar
Cross Ref
- Martin Hofmann and Benjamin C Pierce. 1996. Positive subtyping. Information and Computation 126, 1 ( 1996 ), 11-33.Google Scholar
- Haruo Hosoya, Benjamin C Pierce, David N Turner, et al. 1998. Datatypes and subtyping. Unpublished manuscript. Available http://www. cis. upenn. edu/˜ bcpierce/papers/index. html ( 1998 ).Google Scholar
- Atsushi Igarashi, Benjamin C Pierce, and Philip Wadler. 2001. Featherweight Java: a minimal core calculus for Java and GJ. ACM Transactions on Programming Languages and Systems (TOPLAS) 23, 3 ( 2001 ), 396-450.Google Scholar
Digital Library
- Joseph Lee, Jonathan Aldrich, Troy Shaw, and Alex Potanin. 2015. A Theory of Tagged Objects. In European Conference on Object-Oriented Programming (ECOOP).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.Google Scholar
Digital Library
- Benjamin C. Pierce. 2002. Types and programming languages. MIT press.Google Scholar
Digital Library
- François Pottier. 2013. Syntactic soundness proof of a type-and-capability system with hidden state. Journal of functional programming 23, 1 ( 2013 ), 38-144.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. 624-641.Google Scholar
Digital Library
- Jeremy G Siek and Sam Tobin-Hochstadt. 2016. The recursive union of some gradual types. In A List of Successes That Can Change the World. Springer, 388-410.Google Scholar
- Marvin Solomon. 1978. Type definitions with parameters. In Proceedings of the 5th ACM SIGACT-SIGPLAN symposium on Principles of programming languages. 31-38.Google Scholar
Digital Library
- Chris Stone and Robert Harper. 1996. A Type-Theoretic Account of Standard ML 1996. Technical Report CMU-CS-96-136. School of Computer Science, Carnegie Mellon University, School of Computer Science, Carnegie Mellon University, Pittsburgh, PA 15213-3891.Google Scholar
- Nikhil Swamy, Juan Chen, Cédric Fournet, Pierre-Yves Strub, Karthikeyan Bhargavan, and Jean Yang. 2011. Secure Distributed Programming with Value-Dependent Types. In Proceedings of the 16th ACM SIGPLAN International Conference on Functional Programming (ICFP 2011 ).Google Scholar
Digital Library
- The Coq Development Team. 2019. Coq. https://coq.inria.frGoogle Scholar
- Joseph C. Vanderwaart, Derek Dreyer, Leaf Petersen, Karl Crary, Robert Harper, and Perry Cheng. 2003. Typed Compilation of Recursive Datatypes. In Proceedings of the 2003 ACM SIGPLAN International Workshop on Types in Languages Design and Implementation. 98-108.Google Scholar
Digital Library
- Yanpeng Yang and Bruno C. d. S. Oliveira. 2019. Pure iso-type systems. Journal of Functional Programming 29 ( 2019 ).Google Scholar
Index Terms
Revisiting iso-recursive subtyping
Recommendations
Coinductive Axiomatization of Recursive Type Equality and Subtyping
We present new sound and complete axiomatizations of type equality and subtype inequality for a first-order type language with regular recursive types. The rules are motivated by coinductive characterizations of type containment and type equality via ...
Revisiting Iso-Recursive Subtyping
The Amber rules are well-known and widely used for subtyping iso-recursive types. They were first briefly and informally introduced in 1985 by Cardelli in a manuscript describing the Amber language. Despite their use over many years, important aspects of ...
Subtyping recursive types
We investigate the interactions of subtyping and recursive types, in a simply typed λ-calculus. The two fundamental questions here are whether two (recursive)types are in the subtype relation and whether a term has a type. To address the first question, ...






Comments