嵌套类型和gadt的参数化

Patricia Johann, Enrico Ghiorzi, D. Jeffries
{"title":"嵌套类型和gadt的参数化","authors":"Patricia Johann, Enrico Ghiorzi, D. Jeffries","doi":"10.46298/lmcs-17(4:23)2021","DOIUrl":null,"url":null,"abstract":"This paper considers parametricity and its consequent free theorems for\nnested data types. Rather than representing nested types via their Church\nencodings in a higher-kinded or dependently typed extension of System F, we\nadopt a functional programming perspective and design a Hindley-Milner-style\ncalculus with primitives for constructing nested types directly as fixpoints.\nOur calculus can express all nested types appearing in the literature,\nincluding truly nested types. At the level of terms, it supports primitive\npattern matching, map functions, and fold combinators for nested types. Our\nmain contribution is the construction of a parametric model for our calculus.\nThis is both delicate and challenging. In particular, to ensure the existence\nof semantic fixpoints interpreting nested types, and thus to establish a\nsuitable Identity Extension Lemma for our calculus, our type system must\nexplicitly track functoriality of types, and cocontinuity conditions on the\nfunctors interpreting them must be appropriately threaded throughout the model\nconstruction. We also prove that our model satisfies an appropriate Abstraction\nTheorem, as well as that it verifies all standard consequences of parametricity\nin the presence of primitive nested types. We give several concrete examples\nillustrating how our model can be used to derive useful free theorems,\nincluding a short cut fusion transformation, for programs over nested types.\nFinally, we consider generalizing our results to GADTs, and argue that no\nextension of our parametric model for nested types can give a functorial\ninterpretation of GADTs in terms of left Kan extensions and still be\nparametric.","PeriodicalId":314387,"journal":{"name":"Log. Methods Comput. Sci.","volume":"24 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2021-01-13","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"2","resultStr":"{\"title\":\"Parametricity for Nested Types and GADTs\",\"authors\":\"Patricia Johann, Enrico Ghiorzi, D. Jeffries\",\"doi\":\"10.46298/lmcs-17(4:23)2021\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"This paper considers parametricity and its consequent free theorems for\\nnested data types. Rather than representing nested types via their Church\\nencodings in a higher-kinded or dependently typed extension of System F, we\\nadopt a functional programming perspective and design a Hindley-Milner-style\\ncalculus with primitives for constructing nested types directly as fixpoints.\\nOur calculus can express all nested types appearing in the literature,\\nincluding truly nested types. At the level of terms, it supports primitive\\npattern matching, map functions, and fold combinators for nested types. Our\\nmain contribution is the construction of a parametric model for our calculus.\\nThis is both delicate and challenging. In particular, to ensure the existence\\nof semantic fixpoints interpreting nested types, and thus to establish a\\nsuitable Identity Extension Lemma for our calculus, our type system must\\nexplicitly track functoriality of types, and cocontinuity conditions on the\\nfunctors interpreting them must be appropriately threaded throughout the model\\nconstruction. We also prove that our model satisfies an appropriate Abstraction\\nTheorem, as well as that it verifies all standard consequences of parametricity\\nin the presence of primitive nested types. We give several concrete examples\\nillustrating how our model can be used to derive useful free theorems,\\nincluding a short cut fusion transformation, for programs over nested types.\\nFinally, we consider generalizing our results to GADTs, and argue that no\\nextension of our parametric model for nested types can give a functorial\\ninterpretation of GADTs in terms of left Kan extensions and still be\\nparametric.\",\"PeriodicalId\":314387,\"journal\":{\"name\":\"Log. Methods Comput. Sci.\",\"volume\":\"24 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2021-01-13\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"2\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Log. Methods Comput. Sci.\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.46298/lmcs-17(4:23)2021\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Log. Methods Comput. Sci.","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.46298/lmcs-17(4:23)2021","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 2

摘要

本文研究了嵌套数据类型的参数性及其相应的自由定理。我们没有在System F的更高类型或依赖类型的扩展中通过churchencoding来表示嵌套类型,而是采用函数式编程的观点,并设计了辛德雷-米尔纳风格的演法,其原语用于直接作为固定点构造嵌套类型。我们的演算可以表示文献中出现的所有嵌套类型,包括真正的嵌套类型。在术语级别,它支持基本模式匹配、映射函数和用于嵌套类型的折叠组合子。我们的主要贡献是为我们的微积分建立了一个参数模型。这既微妙又具有挑战性。特别是,为了确保解释嵌套类型的语义不移点的存在,从而为我们的演算建立合适的恒等扩展引理,我们的类型系统必须显式地跟踪类型的功能,并且解释它们的函子上的共连续性条件必须在整个模型构建中适当地贯穿。我们还证明了我们的模型满足一个适当的AbstractionTheorem,并且在存在原始嵌套类型的情况下验证了参数化的所有标准结果。我们给出了几个具体的例子来说明如何使用我们的模型来推导有用的自由定理,包括对嵌套类型上的程序的快捷融合转换。最后,我们考虑将我们的结果推广到gadt,并认为对于嵌套类型的参数模型的任何扩展都不能根据左Kan扩展给出gadt的功能解释,并且仍然是参数化的。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
Parametricity for Nested Types and GADTs
This paper considers parametricity and its consequent 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 level of terms, 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. In particular, 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 also prove that our model satisfies an appropriate Abstraction Theorem, as well as that it verifies all standard consequences of parametricity in the presence of primitive nested types. We give several concrete examples illustrating how our model can be used to derive useful free theorems, including a short cut fusion transformation, for programs over nested types. Finally, we consider generalizing our results to GADTs, and argue that no extension of our parametric model for nested types can give a functorial interpretation of GADTs in terms of left Kan extensions and still be parametric.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信