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.
- 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 ScholarDigital Library
- 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 ScholarCross Ref
- Gilles Barthe and Maria João Frade. 1999. Constructor subtyping. In European Symposium on Programming. Springer, 109–127.Google ScholarCross Ref
- 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 ScholarCross Ref
- 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 ScholarDigital Library
- Giuseppe Castagna, Giorgio Ghelli, and Giuseppe Longo. 1995. A calculus for overloaded functions with subtyping. Information and Computation 117, 1 (1995), 115–135.Google ScholarDigital Library
- 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 ScholarCross Ref
- Thierry Coquand. 1992. Pattern matching with dependent types. In Informal proceedings of Logical Frameworks, Vol. 92. Citeseer, 66–79.Google Scholar
- 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 ScholarDigital Library
- Stephen Dolan. 2017. Algebraic subtyping. BCS, The Chartered Institute for IT.Google Scholar
- 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 Scholar
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 Scholar
- 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 ScholarCross Ref
- 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 Scholar
- 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 ScholarCross Ref
- Joachim Lambek. 1968. A Fixpoint Theorem for Complete Categories. Mathematische Zeitschrift 103, 2 (1968), 151–161. https://doi.org/10.1007/bf01110627Google ScholarCross Ref
- Zhaohui Luo. 1999. Coercive subtyping. Journal of Logic and Computation 9, 1 (1999), 105–130.Google ScholarCross Ref
- 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 Scholar
- 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 Scholar
- 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 ScholarCross Ref
- 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 ScholarCross Ref
- 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 Scholar
- Francois Rouaix. 1989. Safe run-time overloading. In Proceedings of the 17th ACM SIGPLAN-SIGACT symposium on Principles of programming languages. 355–366.Google ScholarDigital Library
- Aaron Stump. 2017. The calculus of dependent lambda eliminations. Journal of Functional Programming 27 (2017), e14.Google ScholarCross Ref
- 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 ScholarCross Ref
- Wouter Swierstra. 2008. Data types à la carte. J. Funct. Program. 18, 4 (2008), 423–436. https://doi.org/10.1017/S0956796808006758Google ScholarDigital Library
- 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 Scholar
- Tao Xue. 2013. Theory and implementation of coercive subtyping. Ph.D. Dissertation. Royal Holloway, University of London, UK.Google Scholar
Recommendations
Generic zero-cost reuse for dependent types
Dependently typed languages are well known for having a problem with code reuse. Traditional non-indexed algebraic datatypes (e.g. lists) appear alongside a plethora of indexed variations (e.g. vectors). Functions are often rewritten for both non-...
Constructor Subtyping
ESOP '99: Proceedings of the 8th European Symposium on Programming Languages and SystemsConstructor subtyping is a form of subtyping in which an inductive type σ is viewed as a subtype of another inductive type Τ if Τ has more constructors than σ. As suggested in [5,12], its (potential) uses include proof assistants and functional ...
Impredicative Encodings of (Higher) Inductive Types
LICS '18: Proceedings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer SciencePostulating an impredicative universe in dependent type theory allows System F style encodings of finitary inductive types, but these fail to satisfy the relevant η-equalities and consequently do not admit dependent eliminators. To recover η and ...
Comments