skip to main content
10.1145/3462172.3462194acmotherconferencesArticle/Chapter ViewAbstractPublication PagesiflConference Proceedingsconference-collections
research-article
Open Access

Zero-Cost Constructor Subtyping

Authors Info & Claims
Published:23 July 2021Publication History

ABSTRACT

Constructor subtyping is a form of subtyping where two inductive types can be related as long as the inductive signature of one is a subsignature of the other. To be a subsignature requires every constructor of the smaller datatype be present in the larger datatype (modulo subtyping of the constructors’ types). In this paper, we describe a method for impredicatively encoding datatype signatures in Cedille (a dependently typed programming language) that supports highly flexible constructor subtyping, with the subtyping relation given by a derived notion of type inclusion witnessed by a heterogeneously typed identity function. Specifically, the conditions under which constructor subtyping is possible between datatypes are fully independent of the order in which constructors are listed in their declarations. After examining some extended case studies, we formulate generically a sufficient condition for constructor subtyping in Cedille using our technique.

References

  1. Andreas Abel, Ralph Matthes, and Tarmo Uustalu. 2005. Iteration and coiteration schemes for higher-order and nested datatypes. Theor. Comput. Sci. 333, 1-2 (2005), 3–66. https://doi.org/10.1016/j.tcs.2004.10.017Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Stuart F. Allen, Mark Bickford, Robert L. Constable, Richard Eaton, Christoph Kreitz, Lori Lorigo, and E. Moran. 2006. Innovations in computational type theory using Nuprl. J. Applied Logic 4, 4 (2006), 428–469. https://doi.org/10.1016/j.jal.2005.10.005Google ScholarGoogle ScholarCross RefCross Ref
  3. Gilles Barthe and Maria João Frade. 1999. Constructor subtyping. In European Symposium on Programming. Springer, 109–127.Google ScholarGoogle ScholarCross RefCross Ref
  4. Gilles Barthe and Femke Van Raamsdonk. 2000. Constructor subtyping in the calculus of inductive constructions. In International Conference on Foundations of Software Science and Computation Structures. Springer, 17–34.Google ScholarGoogle ScholarCross RefCross Ref
  5. 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. 198–199.Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Giuseppe Castagna, Giorgio Ghelli, and Giuseppe Longo. 1995. A calculus for overloaded functions with subtyping. Information and Computation 117, 1 (1995), 115–135.Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Daniel KC Chan and Philip W Trinder. 1994. An object-oriented data model supporting multi-methods, multiple inheritance, and static type checking: A specification in Z. In Z User Workshop, Cambridge 1994. Springer, 297–315.Google ScholarGoogle ScholarCross RefCross Ref
  8. Thierry Coquand. 1992. Pattern matching with dependent types. In Informal proceedings of Logical Frameworks, Vol. 92. Citeseer, 66–79.Google ScholarGoogle Scholar
  9. Larry Diehl, Denis Firsov, and Aaron Stump. 2018. Generic zero-cost reuse for dependent types. Proceedings of the ACM on Programming Languages 2, ICFP(2018), 1–30.Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Stephen Dolan. 2017. Algebraic subtyping. BCS, The Chartered Institute for IT.Google ScholarGoogle Scholar
  11. Denis Firsov, Richard Blair, and Aaron Stump. 2018. Efficient Mendler-Style Lambda-Encodings in Cedille. In International Conference on Interactive Theorem Proving. Springer, 235–252.Google ScholarGoogle Scholar
  12. Alain Frisch, Giuseppe Castagna, and Véronique Benzaken. 2002. Semantic subtyping. In Proceedings 17th Annual IEEE Symposium on Logic in Computer Science. IEEE, 137–146.Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. 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 (JACM) 55, 4 (2008), 1–64.Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Herman Geuvers. 2001. Induction Is Not Derivable in Second Order Dependent Type Theory. In International Conference on Typed Lambda Calculi and Applications, Samson Abramsky (Ed.). Springer, Berlin, Heidelberg, 166–181.Google ScholarGoogle Scholar
  15. Ralf Hinze. 2002. Polytypic values possess polykinded types. Sci. Comput. Program. 43, 2-3 (2002), 129–159. https://doi.org/10.1016/S0167-6423(02)00025-4Google ScholarGoogle ScholarCross RefCross Ref
  16. Christopher Jenkins and Aaron Stump. 2020. Monotone recursive types and recursive data representations in Cedille. arxiv:2001.02828 [cs.PL] Under consideration for publication in J. Mathematically Structured Computer Science.Google ScholarGoogle Scholar
  17. Alexei Kopylov. 2003. Dependent Intersection: A New Way of Defining Records in Type Theory. In Proceedings of the 18th Annual IEEE Symposium on Logic in Computer Science(LICS ’03). IEEE Computer Society, Washington, DC, USA, 86–.Google ScholarGoogle ScholarCross RefCross Ref
  18. Joachim Lambek. 1968. A Fixpoint Theorem for Complete Categories. Mathematische Zeitschrift 103, 2 (1968), 151–161. https://doi.org/10.1007/bf01110627Google ScholarGoogle ScholarCross RefCross Ref
  19. Zhaohui Luo. 1999. Coercive subtyping. Journal of Logic and Computation 9, 1 (1999), 105–130.Google ScholarGoogle ScholarCross RefCross Ref
  20. Ralph Matthes. 1998. Monotone Fixed-Point Types and Strong Normalization. In Computer Science Logic, 12th International Workshop, CSL ’98, Annual Conference of the EACSL, Brno, Czech Republic, August 24-28, 1998, Proceedings(Lecture Notes in Computer Science, Vol. 1584), Georg Gottlob, Etienne Grandjean, and Katrin Seyr (Eds.). Springer, 298–312. https://doi.org/10.1007/10703163_20Google ScholarGoogle Scholar
  21. N. P. Mendler. 1987. Recursive Types and Type Constraints in Second-Order Lambda Calculus. In Proceedings of the Symposium on Logic in Computer Science((LICS ’87)). IEEE Computer Society, Los Alamitos, CA, 30–36.Google ScholarGoogle Scholar
  22. Nax Paul Mendler. 1991. Inductive types and type constraints in the second-order lambda calculus. Annals of Pure and Applied Logic 51, 1 (1991), 159 – 172. https://doi.org/10.1016/0168-0072(91)90069-XGoogle ScholarGoogle ScholarCross RefCross Ref
  23. Alexandre Miquel. 2001. The Implicit Calculus of Constructions: Extending Pure Type Systems with an Intersection Type Binder and Subtyping. In Proceedings of the 5th International Conference on Typed Lambda Calculi and Applications (Kraków, Poland) (TLCA’01). Springer-Verlag, Berlin, Heidelberg, 344–359.Google ScholarGoogle ScholarCross RefCross Ref
  24. Talia Ringer, Nathaniel Yazdani, John Leo, and Dan Grossman. 2019. Ornaments for proof reuse in Coq. In 10th International Conference on Interactive Theorem Proving (ITP 2019). Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik.Google ScholarGoogle Scholar
  25. Francois Rouaix. 1989. Safe run-time overloading. In Proceedings of the 17th ACM SIGPLAN-SIGACT symposium on Principles of programming languages. 355–366.Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Aaron Stump. 2017. The calculus of dependent lambda eliminations. Journal of Functional Programming 27 (2017), e14.Google ScholarGoogle ScholarCross RefCross Ref
  27. Aaron Stump. 2018. From realizability to induction via dependent intersection. Ann. Pure Appl. Logic 169, 7 (2018), 637–655. https://doi.org/10.1016/j.apal.2018.03.002Google ScholarGoogle ScholarCross RefCross Ref
  28. Wouter Swierstra. 2008. Data types à la carte. J. Funct. Program. 18, 4 (2008), 423–436. https://doi.org/10.1017/S0956796808006758Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Tarmo Uustalu and Varmo Vene. 1999. Mendler-style Inductive Types, Categorically. Nordic Journal of Computing 6, 3 (Sep 1999), 343–361. http://dl.acm.org/citation.cfm?id=774455.774462Google ScholarGoogle Scholar
  30. Tao Xue. 2013. Theory and implementation of coercive subtyping. Ph.D. Dissertation. Royal Holloway, University of London, UK.Google ScholarGoogle Scholar

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
  • Published in

    cover image ACM Other conferences
    IFL '20: Proceedings of the 32nd Symposium on Implementation and Application of Functional Languages
    September 2020
    161 pages
    ISBN:9781450389631
    DOI:10.1145/3462172

    Copyright © 2020 ACM

    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    • Published: 23 July 2021

    Permissions

    Request permissions about this article.

    Request Permissions

    Check for updates

    Qualifiers

    • research-article
    • Research
    • Refereed limited

    Acceptance Rates

    Overall Acceptance Rate19of36submissions,53%
  • Article Metrics

    • Downloads (Last 12 months)51
    • Downloads (Last 6 weeks)3

    Other Metrics

PDF Format

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader