skip to main content
research-article
Free Access

A Logical Approach to Deciding Semantic Subtyping

Published:16 October 2015Publication History
Skip Abstract Section

Abstract

We consider a type algebra equipped with recursive, product, function, intersection, union, and complement types, together with type variables. We consider the subtyping relation defined by Castagna and Xu [2011] 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.

References

  1. Michael Benedikt and James Cheney. 2010. Destabilizers and independence of XML updates. Proceedings of the VLDB Endowment 3, 1, 906--917. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Véronique Benzaken, Giuseppe Castagna, and Alain Frisch. 2003. CDuce: An XML-centric general-purpose language. In Proceedings of the 8th International Conference on Functional Programming (ICFP’03). Uppsala, Sweden, 51--63. http://doi.acm.org/10.1145/944705.944711 Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Gavin M. Bierman, Andrew D. Gordon, Cătălin Hriţcu, and David Langworthy. 2010. Semantic subtyping with an SMT solver. In Proceedings of the 15th International Conference on Functional Programming (ICFP’10). Baltimore, MD, 105--116. http://doi.acm.org/10.1145/1863543.1863560 Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Scott Boag, Don Chamberlin, Mary F. Fernández, Daniela Florescu, Jonathan Robie, and Jérôme Siméon. 2007. XQuery 1.0: An XML Query Language, W3C Recommendation.Google ScholarGoogle Scholar
  5. Randal E. Bryant. 1986. Graph-based algorithms for Boolean function manipulation. IEEE Transactions on Computers 35, 8, 677--691. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Cristiano Calcagno, Luca Cardelli, and Andrew D. Gordon. 2005. Deciding validity in a spatial logic for trees. Journal of Functional Programming 15, 4, 543--572. DOI:http://dx.doi.org/10.1017/S0956796804005404 Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Luca Cardelli and Andrew D. Gordon. 2000. Anytime, anywhere: Modal logics for mobile ambients. In Proceedings of the 27th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’00). ACM, New York, NY, 365--377. DOI:http://dx.doi.org/10.1145/325694.325742 Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Giuseppe Castagna and Zhiwu Xu. 2011. Set-theoretic foundation of parametric polymorphism and subtyping. In Proceedings of the 16th ACM SIGPLAN International Conference on Functional Programming (ICFP’11). ACM, Tokyo, 94--106. DOI:http://dx.doi.org/10.1145/2034773.2034788 Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. James Clark and Steve DeRose. 1999. XML Path Language (XPath) Version 1.0, W3C Recommendation. Retrieved August 31, 2015 from http://www.w3.org/TR/1999/REC-xpath-19991116.Google ScholarGoogle Scholar
  10. Edmund M. Clarke Jr., Orna Grumberg, and Doron A. Peled. 1999. Model Checking. MIT Press, Cambridge, MA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Leonardo Mendonça de Moura and Nikolaj Bjørner. 2008. 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). Budapest, 337--340. http://dx.doi.org/10.1007/978-3-540-78800-3_24. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. A. Frisch, G. Castagna, and V. Benzaken. 2008. Semantic subtyping: Dealing set-theoretically with function, union, intersection, and negation types. Journal of the ACM 55, 4, 1--64. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Pierre Genevès. 2006. Logics for XML. Ph.D. Dissertation. Institut National Polytechnique de Grenoble. Retrieved August 31, 2015 from http://wam.inrialpes.fr/publications/2006/geneves-phd.pdf.Google ScholarGoogle Scholar
  14. Pierre Genevès, Nabil Layaïda, and Vincent Quint. 2009. Identifying query incompatibilities with evolving XML schemas. In Proceedings of the 14th ACM SIGPLAN International Conference on Functional Programming (ICFP’09). ACM, New York, NY, 221--230. DOI:http://dx.doi.org/10.1145/1596550.1596583 Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Pierre Genevès, Nabil Layaïda, and Alan Schmitt. 2007. Efficient static analysis of XML paths and types. In Proceedings of the 28th Conference on Programming Language Design and iImplementation (PLDI’07). San Diego, CA, 342--351. http://doi.acm.org/10.1145/1250734.1250773 Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Pierre Genevès, Nabil Layaïda, Alan Schmitt, and Nils Gesbert. 2015. Efficiently deciding μ-calculus with converse over finite trees. ACM Transactions on Computational Logic 16, 2, 16:1--16:41. DOI:http://dx.doi.org/10.1145/2724712 Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Nils Gesbert, Pierre Genevès, and Nabil Layaïda. 2011. Parametric polymorphism and semantic subtyping: The logical connection. In Proceedings of the 16th ACM SIGPLAN International Conference on Functional Programming (ICFP’11). ACM, Tokyo, 107--116. DOI:http://dx.doi.org/10.1145/2034773.2034789 Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. H. Hosoya, A. Frisch, and G. Castagna. 2009. Parametric polymorphism for XML. ACM Transactions on Programming Languages and Systems 32, 1, 1--56. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Haruo Hosoya and Benjamin C. Pierce. 2003. XDuce: A statically typed XML processing language. ACM Transactions on Internet Technology 3, 2, 117--148. http://doi.acm.org/10.1145/767193.767195 Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. 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, 46--90. http://doi.acm.org/10.1145/1053468.1053470. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Gérard P. Huet. 1997. The zipper. Journal of Functional Programming 7, 5, 549--554. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Barbara Liskov and Jeannette M. Wing. 1994. A behavioral notion of subtyping. ACM Transactions on Programming Languages and Systems 16, 6, 1811--1841. DOI:http://dx.doi.org/10.1145/197320.197383 Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. R. Milner, L. Morris, and M. Newey. 1975. A logic for computable functions with reflexive and polymorphic types. In Conference on Proving and Improving Programs, Arc-et-Senans, France. IRIA-Laboria, 78150 Le Chesnay, France, 371--394.Google ScholarGoogle Scholar
  24. Guoqiang Pan, Ulrike Sattler, and Moshe Y. Vardi. 2006. BDD-based decision procedures for the modal logic K. Journal of Applied Non-classical Logics 16, 1--2, 169--208.Google ScholarGoogle ScholarCross RefCross Ref
  25. John C. Reynolds. 1983. Types, abstraction and parametric polymorphism. In IFIP Congress. 513--523.Google ScholarGoogle Scholar
  26. Jonathan Robie, Don Chamberlin, Michael Dyck, and John Snelson. 2014. XQuery 3.0: An XML Query Language, W3C Recommendation. Retrieved August 31, 2015 from http://www.w3.org/TR/xquery-30/.Google ScholarGoogle Scholar
  27. Jérôme Vouillon. 2006. Polymorphic regular tree types and patterns. In Proceedings of the 33rd Symposium on Principles of Programming Languages (POPL’06). 103--114. http://doi.acm.org/10.1145/1111037.1111047. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A Logical Approach to Deciding Semantic Subtyping

      Recommendations

      Reviews

      Richard John Botting

      Although object-oriented subtyping has been efficiently resolved by compilers for years, this paper shows how subtyping in Extensible Markup Language (XML)-centric functional languages can be done with a SAT solver. It gives a tested formal specification for an efficient algorithm if such exists. The paper is the result of a decade of research, which is documented in the references. It will mainly interest graduate students and professors working in type theory and logic. A SAT solver is a subprogram that either finds values for variables in a logical formula that satisfy it (make it true) or reports that they don't exist. The worst-case time for all known SAT solvers grows exponentially with the size of the formula. The author's paradigm is: 1) clearly define the property; 2) encode the property as a logical formula; 3) tune the formula; and 4) use a SAT solver on the formula. These steps are applied to testing if one LISP-like data type is a subtype of another one. The paper uses semantic subtyping. This is where one type is defined to be a subtype of another if all data of one type are elements of the other type. The types include function types, types defined by parametric (not object-oriented) polymorphism, and types defined by recursion. The authors' logical model handles all of these. The resulting software has been tested and works well. They show that it has the same complexity as the SAT solver used. Online Computing Reviews Service

      Access critical reviews of Computing literature here

      Become a reviewer for Computing Reviews.

      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 38, Issue 1
        October 2015
        88 pages
        ISSN:0164-0925
        EISSN:1558-4593
        DOI:10.1145/2836326
        Issue’s Table of Contents

        Copyright © 2015 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 16 October 2015
        • Accepted: 1 August 2015
        • Received: 1 April 2015
        Published in toplas Volume 38, 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!