责备和胁迫:第一次再次在一起

IF 1.1 3区 计算机科学 Q4 COMPUTER SCIENCE, SOFTWARE ENGINEERING Journal of Functional Programming Pub Date : 2021-10-13 DOI:10.1017/s0956796821000101
JEREMY G. SIEK, PETER THIEMANN, PHILIP WADLER
{"title":"责备和胁迫:第一次再次在一起","authors":"JEREMY G. SIEK, PETER THIEMANN, PHILIP WADLER","doi":"10.1017/s0956796821000101","DOIUrl":null,"url":null,"abstract":"C#, Dart, Pyret, Racket, TypeScript, VB: many recent languages integrate dynamic and static types via gradual typing. We systematically develop four calculi for gradual typing and the relations between them, building on and strengthening previous work. The calculi are as follows: <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline1.png\" /> <jats:tex-math> $\\lambda{B}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula>, based on the blame calculus of Wadler and Findler (2009); <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline2.png\" /> <jats:tex-math> $\\lambda{C}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula>, inspired by the coercion calculus of Henglein (1994); <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline3.png\" /> <jats:tex-math> $\\lambda{S}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> inspired by the space-efficient calculus of Herman, Tomb, and Flanagan (2006); and <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline4.png\" /> <jats:tex-math> $\\lambda{T}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> based on the threesome calculus of Siek and Wadler (2010). While <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline5.png\" /> <jats:tex-math> $\\lambda{B}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> and <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline6.png\" /> <jats:tex-math> $\\lambda{T}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> are little changed from previous work, <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline7.png\" /> <jats:tex-math> $\\lambda{C}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> and <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline8.png\" /> <jats:tex-math> $\\lambda{S}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> are new. Together, <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline9.png\" /> <jats:tex-math> $\\lambda{B}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula>, <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline10.png\" /> <jats:tex-math> $\\lambda{C}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula>, <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline11.png\" /> <jats:tex-math> $\\lambda{S}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula>, and <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline12.png\" /> <jats:tex-math> $\\lambda{T}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> provide a coherent foundation for design, implementation, and optimization of gradual types. We define translations from <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline13.png\" /> <jats:tex-math> $\\lambda{B}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> to <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline14.png\" /> <jats:tex-math> $\\lambda{C}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula>, from <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline15.png\" /> <jats:tex-math> $\\lambda{C}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> to <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline16.png\" /> <jats:tex-math> $\\lambda{S}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula>, and from <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline17.png\" /> <jats:tex-math> $\\lambda{S}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> to <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline18.png\" /> <jats:tex-math> $\\lambda{T}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula>. Much previous work lacked proofs of correctness or had weak correctness criteria; here we demonstrate the strongest correctness criterion one could hope for, that each of the translations is fully abstract. Each of the calculi reinforces the design of the others: <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline19.png\" /> <jats:tex-math> $\\lambda{C}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> has a particularly simple definition, and the subtle definition of blame safety for <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline20.png\" /> <jats:tex-math> $\\lambda{B}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> is justified by the simple definition of blame safety for <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline21.png\" /> <jats:tex-math> $\\lambda{C}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula>. Our calculus <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline22.png\" /> <jats:tex-math> $\\lambda{S}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> is implementation-ready: the first space-efficient calculus that is both straightforward to implement and easy to understand. We give two applications: first, using full abstraction from <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline23.png\" /> <jats:tex-math> $\\lambda{C}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> to <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline24.png\" /> <jats:tex-math> $\\lambda{S}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> to establish an equational theory of coercions; and second, using full abstraction from <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline25.png\" /> <jats:tex-math> $\\lambda{B}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> to <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\"http://www.w3.org/1999/xlink\" mime-subtype=\"png\" xlink:href=\"S0956796821000101_inline26.png\" /> <jats:tex-math> $\\lambda{S}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> to easily establish the Fundamental Property of Casts, which required a custom bisimulation and six lemmas in earlier work.","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":null,"pages":null},"PeriodicalIF":1.1000,"publicationDate":"2021-10-13","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"Blame and coercion: Together again for the first time\",\"authors\":\"JEREMY G. SIEK, PETER THIEMANN, PHILIP WADLER\",\"doi\":\"10.1017/s0956796821000101\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"C#, Dart, Pyret, Racket, TypeScript, VB: many recent languages integrate dynamic and static types via gradual typing. We systematically develop four calculi for gradual typing and the relations between them, building on and strengthening previous work. The calculi are as follows: <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline1.png\\\" /> <jats:tex-math> $\\\\lambda{B}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula>, based on the blame calculus of Wadler and Findler (2009); <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline2.png\\\" /> <jats:tex-math> $\\\\lambda{C}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula>, inspired by the coercion calculus of Henglein (1994); <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline3.png\\\" /> <jats:tex-math> $\\\\lambda{S}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> inspired by the space-efficient calculus of Herman, Tomb, and Flanagan (2006); and <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline4.png\\\" /> <jats:tex-math> $\\\\lambda{T}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> based on the threesome calculus of Siek and Wadler (2010). While <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline5.png\\\" /> <jats:tex-math> $\\\\lambda{B}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> and <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline6.png\\\" /> <jats:tex-math> $\\\\lambda{T}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> are little changed from previous work, <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline7.png\\\" /> <jats:tex-math> $\\\\lambda{C}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> and <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline8.png\\\" /> <jats:tex-math> $\\\\lambda{S}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> are new. Together, <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline9.png\\\" /> <jats:tex-math> $\\\\lambda{B}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula>, <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline10.png\\\" /> <jats:tex-math> $\\\\lambda{C}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula>, <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline11.png\\\" /> <jats:tex-math> $\\\\lambda{S}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula>, and <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline12.png\\\" /> <jats:tex-math> $\\\\lambda{T}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> provide a coherent foundation for design, implementation, and optimization of gradual types. We define translations from <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline13.png\\\" /> <jats:tex-math> $\\\\lambda{B}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> to <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline14.png\\\" /> <jats:tex-math> $\\\\lambda{C}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula>, from <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline15.png\\\" /> <jats:tex-math> $\\\\lambda{C}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> to <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline16.png\\\" /> <jats:tex-math> $\\\\lambda{S}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula>, and from <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline17.png\\\" /> <jats:tex-math> $\\\\lambda{S}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> to <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline18.png\\\" /> <jats:tex-math> $\\\\lambda{T}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula>. Much previous work lacked proofs of correctness or had weak correctness criteria; here we demonstrate the strongest correctness criterion one could hope for, that each of the translations is fully abstract. Each of the calculi reinforces the design of the others: <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline19.png\\\" /> <jats:tex-math> $\\\\lambda{C}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> has a particularly simple definition, and the subtle definition of blame safety for <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline20.png\\\" /> <jats:tex-math> $\\\\lambda{B}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> is justified by the simple definition of blame safety for <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline21.png\\\" /> <jats:tex-math> $\\\\lambda{C}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula>. Our calculus <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline22.png\\\" /> <jats:tex-math> $\\\\lambda{S}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> is implementation-ready: the first space-efficient calculus that is both straightforward to implement and easy to understand. We give two applications: first, using full abstraction from <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline23.png\\\" /> <jats:tex-math> $\\\\lambda{C}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> to <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline24.png\\\" /> <jats:tex-math> $\\\\lambda{S}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> to establish an equational theory of coercions; and second, using full abstraction from <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline25.png\\\" /> <jats:tex-math> $\\\\lambda{B}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> to <jats:inline-formula> <jats:alternatives> <jats:inline-graphic xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" mime-subtype=\\\"png\\\" xlink:href=\\\"S0956796821000101_inline26.png\\\" /> <jats:tex-math> $\\\\lambda{S}$ </jats:tex-math> </jats:alternatives> </jats:inline-formula> to easily establish the Fundamental Property of Casts, which required a custom bisimulation and six lemmas in earlier work.\",\"PeriodicalId\":15874,\"journal\":{\"name\":\"Journal of Functional Programming\",\"volume\":null,\"pages\":null},\"PeriodicalIF\":1.1000,\"publicationDate\":\"2021-10-13\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Journal of Functional Programming\",\"FirstCategoryId\":\"94\",\"ListUrlMain\":\"https://doi.org/10.1017/s0956796821000101\",\"RegionNum\":3,\"RegionCategory\":\"计算机科学\",\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"Q4\",\"JCRName\":\"COMPUTER SCIENCE, SOFTWARE ENGINEERING\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Journal of Functional Programming","FirstCategoryId":"94","ListUrlMain":"https://doi.org/10.1017/s0956796821000101","RegionNum":3,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q4","JCRName":"COMPUTER SCIENCE, SOFTWARE ENGINEERING","Score":null,"Total":0}
引用次数: 0

