skip to main content

Revisiting iso-recursive subtyping

Published:13 November 2020Publication History
Skip Abstract Section

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.

Skip Supplemental Material Section

Supplemental Material

Auxiliary Presentation Video

This is a presentation of the paper Revisiting Iso-Recursive Subtyping. In this presentation, we gives a novel declarative specification for iso-recursive subtyping, gives a novel algorithmic subtyping formulation using the double unfolding rule, formalizes a typed lambda calculus with iso-recursive types and proves type soundness, and shows that our new subtyping formulation is at least as expressive as the Amber rules.

References

  1. Roberto M Amadio and Luca Cardelli. 1993. Subtyping recursive types. ACM Transactions on Programming Languages and Systems (TOPLAS) 15, 4 ( 1993 ), 575-631.Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. 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 ScholarGoogle Scholar
  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.Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  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.Google ScholarGoogle Scholar
  6. 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 ScholarGoogle ScholarCross RefCross Ref
  7. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  8. 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 ScholarGoogle ScholarCross RefCross Ref
  9. 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 ScholarGoogle Scholar
  10. Luca Cardelli. 1985. Amber. In LITP Spring School on Theoretical Computer Science. Springer, 21-47.Google ScholarGoogle Scholar
  11. Felice Cardone. 1991. Recursive types for Fun. Theoretical Computer Science 83, 1 ( 1991 ), 39-56.Google ScholarGoogle Scholar
  12. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  13. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  14. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  15. Ravi Chugh. 2015. IsoLATE: A type system for self-recursion. In European Symposium on Programming Languages and Systems. Springer, 257-282.Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. 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 ScholarGoogle ScholarCross RefCross Ref
  17. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  18. Nils Anders Danielsson and Thorsten Altenkirch. 2010. Subtyping, declaratively. In International Conference on Mathematics of Program Construction. Springer, 100-118.Google ScholarGoogle ScholarCross RefCross Ref
  19. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  20. 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 ScholarGoogle Scholar
  21. Simon Gay and Malcolm Hole. 2005. Subtyping for session types in the pi calculus. Acta Informatica 42, 2-3 ( 2005 ), 191-225.Google ScholarGoogle ScholarCross RefCross Ref
  22. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  23. Giorgio Ghelli. 1993. Recursive types are not conservative over F ≤. In International Conference on Typed Lambda calculi and Applications. Springer, 146-162.Google ScholarGoogle ScholarCross RefCross Ref
  24. Martin Hofmann and Benjamin C Pierce. 1996. Positive subtyping. Information and Computation 126, 1 ( 1996 ), 11-33.Google ScholarGoogle Scholar
  25. 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 ScholarGoogle Scholar
  26. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  27. Joseph Lee, Jonathan Aldrich, Troy Shaw, and Alex Potanin. 2015. A Theory of Tagged Objects. In European Conference on Object-Oriented Programming (ECOOP).Google ScholarGoogle Scholar
  28. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  29. Benjamin C. Pierce. 2002. Types and programming languages. MIT press.Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  31. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  32. 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 ScholarGoogle Scholar
  33. Marvin Solomon. 1978. Type definitions with parameters. In Proceedings of the 5th ACM SIGACT-SIGPLAN symposium on Principles of programming languages. 31-38.Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. 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 ScholarGoogle Scholar
  35. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  36. The Coq Development Team. 2019. Coq. https://coq.inria.frGoogle ScholarGoogle Scholar
  37. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  38. Yanpeng Yang and Bruno C. d. S. Oliveira. 2019. Pure iso-type systems. Journal of Functional Programming 29 ( 2019 ).Google ScholarGoogle Scholar

Index Terms

  1. Revisiting iso-recursive subtyping

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!