首页 > 最新文献

Journal of Functional Programming最新文献

英文 中文
Editorial 编辑
IF 1.1 3区 计算机科学 Q4 Computer Science Pub Date : 2021-12-16 DOI: 10.1017/s0956796821000265
J. Gibbons, S. Krishnamurthi
{"title":"Editorial","authors":"J. Gibbons, S. Krishnamurthi","doi":"10.1017/s0956796821000265","DOIUrl":"https://doi.org/10.1017/s0956796821000265","url":null,"abstract":"","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":null,"pages":null},"PeriodicalIF":1.1,"publicationDate":"2021-12-16","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"48707852","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":3,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 0
Taming the Merge Operator 驯服合并操作符
IF 1.1 3区 计算机科学 Q4 Computer Science Pub Date : 2021-11-02 DOI: 10.1017/S0956796821000186
Xuejing Huang, Jinxu Zhao, B. C. D. S. Oliveira
Abstract Calculi with disjoint intersection types support a symmetric merge operator with subtyping. The merge operator generalizes record concatenation to any type, enabling expressive forms of object composition, and simple solutions to hard modularity problems. Unfortunately, recent calculi with disjoint intersection types and the merge operator lack a (direct) operational semantics with expected properties such as determinism and subject reduction, and only account for terminating programs. This paper proposes a type-directed operational semantics (TDOS) for calculi with intersection types and a merge operator. We study two variants of calculi in the literature. The first calculus, called λi, is a variant of a calculus presented by Oliveira et al. (2016) and closely related to another calculus by Dunfield (2014). Although Dunfield proposes a direct small-step semantics for her calculus, her semantics lacks both determinism and subject reduction. Using our TDOS, we obtain a direct semantics for λi that has both properties. The second calculus, called λi+, employs the well-known subtyping relation of Barendregt, Coppo and Dezani-Ciancaglini (BCD). Therefore, λi+ extends the more basic subtyping relation of λi, and also adds support for record types and nested composition (which enables recursive composition of merged components). To fully obtain determinism, both λi and λi+ employ a disjointness restriction proposed in the original λi calculus. As an added benefit the TDOS approach deals with recursion in a straightforward way, unlike previous calculi with disjoint intersection types where recursion is problematic. We relate the static and dynamic semantics of λi to the original version of the calculus and the calculus by Dunfield. Furthermore, for λi+, we show a novel formulation of BCD subtyping, which is algorithmic, has a very simple proof of transitivity and allows for the modular addition of distributivity rules (i.e. without affecting other rules of subtyping). All results have been fully formalized in the Coq theorem prover.
不相交类型的微积分支持带子类型的对称归并算子。merge操作符将记录连接一般化为任何类型,支持对象组合的表达形式,以及对难模块化问题的简单解决方案。不幸的是,最近具有不相交相交类型和合并操作符的演算缺乏具有预期属性(如确定性和主题约简)的(直接)操作语义,并且只考虑终止程序。本文提出了一种面向类型的运算语义(TDOS)和一个合并算子。我们在文献中研究了结石的两种变体。第一种微积分称为λi,是Oliveira等人(2016)提出的微积分的变体,与Dunfield(2014)的另一种微积分密切相关。虽然邓菲尔德为她的微积分提出了一种直接的小步语义学,但她的语义学既缺乏决定论,也缺乏主体约简。使用我们的TDOS,我们获得了λi的直接语义,它具有这两个性质。第二种演算称为λi+,它采用了著名的Barendregt、Coppo和Dezani-Ciancaglini (BCD)的亚型关系。因此,λi+扩展了λi的更基本的子类型关系,并且还增加了对记录类型和嵌套组合的支持(这使得合并组件的递归组合成为可能)。为了充分获得决定论,λi和λi+都采用了原λi演算中提出的不连接性限制。作为一个额外的好处,TDOS方法以一种直接的方式处理递归,不像以前的不相交类型的演算,递归是有问题的。我们将λi的静态和动态语义与原始版本的微积分和Dunfield的微积分联系起来。此外,对于λi+,我们给出了BCD子类型的一个新公式,它是算法的,具有非常简单的传递性证明,并且允许分配性规则的模加法(即不影响子类型的其他规则)。所有的结果都在Coq定理证明中完全形式化了。
{"title":"Taming the Merge Operator","authors":"Xuejing Huang, Jinxu Zhao, B. C. D. S. Oliveira","doi":"10.1017/S0956796821000186","DOIUrl":"https://doi.org/10.1017/S0956796821000186","url":null,"abstract":"Abstract Calculi with disjoint intersection types support a symmetric merge operator with subtyping. The merge operator generalizes record concatenation to any type, enabling expressive forms of object composition, and simple solutions to hard modularity problems. Unfortunately, recent calculi with disjoint intersection types and the merge operator lack a (direct) operational semantics with expected properties such as determinism and subject reduction, and only account for terminating programs. This paper proposes a type-directed operational semantics (TDOS) for calculi with intersection types and a merge operator. We study two variants of calculi in the literature. The first calculus, called λi, is a variant of a calculus presented by Oliveira et al. (2016) and closely related to another calculus by Dunfield (2014). Although Dunfield proposes a direct small-step semantics for her calculus, her semantics lacks both determinism and subject reduction. Using our TDOS, we obtain a direct semantics for λi that has both properties. The second calculus, called λi+, employs the well-known subtyping relation of Barendregt, Coppo and Dezani-Ciancaglini (BCD). Therefore, λi+ extends the more basic subtyping relation of λi, and also adds support for record types and nested composition (which enables recursive composition of merged components). To fully obtain determinism, both λi and λi+ employ a disjointness restriction proposed in the original λi calculus. As an added benefit the TDOS approach deals with recursion in a straightforward way, unlike previous calculi with disjoint intersection types where recursion is problematic. We relate the static and dynamic semantics of λi to the original version of the calculus and the calculus by Dunfield. Furthermore, for λi+, we show a novel formulation of BCD subtyping, which is algorithmic, has a very simple proof of transitivity and allows for the modular addition of distributivity rules (i.e. without affecting other rules of subtyping). All results have been fully formalized in the Coq theorem prover.","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":null,"pages":null},"PeriodicalIF":1.1,"publicationDate":"2021-11-02","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"48822720","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":3,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 8
Relational cost analysis in a functional-imperative setting 功能命令式环境中的关系成本分析
IF 1.1 3区 计算机科学 Q4 Computer Science Pub Date : 2021-11-02 DOI: 10.1017/S0956796821000071
Weihao Qu, Marco Gaboardi, D. Garg
Abstract Relational cost analysis aims at formally establishing bounds on the difference in the evaluation costs of two programs. As a particular case, one can also use relational cost analysis to establish bounds on the difference in the evaluation cost of the same program on two different inputs. One way to perform relational cost analysis is to use a relational type-and-effect system that supports reasoning about relations between two executions of two programs. Building on this basic idea, we present a type-and-effect system, called ARel, for reasoning about the relative cost (the difference in the evaluation cost) of array-manipulating, higher order functional-imperative programs. The key ingredient of our approach is a new lightweight type refinement discipline that we use to track relations (differences) between two mutable arrays. This discipline combined with Hoare-style triples built into the types allows us to express and establish precise relative costs of several interesting programs that imperatively update their data. We have implemented ARel using ideas from bidirectional type checking.
关系成本分析的目的是正式确定两个项目评估成本差异的界限。作为一种特殊情况,还可以使用关系成本分析来确定同一程序在两个不同输入上的评估成本差异的界限。执行关系成本分析的一种方法是使用关系类型和效果系统,该系统支持对两个程序的两次执行之间的关系进行推理。基于这个基本思想,我们提出了一个类型和效果系统,称为ARel,用于推理数组操作的相对成本(计算成本的差异),高阶函数命令式程序。我们的方法的关键成分是一个新的轻量级类型细化原则,我们用它来跟踪两个可变数组之间的关系(差异)。这个原则与类型中内置的hoare风格的三元组相结合,使我们能够表达和建立几个有趣的程序的精确相对成本,这些程序需要命令式地更新它们的数据。我们使用双向类型检查的思想实现了ARel。
{"title":"Relational cost analysis in a functional-imperative setting","authors":"Weihao Qu, Marco Gaboardi, D. Garg","doi":"10.1017/S0956796821000071","DOIUrl":"https://doi.org/10.1017/S0956796821000071","url":null,"abstract":"Abstract Relational cost analysis aims at formally establishing bounds on the difference in the evaluation costs of two programs. As a particular case, one can also use relational cost analysis to establish bounds on the difference in the evaluation cost of the same program on two different inputs. One way to perform relational cost analysis is to use a relational type-and-effect system that supports reasoning about relations between two executions of two programs. Building on this basic idea, we present a type-and-effect system, called ARel, for reasoning about the relative cost (the difference in the evaluation cost) of array-manipulating, higher order functional-imperative programs. The key ingredient of our approach is a new lightweight type refinement discipline that we use to track relations (differences) between two mutable arrays. This discipline combined with Hoare-style triples built into the types allows us to express and establish precise relative costs of several interesting programs that imperatively update their data. We have implemented ARel using ideas from bidirectional type checking.","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":null,"pages":null},"PeriodicalIF":1.1,"publicationDate":"2021-11-02","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"42069160","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":3,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 1
Cogent: uniqueness types and certifying compilation Cogent:惟一类型和认证编译
IF 1.1 3区 计算机科学 Q4 Computer Science Pub Date : 2021-10-27 DOI: 10.1017/S095679682100023X
Liam O'Connor, Zilin Chen, C. Rizkallah, Vincent Jackson, Sidney Amani, G. Klein, Toby C. Murray, Thomas Sewell, G. Keller
Abstract This paper presents a framework aimed at significantly reducing the cost of proving functional correctness for low-level operating systems components. The framework is designed around a new functional programming language, Cogent. A central aspect of the language is its uniqueness type system, which eliminates the need for a trusted runtime or garbage collector while still guaranteeing memory safety, a crucial property for safety and security. Moreover, it allows us to assign two semantics to the language: The first semantics is imperative, suitable for efficient C code generation, and the second is purely functional, providing a user-friendly interface for equational reasoning and verification of higher-level correctness properties. The refinement theorem connecting the two semantics allows the compiler to produce a proof via translation validation certifying the correctness of the generated C code with respect to the semantics of the Cogent source program. We have demonstrated the effectiveness of our framework for implementation and for verification through two file system implementations.
摘要本文提出了一个框架,旨在显著降低低级别操作系统组件证明功能正确性的成本。该框架是围绕一种新的函数式编程语言Cogent设计的。该语言的一个核心方面是其唯一性类型系统,它消除了对可信运行时或垃圾收集器的需求,同时仍然保证内存安全,这是安全性和安全性的关键属性。此外,它允许我们为语言分配两种语义:第一种语义是命令式的,适用于高效的C代码生成,第二种语义是纯功能性的,为等式推理和验证更高级别的正确性属性提供了一个用户友好的界面。连接这两种语义的精化定理允许编译器通过翻译验证产生证明,证明生成的C代码相对于Cogent源程序的语义的正确性。我们已经通过两个文件系统实现证明了我们的框架在实现和验证方面的有效性。
{"title":"Cogent: uniqueness types and certifying compilation","authors":"Liam O'Connor, Zilin Chen, C. Rizkallah, Vincent Jackson, Sidney Amani, G. Klein, Toby C. Murray, Thomas Sewell, G. Keller","doi":"10.1017/S095679682100023X","DOIUrl":"https://doi.org/10.1017/S095679682100023X","url":null,"abstract":"Abstract This paper presents a framework aimed at significantly reducing the cost of proving functional correctness for low-level operating systems components. The framework is designed around a new functional programming language, Cogent. A central aspect of the language is its uniqueness type system, which eliminates the need for a trusted runtime or garbage collector while still guaranteeing memory safety, a crucial property for safety and security. Moreover, it allows us to assign two semantics to the language: The first semantics is imperative, suitable for efficient C code generation, and the second is purely functional, providing a user-friendly interface for equational reasoning and verification of higher-level correctness properties. The refinement theorem connecting the two semantics allows the compiler to produce a proof via translation validation certifying the correctness of the generated C code with respect to the semantics of the Cogent source program. We have demonstrated the effectiveness of our framework for implementation and for verification through two file system implementations.","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":null,"pages":null},"PeriodicalIF":1.1,"publicationDate":"2021-10-27","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"48969372","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":3,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 12
Segments: An alternative rainfall problem 分段:替代降雨问题
IF 1.1 3区 计算机科学 Q4 Computer Science Pub Date : 2021-10-19 DOI: 10.1017/S0956796821000216
P. Achten
Abstract Elliot Soloway’s Rainfall problem is a well-known and well-studied problem to investigate the problem-solving strategies of programmers. Kathi Fisler investigated this programming challenge from the point of view of functional programmers. She showed that this particular challenge gives rise to five different high-level solution strategies, of which three are predominant and cover over 80% of all chosen solutions. In this study, we put forward the Segments problem as an alternative challenge to investigate the problem-solving skills of functional programmers. Analysis of the student solutions, their high-level solution strategies, and corresponding archetype solutions shows that the Segments problem gives rise to seven different high-level solution strategies that can be further divided into 17 subclasses. The Segments problem is particularly suited to investigate problem-solving skills that involve list processing and higher-order functions.
摘要Elliot Soloway的降雨问题是一个众所周知的、研究得很好的问题,用于研究程序员的解决策略。Kathi Fisler从函数式程序员的角度研究了这一编程挑战。她指出,这一特殊挑战产生了五种不同的高级别解决方案策略,其中三种是主要的,涵盖了80%以上的选定解决方案。在这项研究中,我们提出了Segments问题,作为研究函数式程序员解决问题技能的另一个挑战。对学生解决方案、他们的高级解决方案策略和相应的原型解决方案的分析表明,Segments问题产生了七种不同的高级解决策略,这些策略可以进一步划分为17个子类。Segments问题特别适合研究涉及列表处理和高阶函数的解决问题的技能。
{"title":"Segments: An alternative rainfall problem","authors":"P. Achten","doi":"10.1017/S0956796821000216","DOIUrl":"https://doi.org/10.1017/S0956796821000216","url":null,"abstract":"Abstract Elliot Soloway’s Rainfall problem is a well-known and well-studied problem to investigate the problem-solving strategies of programmers. Kathi Fisler investigated this programming challenge from the point of view of functional programmers. She showed that this particular challenge gives rise to five different high-level solution strategies, of which three are predominant and cover over 80% of all chosen solutions. In this study, we put forward the Segments problem as an alternative challenge to investigate the problem-solving skills of functional programmers. Analysis of the student solutions, their high-level solution strategies, and corresponding archetype solutions shows that the Segments problem gives rise to seven different high-level solution strategies that can be further divided into 17 subclasses. The Segments problem is particularly suited to investigate problem-solving skills that involve list processing and higher-order functions.","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":null,"pages":null},"PeriodicalIF":1.1,"publicationDate":"2021-10-19","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"41391032","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":3,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 2
A type- and scope-safe universe of syntaxes with binding: their semantics and proofs 具有绑定的类型和范围安全的语法:它们的语义和证明
IF 1.1 3区 计算机科学 Q4 Computer Science Pub Date : 2021-10-19 DOI: 10.1017/s0956796820000076
GUILLAUME ALLAIS, ROBERT ATKEY, JAMES CHAPMAN, CONOR MCBRIDE, JAMES MCKINNA
The syntax of almost every programming language includes a notion of binder and corresponding bound occurrences, along with the accompanying notions of α-equivalence, capture-avoiding substitution, typing contexts, runtime environments, and so on. In the past, implementing and reasoning about programming languages required careful handling to maintain the correct behaviour of bound variables. Modern programming languages include features that enable constraints like scope safety to be expressed in types. Nevertheless, the programmer is still forced to write the same boilerplate over again for each new implementation of a scope-safe operation (e.g., renaming, substitution, desugaring, printing), and then again for correctness proofs. We present an expressive universe of syntaxes with binding and demonstrate how to (1) implement scope-safe traversals once and for all by generic programming; and (2) how to derive properties of these traversals by generic proving. Our universe description, generic traversals and proofs, and our examples have all been formalised in Agda and are available in the accompanying material available online at https://github.com/gallais/generic-syntax.
几乎每种编程语言的语法都包含绑定和相应绑定出现的概念,以及α-等价、避免捕获的替换、类型上下文、运行时环境等相关概念。在过去,对编程语言的实现和推理需要小心处理,以维护绑定变量的正确行为。现代编程语言包括一些特性,这些特性支持用类型来表示约束,比如作用域安全。尽管如此,程序员仍然被迫为每个范围安全操作的新实现(例如,重命名、替换、去糖、打印)重新编写相同的样板文件,然后再次编写正确性证明。我们提出了一个具有绑定的语法表达范围,并演示了如何(1)通过泛型编程一劳永逸地实现范围安全遍历;(2)如何通过泛型证明推导出这些遍历的性质。我们的宇宙描述,一般遍历和证明,以及我们的例子都已经在Agda中形式化了,并且可以在https://github.com/gallais/generic-syntax上获得相关的在线材料。
{"title":"A type- and scope-safe universe of syntaxes with binding: their semantics and proofs","authors":"GUILLAUME ALLAIS, ROBERT ATKEY, JAMES CHAPMAN, CONOR MCBRIDE, JAMES MCKINNA","doi":"10.1017/s0956796820000076","DOIUrl":"https://doi.org/10.1017/s0956796820000076","url":null,"abstract":"The syntax of almost every programming language includes a notion of binder and corresponding bound occurrences, along with the accompanying notions of α-equivalence, capture-avoiding substitution, typing contexts, runtime environments, and so on. In the past, implementing and reasoning about programming languages required careful handling to maintain the correct behaviour of bound variables. Modern programming languages include features that enable constraints like scope safety to be expressed in types. Nevertheless, the programmer is still forced to write the same boilerplate over again for each new implementation of a scope-safe operation (e.g., renaming, substitution, desugaring, printing), and then again for correctness proofs. We present an expressive universe of syntaxes with binding and demonstrate how to (1) implement scope-safe traversals once and for all by generic programming; and (2) how to derive properties of these traversals by generic proving. Our universe description, generic traversals and proofs, and our examples have all been formalised in Agda and are available in the accompanying material available online at <jats:uri xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"https://github.com/gallais/generic-syntax\">https://github.com/gallais/generic-syntax</jats:uri>.","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":null,"pages":null},"PeriodicalIF":1.1,"publicationDate":"2021-10-19","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"138531910","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":3,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 0
Gradual type theory 渐进型理论
IF 1.1 3区 计算机科学 Q4 Computer Science Pub Date : 2021-10-14 DOI: 10.1017/s0956796821000125
MAX S. NEW, DANIEL R. LICATA, AMAL AHMED
Gradually typed languages are designed to support both dynamically typed and statically typed programming styles while preserving the benefits of each. Sound gradually typed languages dynamically check types at runtime at the boundary between statically typed and dynamically typed modules. However, there is much disagreement in the gradual typing literature over how to enforce complex types such as tuples, lists, functions and objects. In this paper, we propose a new perspective on the design of runtime gradual type enforcement: runtime type casts exist precisely to ensure the correctness of certain type-based refactorings and optimizations. For instance, for simple types, a language designer might desire that beta-eta equality is valid. We show that this perspective is useful by demonstrating that a cast semantics can be derived from beta-eta equality. We do this by providing an axiomatic account program equivalence in a gradual cast calculus in a logic we call gradual type theory (GTT). Based on Levy’s call-by-push-value, GTT allows us to axiomatize both call-by-value and call-by-name gradual languages. We then show that we can derive the behavior of casts for simple types from the corresponding eta equality principle and the assumption that the language satisfies a property called graduality, also known as the dynamic gradual guarantee. Since we can derive the semantics from the assumption of eta equality, we also receive a useful contrapositive: any observably different cast semantics that satisfies graduality must violate the eta equality. We show the consistency and applicability of our axiomatic theory by proving that a contract-based implementation using the lazy cast semantics gives a logical relations model of our type theory, where equivalence in GTT implies contextual equivalence of the programs. Since GTT also axiomatizes the dynamic gradual guarantee, our model also establishes this central theorem of gradual typing. The model is parameterized by the implementation of the dynamic types, and so gives a family of implementations that validate type-based optimization and the gradual guarantee.
逐渐地,类型语言被设计成既支持动态类型编程风格又支持静态类型编程风格,同时保留了两者的优点。健全的渐进式类型语言在运行时在静态类型和动态类型模块之间的边界动态检查类型。然而,对于如何实现元组、列表、函数和对象等复杂类型,渐进式类型文献中存在很多分歧。在本文中,我们提出了一个关于运行时渐进类型强制设计的新观点:运行时类型强制转换的存在正是为了确保某些基于类型的重构和优化的正确性。例如,对于简单类型,语言设计者可能希望beta-eta相等是有效的。我们通过演示转换语义可以从beta-eta等式中派生出来,来证明这个透视图是有用的。我们通过在渐进类型理论(GTT)的逻辑中提供渐进转换演算中的公理化帐户程序等价来实现这一点。基于Levy的按推值调用,GTT允许我们对按值调用和按名称调用的渐进式语言进行公理化。然后,我们展示了可以从相应的eta相等原则和语言满足渐进性(也称为动态渐进保证)的假设中推导出简单类型的强制类型转换行为。由于我们可以从eta相等的假设中推导出语义,我们也得到了一个有用的反命题:任何满足渐变性的可观察到的不同的转换语义都必须违反eta相等。通过证明使用延迟强制转换语义的基于契约的实现给出了我们类型理论的逻辑关系模型,我们展示了公理理论的一致性和适用性,其中GTT中的等价意味着程序的上下文等价。由于GTT也公理化了动态渐进保证,我们的模型也建立了这个渐进类型化的中心定理。该模型通过动态类型的实现进行参数化,从而提供了一系列验证基于类型的优化和渐进保证的实现。
{"title":"Gradual type theory","authors":"MAX S. NEW, DANIEL R. LICATA, AMAL AHMED","doi":"10.1017/s0956796821000125","DOIUrl":"https://doi.org/10.1017/s0956796821000125","url":null,"abstract":"Gradually typed languages are designed to support both dynamically typed and statically typed programming styles while preserving the benefits of each. Sound gradually typed languages dynamically check types at runtime at the boundary between statically typed and dynamically typed modules. However, there is much disagreement in the gradual typing literature over how to enforce complex types such as tuples, lists, functions and objects. In this paper, we propose a new perspective on the design of runtime gradual type enforcement: runtime type casts exist precisely to ensure the correctness of certain type-based refactorings and optimizations. For instance, for simple types, a language designer might desire that beta-eta equality is valid. We show that this perspective is useful by demonstrating that a cast semantics can be derived from beta-eta equality. We do this by providing an axiomatic account program equivalence in a gradual cast calculus in a logic we call <jats:italic>gradual type theory</jats:italic> (GTT). Based on Levy’s call-by-push-value, GTT allows us to axiomatize both call-by-value and call-by-name gradual languages. We then show that we can derive the behavior of casts for simple types from the corresponding eta equality principle and the assumption that the language satisfies a property called <jats:italic>graduality</jats:italic>, also known as the dynamic gradual guarantee. Since we can derive the semantics from the assumption of eta equality, we also receive a useful contrapositive: any observably different cast semantics that satisfies graduality <jats:italic>must</jats:italic> violate the eta equality. We show the consistency and applicability of our axiomatic theory by proving that a contract-based implementation using the lazy cast semantics gives a logical relations model of our type theory, where equivalence in GTT implies contextual equivalence of the programs. Since GTT also axiomatizes the dynamic gradual guarantee, our model also establishes this central theorem of gradual typing. The model is parameterized by the implementation of the dynamic types, and so gives a family of implementations that validate type-based optimization and the gradual guarantee.","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":null,"pages":null},"PeriodicalIF":1.1,"publicationDate":"2021-10-14","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"138531911","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":3,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 0
Blame and coercion: Together again for the first time 责备和胁迫:第一次再次在一起
IF 1.1 3区 计算机科学 Q4 Computer Science Pub Date : 2021-10-13 DOI: 10.1017/s0956796821000101
JEREMY G. SIEK, PETER THIEMANN, PHILIP WADLER
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}$ ,
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}$的完全抽象,可以轻松地建立类型转换的基本属性,这在早期的工作中需要一个自定义的双模拟和六个引理。
{"title":"Blame and coercion: Together again for the first time","authors":"JEREMY G. SIEK, PETER THIEMANN, PHILIP WADLER","doi":"10.1017/s0956796821000101","DOIUrl":"https://doi.org/10.1017/s0956796821000101","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:in","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":null,"pages":null},"PeriodicalIF":1.1,"publicationDate":"2021-10-13","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"138531912","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":3,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 0
Real-time MLton: A Standard ML runtime for real-time functional programs 实时MLton:用于实时功能程序的标准ML运行时
IF 1.1 3区 计算机科学 Q4 Computer Science Pub Date : 2021-08-31 DOI: 10.1017/S0956796821000174
B. Shivkumar, Jeffrey C. Murphy, Lukasz Ziarek
Abstract There is a growing interest in leveraging functional programming languages in real-time and embedded contexts. Functional languages are appealing as many are strictly typed, amenable to formal methods, have limited mutation, and have simple but powerful concurrency control mechanisms. Although there have been many recent proposals for specialized domain-specific languages for embedded and real-time systems, there has been relatively little progress on adapting more general purpose functional languages for programming embedded and real-time systems. In this paper, we present our current work on leveraging Standard ML (SML) in the embedded and real-time domains. Specifically, we detail our experiences in modifying MLton, a whole-program optimizing compiler for SML, for use in such contexts. We focus primarily on the language runtime, reworking the threading subsystem, object model, and garbage collector. We provide preliminary results over a radar-based aircraft collision detector ported to SML.
摘要在实时和嵌入式环境中利用函数式编程语言的兴趣越来越大。函数式语言很有吸引力,因为许多函数式语言都是严格类型化的,服从形式化方法,具有有限的变异,并且具有简单但强大的并发控制机制。尽管最近有许多针对嵌入式和实时系统的特定领域专用语言的提议,但在将更通用的函数语言用于编程嵌入和实时系统方面进展相对较小。在本文中,我们介绍了我们目前在嵌入式和实时领域中利用标准ML(SML)的工作。具体来说,我们详细介绍了修改MLton的经验,MLton是一个针对SML的全程序优化编译器,用于此类上下文。我们主要关注语言运行时,重新设计线程子系统、对象模型和垃圾收集器。我们提供了一个移植到SML的基于雷达的飞机碰撞探测器的初步结果。
{"title":"Real-time MLton: A Standard ML runtime for real-time functional programs","authors":"B. Shivkumar, Jeffrey C. Murphy, Lukasz Ziarek","doi":"10.1017/S0956796821000174","DOIUrl":"https://doi.org/10.1017/S0956796821000174","url":null,"abstract":"Abstract There is a growing interest in leveraging functional programming languages in real-time and embedded contexts. Functional languages are appealing as many are strictly typed, amenable to formal methods, have limited mutation, and have simple but powerful concurrency control mechanisms. Although there have been many recent proposals for specialized domain-specific languages for embedded and real-time systems, there has been relatively little progress on adapting more general purpose functional languages for programming embedded and real-time systems. In this paper, we present our current work on leveraging Standard ML (SML) in the embedded and real-time domains. Specifically, we detail our experiences in modifying MLton, a whole-program optimizing compiler for SML, for use in such contexts. We focus primarily on the language runtime, reworking the threading subsystem, object model, and garbage collector. We provide preliminary results over a radar-based aircraft collision detector ported to SML.","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":null,"pages":null},"PeriodicalIF":1.1,"publicationDate":"2021-08-31","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"46019679","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":3,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 1
Extracting functional programs from Coq, in Coq 从Coq中提取功能程序,在Coq中
IF 1.1 3区 计算机科学 Q4 Computer Science Pub Date : 2021-08-06 DOI: 10.1017/S0956796822000077
D. Annenkov, Mikkel Milo, J. Nielsen, Bas Spitters
Abstract We implement extraction of Coq programs to functional languages based on MetaCoq’s certified erasure. We extend the MetaCoq erasure output language with typing information and use it as an intermediate representation, which we call ${lambda^T_square}$ . We complement the extraction functionality with a full pipeline that includes several standard transformations (e.g. eta-expansion and inlining) implemented in a proof-generating manner along with a verified optimisation pass removing unused arguments. We prove the pass correct wrt. a conventional call-by-value operational semantics of functional languages. From the optimised ${lambda^T_square}$ representation, we obtain code in two functional smart contract languages, Liquidity and CameLIGO, the functional language Elm, and a subset of the multi-paradigm language for systems programming Rust. Rust is currently gaining popularity as a language for smart contracts, and we demonstrate how our extraction can be used to extract smart contract code for the Concordium network. The development is done in the context of the ConCert framework that enables smart contract verification. We contribute with two verified real-world smart contracts (boardroom voting and escrow), which we use, among other examples, to exemplify the applicability of the pipeline. In addition, we develop a verified web application and extract it to fully functional Elm code. In total, this gives us a way to write dependently typed programs in Coq, verify, and then extract them to several target languages while retaining a small trusted computing base of only MetaCoq and the pretty-printers into these languages.
摘要我们基于MetaCoq的认证擦除实现了将Coq程序提取到函数语言中。我们用类型信息扩展了MetaCoq擦除输出语言,并将其用作中间表示,我们称之为${lambda ^T_square}$。我们用一个完整的管道来补充提取功能,该管道包括以证明生成方式实现的几个标准转换(例如eta扩展和内联),以及经过验证的优化过程,删除未使用的参数。我们证明了传递正确wrt。函数语言的一种传统的按值调用操作语义。从优化的${lambda^T_square}$表示中,我们获得了两种函数智能合约语言Liquidity和CameLIGO的代码,函数语言Elm,以及用于系统编程Rust的多范式语言的子集。Rust目前作为一种智能合约语言越来越受欢迎,我们展示了如何使用我们的提取来提取Concordium网络的智能合约代码。该开发是在ConCert框架的背景下完成的,该框架支持智能合约验证。我们提供了两个经过验证的真实世界智能合约(董事会投票和托管),我们使用这些合约以及其他例子来证明管道的适用性。此外,我们开发了一个经过验证的web应用程序,并将其提取为功能齐全的Elm代码。总的来说,这为我们提供了一种用Coq编写依赖类型程序、验证程序,然后将它们提取到几种目标语言的方法,同时保留了一个只有MetaCoq和漂亮的打印机的小型可信计算库。
{"title":"Extracting functional programs from Coq, in Coq","authors":"D. Annenkov, Mikkel Milo, J. Nielsen, Bas Spitters","doi":"10.1017/S0956796822000077","DOIUrl":"https://doi.org/10.1017/S0956796822000077","url":null,"abstract":"Abstract We implement extraction of Coq programs to functional languages based on MetaCoq’s certified erasure. We extend the MetaCoq erasure output language with typing information and use it as an intermediate representation, which we call \u0000${lambda^T_square}$\u0000 . We complement the extraction functionality with a full pipeline that includes several standard transformations (e.g. eta-expansion and inlining) implemented in a proof-generating manner along with a verified optimisation pass removing unused arguments. We prove the pass correct wrt. a conventional call-by-value operational semantics of functional languages. From the optimised \u0000${lambda^T_square}$\u0000 representation, we obtain code in two functional smart contract languages, Liquidity and CameLIGO, the functional language Elm, and a subset of the multi-paradigm language for systems programming Rust. Rust is currently gaining popularity as a language for smart contracts, and we demonstrate how our extraction can be used to extract smart contract code for the Concordium network. The development is done in the context of the ConCert framework that enables smart contract verification. We contribute with two verified real-world smart contracts (boardroom voting and escrow), which we use, among other examples, to exemplify the applicability of the pipeline. In addition, we develop a verified web application and extract it to fully functional Elm code. In total, this gives us a way to write dependently typed programs in Coq, verify, and then extract them to several target languages while retaining a small trusted computing base of only MetaCoq and the pretty-printers into these languages.","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":null,"pages":null},"PeriodicalIF":1.1,"publicationDate":"2021-08-06","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"46215189","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":3,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 2
期刊
Journal of Functional Programming
全部 Acc. Chem. Res. ACS Applied Bio Materials ACS Appl. Electron. Mater. ACS Appl. Energy Mater. ACS Appl. Mater. Interfaces ACS Appl. Nano Mater. ACS Appl. Polym. Mater. ACS BIOMATER-SCI ENG ACS Catal. ACS Cent. Sci. ACS Chem. Biol. ACS Chemical Health & Safety ACS Chem. Neurosci. ACS Comb. Sci. ACS Earth Space Chem. ACS Energy Lett. ACS Infect. Dis. ACS Macro Lett. ACS Mater. Lett. ACS Med. Chem. Lett. ACS Nano ACS Omega ACS Photonics ACS Sens. ACS Sustainable Chem. Eng. ACS Synth. Biol. Anal. Chem. BIOCHEMISTRY-US Bioconjugate Chem. BIOMACROMOLECULES Chem. Res. Toxicol. Chem. Rev. Chem. Mater. CRYST GROWTH DES ENERG FUEL Environ. Sci. Technol. Environ. Sci. Technol. Lett. Eur. J. Inorg. Chem. IND ENG CHEM RES Inorg. Chem. J. Agric. Food. Chem. J. Chem. Eng. Data J. Chem. Educ. J. Chem. Inf. Model. J. Chem. Theory Comput. J. Med. Chem. J. Nat. Prod. J PROTEOME RES J. Am. Chem. Soc. LANGMUIR MACROMOLECULES Mol. Pharmaceutics Nano Lett. Org. Lett. ORG PROCESS RES DEV ORGANOMETALLICS J. Org. Chem. J. Phys. Chem. J. Phys. Chem. A J. Phys. Chem. B J. Phys. Chem. C J. Phys. Chem. Lett. Analyst Anal. Methods Biomater. Sci. Catal. Sci. Technol. Chem. Commun. Chem. Soc. Rev. CHEM EDUC RES PRACT CRYSTENGCOMM Dalton Trans. Energy Environ. Sci. ENVIRON SCI-NANO ENVIRON SCI-PROC IMP ENVIRON SCI-WAT RES Faraday Discuss. Food Funct. Green Chem. Inorg. Chem. Front. Integr. Biol. J. Anal. At. Spectrom. J. Mater. Chem. A J. Mater. Chem. B J. Mater. Chem. C Lab Chip Mater. Chem. Front. Mater. Horiz. MEDCHEMCOMM Metallomics Mol. Biosyst. Mol. Syst. Des. Eng. Nanoscale Nanoscale Horiz. Nat. Prod. Rep. New J. Chem. Org. Biomol. Chem. Org. Chem. Front. PHOTOCH PHOTOBIO SCI PCCP Polym. Chem.
×
引用
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