摘要

c#、Dart、Pyret、Racket、TypeScript、VB:许多最新的语言都通过渐进式类型集成了动态类型和静态类型。在前人工作的基础上,系统地发展了四种渐进式演算及其相互关系。演算公式如下:$\lambda{B}$,基于Wadler and Findler(2009)的责备演算;$\lambda{C}$,灵感来自Henglein(1994)的强制演算;$\lambda{S}$灵感来自Herman, Tomb, and Flanagan(2006)的空间高效演算;和基于Siek和Wadler(2010)的三人微积分的$\lambda{T}$。虽然$\lambda{B}$和$\lambda{T}$与以前的工作相比变化不大,但$\lambda{C}$和$\lambda{S}$是新的。$\lambda{B}$、$\lambda{C}$、$\lambda{S}$和$\lambda{T}$共同为渐变类型的设计、实现和优化提供了一个连贯的基础。我们定义从$\lambda{B}$到$\lambda{C}$的转换,从$\lambda{C}$到$\lambda{S}$的转换,以及从$\lambda{S}$到$\lambda{T}$的转换。许多先前的工作缺乏正确性的证明,或者正确性标准很弱;在这里,我们展示了人们所能期望的最强的正确性标准,即每个翻译都是完全抽象的。每个演算都加强了其他演算的设计:$\lambda{C}$有一个特别简单的定义,$\lambda{B}$的责备安全的微妙定义被$\lambda{C}$的责备安全的简单定义所证明。我们的演算$\lambda{S}$已经为实现做好了准备:这是第一个既易于实现又易于理解的节省空间的演算。我们给出了两个应用:第一,利用$\lambda{C}$到$\lambda{S}$的完全抽象,建立了一个等价的强制子理论;其次,使用从$\lambda{B}$到$\lambda{S}$的完全抽象,可以轻松地建立类型转换的基本属性,这在早期的工作中需要一个自定义的双模拟和六个引理。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
Blame and coercion: Together again for the first time
C#, Dart, Pyret, Racket, TypeScript, VB: many recent languages integrate dynamic and static types via gradual typing. We systematically develop four calculi for gradual typing and the relations between them, building on and strengthening previous work. The calculi are as follows: $\lambda{B}$ , based on the blame calculus of Wadler and Findler (2009); $\lambda{C}$ , inspired by the coercion calculus of Henglein (1994); $\lambda{S}$ inspired by the space-efficient calculus of Herman, Tomb, and Flanagan (2006); and $\lambda{T}$ based on the threesome calculus of Siek and Wadler (2010). While $\lambda{B}$ and $\lambda{T}$ are little changed from previous work, $\lambda{C}$ and $\lambda{S}$ are new. Together, $\lambda{B}$ , $\lambda{C}$ , $\lambda{S}$ , and $\lambda{T}$ provide a coherent foundation for design, implementation, and optimization of gradual types. We define translations from $\lambda{B}$ to $\lambda{C}$ , from $\lambda{C}$ to $\lambda{S}$ , and from $\lambda{S}$ to $\lambda{T}$ . Much previous work lacked proofs of correctness or had weak correctness criteria; here we demonstrate the strongest correctness criterion one could hope for, that each of the translations is fully abstract. Each of the calculi reinforces the design of the others: $\lambda{C}$ has a particularly simple definition, and the subtle definition of blame safety for $\lambda{B}$ is justified by the simple definition of blame safety for $\lambda{C}$ . Our calculus $\lambda{S}$ is implementation-ready: the first space-efficient calculus that is both straightforward to implement and easy to understand. We give two applications: first, using full abstraction from $\lambda{C}$ to $\lambda{S}$ to establish an equational theory of coercions; and second, using full abstraction from $\lambda{B}$ to $\lambda{S}$ to easily establish the Fundamental Property of Casts, which required a custom bisimulation and six lemmas in earlier work.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
Journal of Functional Programming
Journal of Functional Programming 工程技术-计算机:软件工程
CiteScore
1.70
自引率
0.00%
发文量
9
审稿时长
>12 weeks
期刊介绍: Journal of Functional Programming is the only journal devoted solely to the design, implementation, and application of functional programming languages, spanning the range from mathematical theory to industrial practice. Topics covered include functional languages and extensions, implementation techniques, reasoning and proof, program transformation and synthesis, type systems, type theory, language-based security, memory management, parallelism and applications. The journal is of interest to computer scientists, software engineers, programming language researchers and mathematicians interested in the logical foundations of programming.
期刊最新文献
Signature restriction for polymorphic algebraic effects Asymptotic speedup via effect handlers Static Blame for gradual typing Knuth–Morris–Pratt illustrated Sparcl: A language for partially invertible computation
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1