Hostname: page-component-8448b6f56d-xtgtn Total loading time: 0 Render date: 2024-04-18T18:52:24.243Z Has data issue: false hasContentIssue false

Monotone recursive types and recursive data representations in Cedille

Published online by Cambridge University Press:  10 December 2021

Christopher Jenkins*
Affiliation:
Computer Science, 14 MacLean Hall, The University of Iowa, Iowa City, IA, USA
Aaron Stump
Affiliation:
Computer Science, 14 MacLean Hall, The University of Iowa, Iowa City, IA, USA
*
*Corresponding author. Email: christopher-jenkins@uiowa.edu
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

Guided by Tarksi’s fixpoint theorem in order theory, we show how to derive monotone recursive types with constant-time roll and unroll operations within Cedille, an impredicative, constructive, and logically consistent pure typed lambda calculus. This derivation takes place within the preorder on Cedille types induced by type inclusions, a notion which is expressible within the theory itself. As applications, we use monotone recursive types to generically derive two recursive representations of data in lambda calculus, the Parigot and Scott encoding. For both encodings, we prove induction and examine the computational and extensional properties of their destructor, iterator, and primitive recursor in Cedille. For our Scott encoding in particular, we translate into Cedille a construction due to Lepigre and Raffalli (2019) that equips Scott naturals with primitive recursion, then extend this construction to derive a generic induction principle. This allows us to give efficient and provably unique (up to function extensionality) solutions for the iteration and primitive recursion schemes for Scott-encoded data.

Type
Paper
Creative Commons
Creative Common License - CCCreative Common License - BY
This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted re-use, distribution, and reproduction in any medium, provided the original work is properly cited.
Copyright
© The Author(s), 2021. Published by Cambridge University Press

References

Abadi, M., Cardelli, L. and Plotkin, G. (1993). Types for the Scott numerals. Unpublished note.Google Scholar
Abbott, M. G., Altenkirch, T. and Ghani, N. (2003). Categories of containers. In: Gordon, A. D. (ed.), Foundations of Software Science and Computational Structures, 6th International Conference, FOSSACS 2003 Held as Part of the Joint European Conference on Theory and Practice of Software, ETAPS 2003, Warsaw, Poland, April 7-11, 2003, Proceedings, vol. 2620. Lecture Notes in Computer Science. Springer, 23–38.CrossRefGoogle Scholar
Abel, A. (2010). MiniAgda: Integrating sized and dependent types. In: Komendantskaya, E., Bove, A. and Niqui, M. (eds.) Partiality and Recursion in Interactive Theorem Provers, PAR@ITP 2010, Edinburgh, UK, July 15, 2010, vol. 5. EPiC Series. EasyChair, 18–33.Google Scholar
Abel, A., Matthes, R. and Uustalu, T. (2005). Iteration and coiteration schemes for higher-order and nested datatypes. Theoretical Computer Science 333 (1–2) 366.CrossRefGoogle Scholar
Allen, S. F., Bickford, M., Constable, R. L., Eaton, R., Kreitz, C., Lorigo, L. and Moran, E. (2006). Innovations in computational type theory using Nuprl. Journal of Applied Logic 4 (4) 428469.CrossRefGoogle Scholar
Atkey, R. (2018). Syntax and semantics of quantitative type theory. In: Dawar, A. and Grädel, E. (eds.), Proceedings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2018, Oxford, UK, July 09–12, 2018. ACM, 56–65.CrossRefGoogle Scholar
Barendregt, H. P., Dekkers, W. and Statman, R. (2013). Lambda Calculus with Types . Perspectives in Logic. Cambridge University Press.Google Scholar
Bird, R. S. and Meertens, L. G. L. T. (1998). Nested datatypes. In: Mathematics of Program Construction, MPC’98, Marstrand, Sweden, June 15-17, 1998, Proceedings, 52–67.CrossRefGoogle Scholar
Breitner, J., Eisenberg, R. A., Jones, S. P. and Weirich, S. (2016). Safe zero-cost coercions for Haskell. Journal of Functional Programming 26 e15.CrossRefGoogle Scholar
Böhm, C., Dezani-Ciancaglini, M., Peretti, P. and Rocca, S. D. (1979). A discrimination algorithm inside λ-β-calculus. Theoretical Computer Science 8(3) 271291.Google Scholar
Crary, K., Harper, R. and Puri, S. (1999). What is a Recursive Module? In: Proceedings of the ACM SIGPLAN 1999 Conference on Programming Language Design and Implementation (PLDI), New York, NY, USA, ACM, 50–63.CrossRefGoogle Scholar
Dybjer, P. and Palmgren, E. (2016). Intuitionistic type theory. In: E. N. Zalta (ed.), The Stanford Encyclopedia of Philosophy. Metaphysics Research Lab, Stanford University, winter 2016 edition.Google Scholar
Firsov, D., Blair, R. and Stump, A. (2018). Efficient Mendler-Style Lambda-Encodings in Cedille. In: Avigad, J. and Mahboubi, A. (eds.), Interactive Theorem Proving - 9th International Conference, ITP 2018, Held as Part of the Federated Logic Conference, FloC 2018, Oxford, UK, July 9-12, 2018, Proceedings, vol. 10895. Lecture Notes in Computer Science. Springer, 235–252.CrossRefGoogle Scholar
Firsov, D. and Stump, A. (2018). Generic derivation of induction for impredicative encodings in cedille. In: Andronick, J. and Felty, A. P. (eds.), Proceedings of the 7th ACM SIGPLAN International Conference on Certified Programs and Proofs, CPP 2018, Los Angeles, CA, USA, January 8-9, 2018. ACM, 215–227.Google Scholar
Geuvers, H. (1992). Inductive and coinductive types with iteration and recursion. In: Proceedings of the 1992 Workshop on Types for Proofs and Programs, Bastad. Bastad, Chalmers University of Technology, 183–207.Google Scholar
Geuvers, H. (2001). Induction is not derivable in second order dependent type theory. In: Abramsky, S. (ed.), Typed Lambda Calculi and Applications (TLCA), vol. 2044. Lecture Notes in Computer Science. Springer, 166–181.CrossRefGoogle Scholar
Geuvers, H. (2014). The Church-Scott representation of inductive and coinductive data. Unpublished manuscript.Google Scholar
Ghani, N., Johann, P. and Fumex, C. (2012). Generic fibrational induction. Logical Methods in Computer Science 8 (2).CrossRefGoogle Scholar
Kleene, S. (1965). Classical extensions of intuitionistic mathematics. In: Bar-Hillel, Y. (ed.), LMPS 2. North-Holland Publishing Company, 31–44.Google Scholar
Kopylov, A. (2003). Dependent intersection: A new way of defining records in type theory. In: 18th IEEE Symposium on Logic in Computer Science (LICS), 86–95.CrossRefGoogle Scholar
Lambek, J. (1968). A fixpoint theorem for complete categories. Mathematische Zeitschrift 103 (2) 151161.CrossRefGoogle Scholar
Lassez, J.-L., Nguyen, V. and Sonenberg, E. (1982). Fixed point theorems and semantics: A folk tale. Information Processing Letters 14 (3) 112116.CrossRefGoogle Scholar
Leivant, D. (1983). Reasoning about functional programs and complexity classes associated with type disciplines. In: 24th Annual Symposium on Foundations of Computer Science (FOCS). IEEE Computer Society, 460–469.CrossRefGoogle Scholar
Lepigre, R. and Raffalli, C. (2019). Practical subtyping for Curry-style languages. ACM Transactions on Programming Languages and Systems 41 (1) 5:15:58.CrossRefGoogle Scholar
Matthes, R. (1999). Monotone fixed-point types and strong normalization. In: Gottlob, G., Grandjean, E. and Seyr, K. (eds.), Computer Science Logic, 12th International Workshop, CSL ’98, Annual Conference of the EACSL, Brno, Czech Republic, August 24-28, 1998, Proceedings, vol. 1584. Lecture Notes in Computer Science. Springer, 298–312.CrossRefGoogle Scholar
Matthes, R. (2002). Tarski’s fixed-point theorem and lambda calculi with monotone inductive types. Synthese 133 (1–2) 107129.CrossRefGoogle Scholar
The Coq Development Team. (2018). The Coq proof assistant reference manual. LogiCal Project. Version 8.7.2.Google Scholar
Mendler, N. P. (1991). Predictive type universes and primitive recursion. In: [1991] Proceedings Sixth Annual IEEE Symposium on Logic in Computer Science, 173–184.CrossRefGoogle Scholar
Miquel, A. (2001). The implicit calculus of constructions extending pure type systems with an intersection type binder and subtyping. In: Abramsky, S. (ed.), Typed Lambda Calculi and Applications, vol. 2044. Lecture Notes in Computer Science. Springer, 344–359.CrossRefGoogle Scholar
Parigot, M. (1988). Programming with proofs: a second order type theory. In: Ganzinger, H. (ed.), European Symposium on Programming (ESOP), vol. 300. Lecture Notes in Computer Science. Springer, 145–159.CrossRefGoogle Scholar
Parigot, M. (1989). On the representation of data in lambda-calculus. In Börger, E., Büning, H. and Richter, M. (eds.), Computer Science Logic (CSL), vol. 440. Lecture Notes in Computer Science. Springer, 309–321.Google Scholar
Parigot, M. (1992). Recursive programming with proofs. Theoretical Computer Science 94 (2) 335356.CrossRefGoogle Scholar
Pierce, B. C. (2002). Types and Programming Languages. MIT Press.Google Scholar
Pierce, B. C. and Turner, D. N. (2000). Local type inference. ACM Transactions on Programming Languages and Systems 22 (1) 144.CrossRefGoogle Scholar
Santocanale, L. (2002). A calculus of circular proofs and its categorical semantics. In: Nielsen, M. and Engberg, U. (eds.), Foundations of Software Science and Computation Structures, 5th International Conference, FOSSACS 2002. Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2002 Grenoble, France, April 8-12, 2002, Proceedings, vol. 2303. Lecture Notes in Computer Science. Springer, 357–371.CrossRefGoogle Scholar
Scott, D. (1962). A system of functional abstraction. Lectures delivered at University of California, Berkeley.Google Scholar
Sørensen, M. H. and Urzyczyn, P. (2006). Lectures on the Curry-Howard Isomorphism, Vol. 149 (Studies in Logic and the Foundations of Mathematics). Elsevier Science Inc., New York, NY, USA.Google Scholar
Splawski, Z. and Urzyczyn, P. (1999). Type fixpoints: Iteration vs. recursion. In: Rémy, D. and Lee, P. (eds.), Proceedings of the Fourth ACM SIGPLAN International Conference on Functional Programming (ICFP 1999), Paris, France, September 27-29, 1999. ACM, 102–113.Google Scholar
Stump, A. (2017). The calculus of dependent lambda eliminations. Journal of Functional Programming 27 e14.CrossRefGoogle Scholar
Stump, A. (2018a). From realizability to induction via dependent intersection. Annals of Pure and Applied Logic 169 (7) 637655.CrossRefGoogle Scholar
Stump, A. (2018b). Syntax and typing for Cedille core. CoRR, abs/1811.01318.Google Scholar
Stump, A. and Fu, P. (2016). Efficiency of lambda-encodings in total type theory. Journal of Functional Programming 26 e3.CrossRefGoogle Scholar
Stump, A. and Jenkins, C. (2021). Syntax and semantics of Cedille. CoRR, abs/1806.04709.Google Scholar
Tarski, A. (1955). A lattice-theoretical fixpoint theorem and its applications. Pacific Journal of Mathematics 5 (2) 285309.CrossRefGoogle Scholar
The Agda Team. (2021). The Agda standard library, v1.5. https://github.com/agda/agda-stdlibhttps://github.com/agda/agda-stdlib.Google Scholar
Ullrich, M. (2020). Generating induction principles for nested inductive types in MetaCoq. Bachelor’s thesis.Google Scholar
Uustalu, T. and Vene, V. (1999). Primitive (co)recursion and course-of-value (co)iteration, categorically. Informatica 10 (1) 526.Google Scholar
Wadler, P. (1990). Recursive types for free! Unpublished manuscript.Google Scholar