Skip to main content
Top
Published in:
Cover of the book

Open Access 2021 | OriginalPaper | Chapter

Parametricity for Primitive Nested Types

Authors : Patricia Johann, Enrico Ghiorzi, Daniel Jeffries

Published in: Foundations of Software Science and Computation Structures

Publisher: Springer International Publishing

loading …

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.

Metadata
Title
Parametricity for Primitive Nested Types
Authors
Patricia Johann
Enrico Ghiorzi
Daniel Jeffries
Copyright Year
2021
DOI
https://doi.org/10.1007/978-3-030-71995-1_17

Premium Partner