Abstract
We consider a type algebra equipped with recursive, product, function, intersection, union, and complement types together with type variables and implicit universal quantification over them. We consider the subtyping relation recently defined by Castagna and Xu over such type expressions and show how this relation can be decided in EXPTIME, answering an open question. The novelty, originality and strength of our solution reside in introducing a logical modeling for the semantic subtyping framework. We model semantic subtyping in a tree logic and use a satisfiability-testing algorithm in order to decide subtyping. We report on practical experiments made with a full implementation of the system. This provides a powerful polymorphic type system aiming at maintaining full static type-safety of functional programs that manipulate trees, even with higher-order functions, which is particularly useful in the context of XML.
Supplemental Material
- M. Benedikt and J. Cheney. Destabilizers and independence of XML updates. Proceedings of the VLDB Endowment, 3 (1): 906--917, 2010. Google Scholar
Digital Library
- V. Benzaken, G. Castagna, and A. Frisch. CDuce: an XML-centric general-purpose language. In Proceedings of the 8th international conference on functional programming (ICFP '03), pages 51--63, Uppsala, Sweden, 2003. http://doi.acm.org/10.1145/944705.944711. Google Scholar
Digital Library
- G. M. Bierman, A. D. Gordon, C. Hriţcu, and D. Langworthy. Semantic subtyping with an SMT solver. In Proceedings of the 15th international conference on functional programming (ICFP '10), pages 105--116, Baltimore, MD, USA, 2010. http://doi.acm.org/10.1145/1863543.1863560. Google Scholar
Digital Library
- S. Boag, D. Chamberlin, M. F. Fernández, D. Florescu, J. Robie, and J. Siméon. XQuery 1.0: An XML query language, W3C recommendation, 2007.Google Scholar
- G. Castagna and Z. Xu. Set-theoretic foundation of parametric polymorphism and subtyping. In Proceedings of the 16th international conference on functional programming (ICFP '11), Tokyo, 2011. Google Scholar
Digital Library
- J. Clark and S. DeRose. XML path language (XPath) version 1.0, W3C recommendation, 1999. http://www.w3.org/TR/1999/REC-xpath-19991116.Google Scholar
- L. M. de Moura and N. Bjørner. Z3: An efficient SMT solver. In Proceedings of the 14th international conference on tools and algorithms for the construction and analysis of systems (TACAS '08), pages 337--340, Budapest, 2008. http://dx.doi.org/10.1007/978-3-540-78800-3_24. Google Scholar
Digital Library
- D. Engovatov and J. Robie. XQuery 3.0 requirements, W3C working draft, 2010. http://www.w3.org/TR/xquery-30-requirementsGoogle Scholar
- A. Frisch, G. Castagna, and V. Benzaken. Semantic subtyping: dealing set-theoretically with function, union, intersection, and negation types. Journal of the ACM, 55 (4): 1--64, 2008. Google Scholar
Digital Library
- P. Genevès, N. Layaïda, and A. Schmitt. Efficient static analysis of XML paths and types. In Proceedings of the 28th conference on programming language design and implementation (PLDI '07), pages 342--351, San Diego, CA, USA, 2007. http://doi.acm.org/10.1145/1250734.1250773. Google Scholar
Digital Library
- H. Hosoya and B. C. Pierce. XDuce: A statically typed XML processing language. ACM Transactions on Internet Technology, 3 (2): 117--148, 2003. http://doi.acm.org/10.1145/767193.767195. Google Scholar
Digital Library
- H. Hosoya, J. Vouillon, and B. C. Pierce. Regular expression types for XML. ACM Transactions on Programming Languages and Systems, 27: 46--90, 2005. http://doi.acm.org/10.1145/1053468.1053470. Google Scholar
Digital Library
- H. Hosoya, A. Frisch, and G. Castagna. Parametric polymorphism for XML. ACM Transactions on Programming Languages and Systems, 32 (1): 1--56, 2009. Google Scholar
Digital Library
- J. C. Reynolds. Types, abstraction and parametric polymorphism. In IFIP Congress, pages 513--523, 1983.Google Scholar
- J. Vouillon. Polymorphic regular tree types and patterns. In Proceedings of the 33rd symposium on principles of programming languages (POPL '06), pages 103--114, Charleston, SC, USA, 2006. http://doi.acm.org/10.1145/1111037.1111047. Google Scholar
Digital Library
- P. Wadler. Theorems for free! In Proceedings of the 4th international conference on functional programming languages and computer architecture (FPCA '89), pages 347--359, London, 1989. http://doi.acm.org/10.1145/99370.99404. Google Scholar
Digital Library
Index Terms
Parametric polymorphism and semantic subtyping: the logical connection
Recommendations
Parametric polymorphism and semantic subtyping: the logical connection
ICFP '11: Proceedings of the 16th ACM SIGPLAN international conference on Functional programmingWe consider a type algebra equipped with recursive, product, function, intersection, union, and complement types together with type variables and implicit universal quantification over them. We consider the subtyping relation recently defined by ...
Polymorphism, subtyping, and type inference in MLsub
POPL '17: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming LanguagesWe present a type system combining subtyping and ML-style parametric polymorphism. Unlike previous work, our system supports type inference and has compact principal types. We demonstrate this system in the minimal language MLsub, which types a strict ...
Polymorphism, subtyping, and type inference in MLsub
POPL '17We present a type system combining subtyping and ML-style parametric polymorphism. Unlike previous work, our system supports type inference and has compact principal types. We demonstrate this system in the minimal language MLsub, which types a strict ...







Comments