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.
- 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
- 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 Scholar
Digital Library
- 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 Scholar
Cross Ref
- 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 Scholar
Digital Library
- Michael Brandt and Fritz Henglein. 1998. Coinductive axiomatization of recursive type equality and subtyping. Fundamenta Informaticae 33, 4 (1998), 309--338. Google Scholar
Digital Library
- Luca Cardelli. 1986. Amber. In Proceedings of Combinators and Functional Programming Languages: Thirteenth Spring School of the LITP. 21--47. Google Scholar
Digital Library
- Dario Colazzo and Giorgio Ghelli. 2005. Subtyping, recursion and parametric polymorphism in kernel fun. Information and Computation 198, 2 (2005), 71--147. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- Alain Frisch. 2004. Théorie, Conception Et Réalisation D’un Langage De Programmation Fonctionnel Adapté à XML. Ph.D. Dissertation. Université Paris 7.Google Scholar
- 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 Scholar
Digital Library
- Vladimir Gapeyev, Michael Y. Levin, and Benjamin C. Pierce. 2002. Recursive subtyping revealed. Journal of Functional Programming 12, 6 (2002), 511--548. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Haruo Hosoya, Benjamin C. Pierce, and David N. Turner. 1998. Datatypes and Subtyping. Manuscript.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Dexter Kozen, Jens Palsberg, and Michael I. Schwartzbach. 1995. Efficient recursive subtyping. Mathematical Structures in Computer Science 5, 1 (1995), 113--125.Google Scholar
Cross Ref
- Christopher League and Zhong Shao. 1998. Formal Semantics of the FLINT Intermediate Language. Technical Report Yale-CS-TR-1171. Yale University.Google Scholar
- 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 Scholar
- Jay Ligatti. 2016b. Subtyping-Algorithm Implementation. http://www.cse.usf.edu/∼ligatti/projects/completeness/sub.sml. (Feb. 2016).Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Benjamin C. Pierce. 1991. Programming with Intersection Types and Bounded Polymorphism. Ph.D. Dissertation. Carnegie Mellon University. Google Scholar
Digital Library
- Benjamin C. Pierce. 2002. Types and Programming Languages. MIT Press. Google Scholar
Digital Library
- 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 Scholar
- Gordon D. Plotkin. 2004. A structural approach to operational semantics. Journal of Logic and Algebraic Programming 60--61 (2004), 17--139.Google Scholar
- 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 Scholar
Digital Library
- Anthony J. H. Simons. 1994. Adding Axioms to Cardelli-Wegner Subtyping. Technical Report CS-94-6. University of Sheffield.Google Scholar
- 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 Scholar
Cross Ref
- 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 Scholar
- 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 Scholar
Digital Library
- 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 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 ACM SIGPLAN International Workshop on Types in Languages Design and Implementation (TLDI’03). Google Scholar
Digital Library
- Jérôme Vouillon. 2004. Subtyping union types. In Proceedings of the 18th International Workshop on Computer Science Logic.Google Scholar
Cross Ref
- 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 Scholar
Digital Library
Index Terms
On Subtyping-Relation Completeness, with an Application to Iso-Recursive Types
Recommendations
Unifying typing and subtyping
In recent years dependent types have become a hot topic in programming language research. A key reason why dependent types are interesting is that they allow unifying types and terms, which enables both additional expressiveness and economy of concepts. ...
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 ...
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