Cargando…
Parametricity for Primitive Nested Types
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 ca...
Autores principales: | , , |
---|---|
Formato: | Online Artículo Texto |
Lenguaje: | English |
Publicado: |
2021
|
Materias: | |
Acceso en línea: | https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7984101/ http://dx.doi.org/10.1007/978-3-030-71995-1_17 |
_version_ | 1783668005636407296 |
---|---|
author | Johann, Patricia Ghiorzi, Enrico Jeffries, Daniel |
author_facet | Johann, Patricia Ghiorzi, Enrico Jeffries, Daniel |
author_sort | Johann, Patricia |
collection | PubMed |
description | 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. |
format | Online Article Text |
id | pubmed-7984101 |
institution | National Center for Biotechnology Information |
language | English |
publishDate | 2021 |
record_format | MEDLINE/PubMed |
spelling | pubmed-79841012021-03-23 Parametricity for Primitive Nested Types Johann, Patricia Ghiorzi, Enrico Jeffries, Daniel Foundations of Software Science and Computation Structures Article 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. 2021-03-23 /pmc/articles/PMC7984101/ http://dx.doi.org/10.1007/978-3-030-71995-1_17 Text en © The Author(s) 2021 Open Access This chapter is licensed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license and indicate if changes were made. The images or other third party material in this chapter are included in the chapter's Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the chapter's Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. |
spellingShingle | Article Johann, Patricia Ghiorzi, Enrico Jeffries, Daniel Parametricity for Primitive Nested Types |
title | Parametricity for Primitive Nested Types |
title_full | Parametricity for Primitive Nested Types |
title_fullStr | Parametricity for Primitive Nested Types |
title_full_unstemmed | Parametricity for Primitive Nested Types |
title_short | Parametricity for Primitive Nested Types |
title_sort | parametricity for primitive nested types |
topic | Article |
url | https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7984101/ http://dx.doi.org/10.1007/978-3-030-71995-1_17 |
work_keys_str_mv | AT johannpatricia parametricityforprimitivenestedtypes AT ghiorzienrico parametricityforprimitivenestedtypes AT jeffriesdaniel parametricityforprimitivenestedtypes |