Parametricity for Primitive Nested Types
Open Access
- 23 March 2021
- book chapter
- Published by Springer Nature
- Vol. 12650, 324-343
Abstract
This 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.Keywords
This publication has 21 references indexed in Scilit:
- Bifibrational Functorial Semantics of Parametric PolymorphismElectronic Notes in Theoretical Computer Science, 2015
- Categorical models for Abadi and Plotkin's logic for parametricityMathematical Structures in Computer Science, 2005
- Parametric limits2004
- A Generalization of Short-Cut Fusion and its Correctness ProofHigher-Order and Symbolic Computation, 2002
- Generalised folds for nested datatypesFormal Aspects of Computing, 1999
- Nested datatypes1998
- Locally Presentable and Accessible Categories1994
- Categorical data types in parametric polymorphismMathematical Structures in Computer Science, 1994
- A short cut to deforestation1993
- Functorial polymorphismTheoretical Computer Science, 1990