细化类型和计算对偶性

N. Zeilberger
{"title":"细化类型和计算对偶性","authors":"N. Zeilberger","doi":"10.1145/1481848.1481852","DOIUrl":null,"url":null,"abstract":"One lesson learned painfully over the past twenty years is the perilous interaction of Curry-style typing with evaluation order and side-effects. This led eventually to the value restriction on polymorphism in ML, as well as, more recently, to similar artifacts in type systems for ML with intersection and union refinement types. For example, some of the traditional subtyping laws for unions and intersections are unsound in the presence of effects, while union-elimination requires an evaluation context restriction in addition to the value restriction on intersection-introduction.\n Our aim is to show that rather than being ad hoc artifacts, phenomena such as the value and evaluation context restrictions arise naturally in type systems for effectful languages, out of principles of duality. Beginning with a review of recent work on the Curry-Howard interpretation of focusing proofs as pattern-matching programs, we explain how to interpret intersection and union refinements on these programs, and how to logically derive the subtyping relationship via an identity coercion interpretation. The value restriction, etc., emerge out of this analysis. However, this abstract account does not immediately yield a decidable type system, essentially because the syntax is infinitary--both \"infinitely wide\" and \"infinitely deep\". We show how to mechanically construct a finitary syntax by applying two well-known PL techniques--pattern-compilation and defunctionalization--and conclude by giving this finitary syntax an algorithmic refinement type system. Parallel to the text, we describe an embedding in the dependently-typed functional language Agda, both for the sake of clarifying these ideas, and also because formalization was an important guide in developing them. As one example, the Agda encoding split very naturally into an intrinsic (\"Church\") view of well-typed programs, and an extrinsic (\"Curry\") view of refinement typing for those programs.","PeriodicalId":153056,"journal":{"name":"Programming Languages meets Program Verification","volume":"2012 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2009-01-20","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"17","resultStr":"{\"title\":\"Refinement types and computational duality\",\"authors\":\"N. Zeilberger\",\"doi\":\"10.1145/1481848.1481852\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"One lesson learned painfully over the past twenty years is the perilous interaction of Curry-style typing with evaluation order and side-effects. This led eventually to the value restriction on polymorphism in ML, as well as, more recently, to similar artifacts in type systems for ML with intersection and union refinement types. For example, some of the traditional subtyping laws for unions and intersections are unsound in the presence of effects, while union-elimination requires an evaluation context restriction in addition to the value restriction on intersection-introduction.\\n Our aim is to show that rather than being ad hoc artifacts, phenomena such as the value and evaluation context restrictions arise naturally in type systems for effectful languages, out of principles of duality. Beginning with a review of recent work on the Curry-Howard interpretation of focusing proofs as pattern-matching programs, we explain how to interpret intersection and union refinements on these programs, and how to logically derive the subtyping relationship via an identity coercion interpretation. The value restriction, etc., emerge out of this analysis. However, this abstract account does not immediately yield a decidable type system, essentially because the syntax is infinitary--both \\\"infinitely wide\\\" and \\\"infinitely deep\\\". We show how to mechanically construct a finitary syntax by applying two well-known PL techniques--pattern-compilation and defunctionalization--and conclude by giving this finitary syntax an algorithmic refinement type system. Parallel to the text, we describe an embedding in the dependently-typed functional language Agda, both for the sake of clarifying these ideas, and also because formalization was an important guide in developing them. As one example, the Agda encoding split very naturally into an intrinsic (\\\"Church\\\") view of well-typed programs, and an extrinsic (\\\"Curry\\\") view of refinement typing for those programs.\",\"PeriodicalId\":153056,\"journal\":{\"name\":\"Programming Languages meets Program Verification\",\"volume\":\"2012 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2009-01-20\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"17\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Programming Languages meets Program Verification\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1145/1481848.1481852\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Programming Languages meets Program Verification","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/1481848.1481852","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 17

摘要

在过去的二十年里,我们痛苦地吸取了一个教训,那就是curry风格的输入与求值顺序和副作用的危险交互。这最终导致了ML中多态性的值限制,以及最近在ML类型系统中具有交集和联合细化类型的类似工件。例如,在存在效应的情况下,一些传统的联合和交集子类型法则是不健全的,而联合消除除了对交集引入的值限制外,还需要对评估上下文进行限制。我们的目的是表明,在有效语言的类型系统中,诸如值和求值上下文限制之类的现象是出于对偶原则而自然产生的,而不是特别的工件。从回顾最近关于聚焦证明作为模式匹配程序的Curry-Howard解释的工作开始,我们解释了如何解释这些程序上的交集和并细化,以及如何通过身份强制解释逻辑地推导子类型关系。由此产生了价值约束等问题。然而,这种抽象的解释并不能立即产生一个可确定的类型系统,本质上是因为语法是无限的——“无限宽”和“无限深”。我们将展示如何通过应用两种著名的PL技术——模式编译和去功能化——来机械地构造有限语法,并通过为该有限语法提供一个算法细化类型系统来进行总结。与本文平行,我们描述了在依赖类型函数语言Agda中的嵌入,这既是为了澄清这些思想,也是因为形式化是开发这些思想的重要指导。举个例子,Agda编码非常自然地分裂为一个内在的(“Church”)观点,即良好类型的程序,和一个外在的(“Curry”)观点,即这些程序的细化类型。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
Refinement types and computational duality
One lesson learned painfully over the past twenty years is the perilous interaction of Curry-style typing with evaluation order and side-effects. This led eventually to the value restriction on polymorphism in ML, as well as, more recently, to similar artifacts in type systems for ML with intersection and union refinement types. For example, some of the traditional subtyping laws for unions and intersections are unsound in the presence of effects, while union-elimination requires an evaluation context restriction in addition to the value restriction on intersection-introduction. Our aim is to show that rather than being ad hoc artifacts, phenomena such as the value and evaluation context restrictions arise naturally in type systems for effectful languages, out of principles of duality. Beginning with a review of recent work on the Curry-Howard interpretation of focusing proofs as pattern-matching programs, we explain how to interpret intersection and union refinements on these programs, and how to logically derive the subtyping relationship via an identity coercion interpretation. The value restriction, etc., emerge out of this analysis. However, this abstract account does not immediately yield a decidable type system, essentially because the syntax is infinitary--both "infinitely wide" and "infinitely deep". We show how to mechanically construct a finitary syntax by applying two well-known PL techniques--pattern-compilation and defunctionalization--and conclude by giving this finitary syntax an algorithmic refinement type system. Parallel to the text, we describe an embedding in the dependently-typed functional language Agda, both for the sake of clarifying these ideas, and also because formalization was an important guide in developing them. As one example, the Agda encoding split very naturally into an intrinsic ("Church") view of well-typed programs, and an extrinsic ("Curry") view of refinement typing for those programs.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
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学术文献互助群
群 号:481959085
Book学术官方微信