Abstract
AbstractThis paper considers parametricity and its resulting free theorems for nested data types. Rather than representing nested types via their Church encodings in a higher-kinded or dependently typed extension of System F, we adopt a functional programming perspective and design a Hindley-Milner-style calculus with primitives for constructing nested types directly as fixpoints. Our calculus can express all nested types appearing in the literature, including truly nested types. At the term level, it supports primitive pattern matching, map functions, and fold combinators for nested types. Our main contribution is the construction of a parametric model for our calculus. This is both delicate and challenging: to ensure the existence of semantic fixpoints interpreting nested types, and thus to establish a suitable Identity Extension Lemma for our calculus, our type system must explicitly track functoriality of types, and cocontinuity conditions on the functors interpreting them must be appropriately threaded throughout the model construction. We prove that our model satisfies an appropriate Abstraction Theorem and verifies all standard consequences of parametricity for primitive nested types.
Publisher
Springer International Publishing
Reference27 articles.
1. Adámek, J., Rosický, J.: Locally Presentable and Accessible Categories. Cambridge University Press (1994)
2. Atkey, R.: Relational Parametricity for Higher Kinds. In: Computer Science Logic, pp. 46–61. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik (2012)
3. Bainbridge, E. S., Freyd, P. J., Scedrov, A., Scott, P. J.: Functorial Polymorphism. Theoretical Computer Science 70, 35–64 (1990)
4. Bird, R., Meertens, L.: Nested datatypes. In: Mathematics of Program Construction, pp. 52–67. Springer (1998)
5. Bird, R., Paterson, R.: Generalised folds for nested datatypes. Formal Aspects of Computing 11, 200–222 (1999)
Cited by
5 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. GADTs are not (Even partial) functors;Mathematical Structures in Computer Science;2024-08-27
2. Types and Semantics for Extensible Data Types;Programming Languages and Systems;2023
3. GADTs, Functoriality, Parametricity: Pick Two;Electronic Proceedings in Theoretical Computer Science;2022-04-08
4. (Deep) induction rules for GADTs;Proceedings of the 11th ACM SIGPLAN International Conference on Certified Programs and Proofs;2022-01-11
5. Parametricity for Nested Types and GADTs;Logical Methods in Computer Science;2021-12-23