skip to main content
research-article
Public Access

On Subtyping-Relation Completeness, with an Application to Iso-Recursive Types

Published:06 March 2017Publication History
Skip Abstract Section

Abstract

Well-known techniques exist for proving the soundness of subtyping relations with respect to type safety. However, completeness has not been treated with widely applicable techniques, as far as we’re aware.

This article develops techniques for stating and proving that a subtyping relation is complete with respect to type safety and applies the techniques to the study of iso-recursive subtyping. A new proof technique, induction on failing derivations, is provided that may be useful in other domains as well.

The common subtyping rules for iso-recursive types—the “Amber rules”—are shown to be incomplete with respect to type safety. That is, there exist iso-recursive types τ1 and τ2 such that τ1 can safely be considered a subtype of τ2, but τ1 ⩽ τ2 is not derivable with the Amber rules.

New, algorithmic rules are defined for subtyping iso-recursive types, and the rules are proved sound and complete with respect to type safety. The fully implemented subtyping algorithm is optimized to run in O(mn) time, where m is the number of μ-terms in the types being considered and n is the size of the types being considered.

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. Michael Backes, Cătălin Hriţcu, and Matteo Maffei. 2011. Union and intersection types for secure protocol implementations. In Proceedings of Theory of Security and Applications (TOSCA’11). Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Henk Barendregt, Mario Coppo, and Mariangiola Dezani-Ciancaglini. 1983. A filter lambda model and the completeness of type assignment. Journal of Symbolic Logic 48, 4 (Dec. 1983), 931--940.Google ScholarGoogle ScholarCross RefCross Ref
  4. 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), 8. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Michael Brandt and Fritz Henglein. 1998. Coinductive axiomatization of recursive type equality and subtyping. Fundamenta Informaticae 33, 4 (1998), 309--338. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Luca Cardelli. 1986. Amber. In Proceedings of Combinators and Functional Programming Languages: Thirteenth Spring School of the LITP. 21--47. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Dario Colazzo and Giorgio Ghelli. 2005. Subtyping, recursion and parametric polymorphism in kernel fun. Information and Computation 198, 2 (2005), 71--147. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. William R. Cook, Walter L. 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’89). 125--135. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Mariangiola Dezani-Ciancaglini and Silvia Ghilezan. 2014. Preciseness of subtyping on intersection and union types. In Proceedings of Rewriting and Typed Lambda Calculi (RTA-TLCA’14), Gilles Dowek (Ed.). Lecture Notes in Computer Science, Vol. 8560. Springer International Publishing, 194--207.Google ScholarGoogle Scholar
  10. Alain Frisch. 2004. Théorie, Conception Et Réalisation D’un Langage De Programmation Fonctionnel Adapté à XML. Ph.D. Dissertation. Université Paris 7.Google ScholarGoogle Scholar
  11. Alain Frisch, Giuseppe Castagna, and Véronique Benzaken. 2008. Semantic subtyping: Dealing set-theoretically with function, union, intersection, and negation types. Journal of the ACM 55, 4 (Sept. 2008), 19:1--19:64. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Vladimir Gapeyev, Michael Y. Levin, and Benjamin C. Pierce. 2002. Recursive subtyping revealed. Journal of Functional Programming 12, 6 (2002), 511--548. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Nadji Gauthier and François Pottier. 2004. Numbering matters: First-order canonical forms for second-order recursive types. ACM SIGPLAN Notices 39, 9 (2004), 150--161. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Robert Harper. 2013. Practical Foundations for Programming Languages. Retrieved from http://www.cs.cmu.edu/∼rwh/plbook/ Version 1.33 of 05.07.2013, Working Draft. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Haruo Hosoya, Benjamin C. Pierce, and David N. Turner. 1998. Datatypes and Subtyping. Manuscript.Google ScholarGoogle Scholar
  16. Haruo Hosoya, Jérôme Vouillon, and Benjamin C. Pierce. 2005. Regular expression types for XML. ACM Transactions on Programming Languages and Systems 27, 1 (Jan. 2005), 46--90. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Hyeonseung Im, Keiko Nakata, and Sungwoo Park. 2013. Contractive signatures with recursive types, type parameters, and abstract types. In Proceedings of International Colloquium on Automata, Languages and Programming (ICALP’13). Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Dexter Kozen, Jens Palsberg, and Michael I. Schwartzbach. 1995. Efficient recursive subtyping. Mathematical Structures in Computer Science 5, 1 (1995), 113--125.Google ScholarGoogle ScholarCross RefCross Ref
  19. Christopher League and Zhong Shao. 1998. Formal Semantics of the FLINT Intermediate Language. Technical Report Yale-CS-TR-1171. Yale University.Google ScholarGoogle Scholar
  20. Jay Ligatti. 2016a. Induction on Failing Derivations. Technical Report PL-Sep13. Univ. of South Florida. http://www.cse.usf.edu/∼ligatti/papers/iotFdoJ.pdf.Google ScholarGoogle Scholar
  21. Jay Ligatti. 2016b. Subtyping-Algorithm Implementation. http://www.cse.usf.edu/∼ligatti/projects/completeness/sub.sml. (Feb. 2016).Google ScholarGoogle Scholar
  22. Barbara H. Liskov and Jeanette M. Wing. 1994. A behavioral notion of subtyping. ACM Transactions on Programming Languages and Systems (TOPLAS) 16 (1994), 1811--1841. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. David MacQueen, Gordon Plotkin, and Ravi Sethi. 1984. An ideal model for recursive polymorphic types. In Proceedings of the Symposium on Principles of Programming Languages (POPL’84). ACM, 165--174. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Benjamin C. Pierce. 1991. Programming with Intersection Types and Bounded Polymorphism. Ph.D. Dissertation. Carnegie Mellon University. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Benjamin C. Pierce. 2002. Types and Programming Languages. MIT Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Cees Pierik and Frank S. De Boer. 2005. On behavioral subtyping and completeness. In Proceedings of the 7th Workshop on Formal Techniques for Java-like Programs.Google ScholarGoogle Scholar
  27. Gordon D. Plotkin. 2004. A structural approach to operational semantics. Journal of Logic and Algebraic Programming 60--61 (2004), 17--139.Google ScholarGoogle Scholar
  28. Tatsurou Sekiguchi and Akinori Yonezawa. 1994. A complete type inference system for subtyped recursive types. In Proceedings of Theoretical Aspects of Computer Software (TACS’94). 667--686. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Anthony J. H. Simons. 1994. Adding Axioms to Cardelli-Wegner Subtyping. Technical Report CS-94-6. University of Sheffield.Google ScholarGoogle Scholar
  30. Anthony J. H. Simons. 2002. The theory of classification, part 4: Object types and subtyping. Journal of Object Technology 1, 5 (2002), 27--35.Google ScholarGoogle ScholarCross RefCross Ref
  31. Christopher A. Stone and Andrew P. Schoonmaker. 2005. Equational theories with recursive types. (2005). http://www.cs.hmc.edu/∼stone/papers/stone-schoonmaker-long.pdf.Google ScholarGoogle Scholar
  32. Ross Tate, Alan Leung, and Sorin Lerner. 2011. Taming wildcards in Java’s type system. In Proceedings of the 2011 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’11). Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Steffen van Bakel, Mariangiola Dezani-Ciancaglini, Ugo de'Liguoro, and Yoko Motohama. 2000. The Minimal Relevant Logic and the Call-by-Value Lambda Calculus. Technical Report TR-ARP-05-2000. The Australian National University.Google ScholarGoogle Scholar
  34. Joseph C. Vanderwaart, Derek Dreyer, Leaf Petersen, Karl Crary, Robert Harper, and Perry Cheng. 2003. Typed compilation of recursive datatypes. In Proceedings of the ACM SIGPLAN International Workshop on Types in Languages Design and Implementation (TLDI’03). Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Jérôme Vouillon. 2004. Subtyping union types. In Proceedings of the 18th International Workshop on Computer Science Logic.Google ScholarGoogle ScholarCross RefCross Ref
  36. Jérôme Vouillon. 2006. Polymorphic regular tree types and patterns. In Proceedings of the Symposium on Principles of Programming Languages (POPL’06). ACM, 103--114. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. On Subtyping-Relation Completeness, with an Application to Iso-Recursive Types

          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

          • Published in

            cover image ACM Transactions on Programming Languages and Systems
            ACM Transactions on Programming Languages and Systems  Volume 39, Issue 1
            March 2017
            156 pages
            ISSN:0164-0925
            EISSN:1558-4593
            DOI:10.1145/3050768
            Issue’s Table of Contents

            Copyright © 2017 ACM

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 6 March 2017
            • Accepted: 1 September 2016
            • Revised: 1 March 2016
            • Received: 1 August 2014
            Published in toplas Volume 39, Issue 1

            Permissions

            Request permissions about this article.

            Request Permissions

            Check for updates

            Qualifiers

            • research-article
            • Research
            • Refereed

          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!