首页 > 最新文献

Journal of Functional Programming最新文献

英文 中文
A correct-by-construction conversion from lambda calculus to combinatory logic 从λ演算到组合逻辑的按结构正确的转换
IF 1.1 3区 计算机科学 Q4 Computer Science Pub Date : 2023-11-22 DOI: 10.1017/s0956796823000084
WOUTER SWIERSTRA
This pearl defines a translation from well-typed lambda terms to combinatory logic, where both the preservation of types and the correctness of the translation are enforced statically.
这个珍珠定义了从类型良好的lambda术语到组合逻辑的转换,在组合逻辑中,类型的保存和转换的正确性都是静态执行的。
{"title":"A correct-by-construction conversion from lambda calculus to combinatory logic","authors":"WOUTER SWIERSTRA","doi":"10.1017/s0956796823000084","DOIUrl":"https://doi.org/10.1017/s0956796823000084","url":null,"abstract":"This pearl defines a translation from well-typed lambda terms to combinatory logic, where both the preservation of types and the correctness of the translation are enforced statically.","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":null,"pages":null},"PeriodicalIF":1.1,"publicationDate":"2023-11-22","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"138531891","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
PhD Abstracts 摘要博士
IF 1.1 3区 计算机科学 Q4 Computer Science Pub Date : 2023-07-24 DOI: 10.1017/S0956796823000035
G. Hutton
Dependently typed programming languages provide a way to write programs, specifica-tions
依赖类型编程语言提供了一种编写程序、规范的方法
{"title":"PhD Abstracts","authors":"G. Hutton","doi":"10.1017/S0956796823000035","DOIUrl":"https://doi.org/10.1017/S0956796823000035","url":null,"abstract":"Dependently typed programming languages provide a way to write programs, specifica-tions","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":null,"pages":null},"PeriodicalIF":1.1,"publicationDate":"2023-07-24","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"45862215","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
Read/write factorizable programs 读/写可分解程序
IF 1.1 3区 计算机科学 Q4 Computer Science Pub Date : 2023-06-08 DOI: 10.1017/S0956796823000023
Siddharth Bhaskar, J. Simonsen
Abstract In the cons-free programming paradigm, we eschew constructors and program using only destructors. Cons-free programs in a simple first-order language with string data capture exactly P, the class of polynomial-time relations. By varying the underlying language and considering other data types, we can capture several other complexity classes. However, no cons-free programming language captures any functional complexity class for fundamental reasons. In this paper, we cleanly extend the cons-free paradigm to encompass functional complexity classes. Namely, we introduce programs with data that can either only be destructed or only be constructed, which we enforce by a type system on the program variables. We call the resulting programs read/write- (or RW-)factorizable, show that RW-factorizable string programs capture exactly the class FP of polynomial-time functions, and that tail-recursive RW-factorizable programs capture exactly the class FL of logarithmic-space functions. Finally, we state and solve the nontrivial problem of syntactic composition of two RW-factorizable programs.
摘要在无缺点编程范式中,我们避免使用构造函数和仅使用析构函数的程序。Cons免费程序在一个简单的一阶语言中用字符串数据捕获精确的P,多项式时间关系类。通过改变底层语言并考虑其他数据类型,我们可以捕获其他几个复杂度类。然而,由于根本原因,没有一种无缺点的编程语言能够捕获任何函数复杂性类。在本文中,我们干净地扩展了cons-free范式,以包含函数复杂性类。也就是说,我们引入的程序的数据要么只能被破坏,要么只能被构造,这是我们通过程序变量上的类型系统强制执行的。我们将所得程序称为读/写(或RW-)可因子分解程序,表明RW可因子分解字符串程序恰好捕获多项式时间函数的类FP,尾部递归RW可分解程序恰好捕获对数空间函数的类FL。最后,我们陈述并解决了两个RW可因子分解程序的句法组合的非平凡问题。
{"title":"Read/write factorizable programs","authors":"Siddharth Bhaskar, J. Simonsen","doi":"10.1017/S0956796823000023","DOIUrl":"https://doi.org/10.1017/S0956796823000023","url":null,"abstract":"Abstract In the cons-free programming paradigm, we eschew constructors and program using only destructors. Cons-free programs in a simple first-order language with string data capture exactly P, the class of polynomial-time relations. By varying the underlying language and considering other data types, we can capture several other complexity classes. However, no cons-free programming language captures any functional complexity class for fundamental reasons. In this paper, we cleanly extend the cons-free paradigm to encompass functional complexity classes. Namely, we introduce programs with data that can either only be destructed or only be constructed, which we enforce by a type system on the program variables. We call the resulting programs read/write- (or RW-)factorizable, show that RW-factorizable string programs capture exactly the class FP of polynomial-time functions, and that tail-recursive RW-factorizable programs capture exactly the class FL of logarithmic-space functions. Finally, we state and solve the nontrivial problem of syntactic composition of two RW-factorizable programs.","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":null,"pages":null},"PeriodicalIF":1.1,"publicationDate":"2023-06-08","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"43689921","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
Fold-unfold lemmas for reasoning about recursive programs using the Coq proof assistant – ERRATUM 使用Coq证明助手ERRATUM对递归程序进行推理的折叠展开引理
IF 1.1 3区 计算机科学 Q4 Computer Science Pub Date : 2023-03-06 DOI: 10.1017/s0956796823000011
O. Danvy
{"title":"Fold-unfold lemmas for reasoning about recursive programs using the Coq proof assistant – ERRATUM","authors":"O. Danvy","doi":"10.1017/s0956796823000011","DOIUrl":"https://doi.org/10.1017/s0956796823000011","url":null,"abstract":"","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":null,"pages":null},"PeriodicalIF":1.1,"publicationDate":"2023-03-06","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"42282522","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
Folding left and right matters: Direct style, accumulators, and continuations 左右折叠事项:直接样式、累加器和延续
IF 1.1 3区 计算机科学 Q4 Computer Science Pub Date : 2023-02-14 DOI: 10.1017/S0956796822000156
O. Danvy
Abstract The equivalence of folding left and right over Peano numbers and lists makes it possible to minimalistically inter-derive (1) structurally recursive functions in direct style, (2) structurally tail-recursive functions that use an accumulator, and (3) structurally tail-recursive functions in delimited continuation-passing style, using Ohori and Sasano’s lightweight fusion by fixed-point promotion. When the fold-left and the fold-right functions account for primitive iteration for Peano numbers, this equivalence is unconditional. When they account for primitive recursion for Peano numbers, this equivalence is modulo left permutativity of their induction-step parameter – a property which is more general than associativity and commutativity. And when they account for primitive iteration or for primitive recursion over lists, this equivalence is modulo left permutativity of their induction-step parameter if these two fold functions have the same type. Since the 1980s, however, the two fold functions for lists do not have the same type: the arguments for their induction-step parameter are swapped, a re-ordering that complicated Bird and Wadler’s duality theorems and whose history is reviewed in an appendix. Without this re-ordering, Bird and Wadler’s second duality theorem more visibly accounts for “re-bracketing,” which is a key step to make recursive programs tail recursive in the general area of program development, from Cooper in the 1960s and onwards.
摘要在Peano数和列表上左右折叠的等价性使得可以最小地相互推导出(1)直接风格的结构递归函数,(2)使用累加器的结构尾部递归函数,以及(3)定界连续传递风格的结构尾部递推函数,使用Ohori和Sasano的轻量级融合进行定点推广。当左折叠和右折叠函数对皮诺数进行基元迭代时,这种等价性是无条件的。当他们考虑到皮诺数的基元递归时,这种等价性是其归纳步长参数的模左置换性——这一性质比结合性和交换性更一般。当它们考虑到列表上的基元迭代或基元递归时,如果这两个折叠函数具有相同的类型,则这种等价性是它们的归纳步骤参数的模左置换性。然而,自20世纪80年代以来,列表的二重函数没有相同的类型:它们的归纳步长参数的自变量被交换,这一重新排序使Bird和Wadler的对偶定理变得复杂,其历史在附录中回顾。如果没有这种重新排序,Bird和Wadler的第二对偶定理更明显地解释了“重新包围”,这是使递归程序在程序开发的一般领域中尾部递归的关键步骤,从20世纪60年代的Cooper开始。
{"title":"Folding left and right matters: Direct style, accumulators, and continuations","authors":"O. Danvy","doi":"10.1017/S0956796822000156","DOIUrl":"https://doi.org/10.1017/S0956796822000156","url":null,"abstract":"Abstract The equivalence of folding left and right over Peano numbers and lists makes it possible to minimalistically inter-derive (1) structurally recursive functions in direct style, (2) structurally tail-recursive functions that use an accumulator, and (3) structurally tail-recursive functions in delimited continuation-passing style, using Ohori and Sasano’s lightweight fusion by fixed-point promotion. When the fold-left and the fold-right functions account for primitive iteration for Peano numbers, this equivalence is unconditional. When they account for primitive recursion for Peano numbers, this equivalence is modulo left permutativity of their induction-step parameter – a property which is more general than associativity and commutativity. And when they account for primitive iteration or for primitive recursion over lists, this equivalence is modulo left permutativity of their induction-step parameter if these two fold functions have the same type. Since the 1980s, however, the two fold functions for lists do not have the same type: the arguments for their induction-step parameter are swapped, a re-ordering that complicated Bird and Wadler’s duality theorems and whose history is reviewed in an appendix. Without this re-ordering, Bird and Wadler’s second duality theorem more visibly accounts for “re-bracketing,” which is a key step to make recursive programs tail recursive in the general area of program development, from Cooper in the 1960s and onwards.","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":null,"pages":null},"PeriodicalIF":1.1,"publicationDate":"2023-02-14","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"48880597","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
Programming language semantics: It’s easy as 1,2,3 编程语言语义:就像1、2、3一样简单
3区 计算机科学 Q4 Computer Science Pub Date : 2023-01-01 DOI: 10.1017/s0956796823000072
GRAHAM HUTTON
Abstract Programming language semantics is an important topic in theoretical computer science, but one that beginners often find challenging. This article provides a tutorial introduction to the subject, in which the language of integers and addition is used as a minimal setting in which to present a range of semantic concepts in simple manner. In this setting, it is easy as 1,2,3.
摘要程序设计语言语义是理论计算机科学中的一个重要课题,但对初学者来说往往是一个挑战。本文提供了该主题的教程介绍,其中使用整数和加法语言作为最小设置,以简单的方式表示一系列语义概念。在这种情况下,就像1、2、3一样简单。
{"title":"Programming language semantics: It’s easy as 1,2,3","authors":"GRAHAM HUTTON","doi":"10.1017/s0956796823000072","DOIUrl":"https://doi.org/10.1017/s0956796823000072","url":null,"abstract":"Abstract Programming language semantics is an important topic in theoretical computer science, but one that beginners often find challenging. This article provides a tutorial introduction to the subject, in which the language of integers and addition is used as a minimal setting in which to present a range of semantic concepts in simple manner. In this setting, it is easy as 1,2,3.","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":null,"pages":null},"PeriodicalIF":0.0,"publicationDate":"2023-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"134882477","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
A type-directed, dictionary-passing translation of method overloading and structural subtyping in Featherweight Generic Go 轻量级泛型围棋中对方法重载和结构子类型的类型导向、字典传递的翻译
3区 计算机科学 Q4 Computer Science Pub Date : 2023-01-01 DOI: 10.1017/s0956796823000047
MARTIN SULZMANN, STEFAN WEHR
Abstract Featherweight Generic Go (FGG) is a minimal core calculus modeling the essential features of the programming language Go. It includes support for overloaded methods, interface types, structural subtyping, and generics. The most straightforward semantic description of the dynamic behavior of FGG programs is to resolve method calls based on runtime type information of the receiver. This article shows a different approach by defining a type-directed translation from ${textrm{FGG}^{-}}$ to an untyped lambda-calculus. ${textrm{FGG}^{-}}$ includes all features of FGG but type assertions. The translation of an ${textrm{FGG}^{-}}$ program provides evidence for the availability of methods as additional dictionary parameters, similar to the dictionary-passing approach known from Haskell type classes. Then, method calls can be resolved by a simple lookup of the method definition in the dictionary. Every program in the image of the translation has the same dynamic semantics as its source ${textrm{FGG}^{-}}$ program. The proof of this result is based on a syntactic, step-indexed logical relation. The step index ensures a well-founded definition of the relation in the presence of recursive interface types and recursive methods. Although being non-deterministic, the translation is coherent.
轻量级泛型围棋(Featherweight Generic Go, FGG)是一种最小核心演算,它模拟了围棋编程语言的基本特征。它包括对重载方法、接口类型、结构子类型和泛型的支持。FGG程序动态行为的最直接的语义描述是基于接收者的运行时类型信息来解析方法调用。本文通过定义从${textrm{FGG}^{-}}$到无类型lambda演算的类型导向转换,展示了一种不同的方法。${textrm{FGG}^{-}}$包含FGG除了类型断言的所有特性。${textrm{FGG}^{-}}$程序的翻译为方法作为额外的字典参数的可用性提供了证据,类似于Haskell类型类中已知的字典传递方法。然后,可以通过在字典中查找方法定义来解析方法调用。翻译图像中的每个程序都具有与其源${textrm{FGG}^{-}}$程序相同的动态语义。这个结果的证明是基于一个语法上的、阶梯索引的逻辑关系。在存在递归接口类型和递归方法的情况下,步骤索引确保了关系的良好定义。虽然不确定,但翻译是连贯的。
{"title":"A type-directed, dictionary-passing translation of method overloading and structural subtyping in Featherweight Generic Go","authors":"MARTIN SULZMANN, STEFAN WEHR","doi":"10.1017/s0956796823000047","DOIUrl":"https://doi.org/10.1017/s0956796823000047","url":null,"abstract":"Abstract Featherweight Generic Go (FGG) is a minimal core calculus modeling the essential features of the programming language Go. It includes support for overloaded methods, interface types, structural subtyping, and generics. The most straightforward semantic description of the dynamic behavior of FGG programs is to resolve method calls based on runtime type information of the receiver. This article shows a different approach by defining a type-directed translation from ${textrm{FGG}^{-}}$ to an untyped lambda-calculus. ${textrm{FGG}^{-}}$ includes all features of FGG but type assertions. The translation of an ${textrm{FGG}^{-}}$ program provides evidence for the availability of methods as additional dictionary parameters, similar to the dictionary-passing approach known from Haskell type classes. Then, method calls can be resolved by a simple lookup of the method definition in the dictionary. Every program in the image of the translation has the same dynamic semantics as its source ${textrm{FGG}^{-}}$ program. The proof of this result is based on a syntactic, step-indexed logical relation. The step index ensures a well-founded definition of the relation in the presence of recursive interface types and recursive methods. Although being non-deterministic, the translation is coherent.","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":null,"pages":null},"PeriodicalIF":0.0,"publicationDate":"2023-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"136201823","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
Normalization by evaluation for modal dependent type theory 模态相关类型理论的求值归一化
3区 计算机科学 Q4 Computer Science Pub Date : 2023-01-01 DOI: 10.1017/s0956796823000060
JASON Z. S. HU, JUNYOUNG JANG, BRIGITTE PIENTKA
Abstract We present the Kripke-style modal type theory, Mint, which combines dependent types and the necessity modality. It extends the Kripke-style modal lambda-calculus by Pfenning and Davies to the full Martin-Löf type theory. As such it encompasses dependently typed variants of system K, T, K4, and S4. Further, Mint seamlessly supports a full universe hierarchy, usual inductive types, and large eliminations. In this paper, we give a modular sound and complete normalization-by-evaluation (NbE) proof for Mint based on an untyped domain model, which applies to all four aforementioned modal systems without modification. This NbE proof yields a normalization algorithm for Mint, which can be directly implemented. To further strengthen our results, our models and the NbE proof are fully mechanized in Agda and we extract a Haskell implementation of our NbE algorithm from it.
摘要本文提出了Kripke-style模态类型理论Mint,它结合了依赖类型和必然模态。它将Pfenning和Davies的Kripke-style模态λ演算扩展到完整的Martin-Löf类型理论。因此,它包含系统K、T、k4和s4的依赖类型变体。此外,Mint无缝地支持完整的宇宙层次结构,通常的归纳类型和大型消去。在本文中,我们给出了一个基于无类型域模型的Mint的模块化健全的、完全的评估归一化(NbE)证明,该证明适用于上述所有四种模态系统而无需修改。这个NbE证明为Mint提供了一个规范化算法,该算法可以直接实现。为了进一步加强我们的结果,我们的模型和NbE证明在Agda中完全机械化,我们从中提取了NbE算法的Haskell实现。
{"title":"Normalization by evaluation for modal dependent type theory","authors":"JASON Z. S. HU, JUNYOUNG JANG, BRIGITTE PIENTKA","doi":"10.1017/s0956796823000060","DOIUrl":"https://doi.org/10.1017/s0956796823000060","url":null,"abstract":"Abstract We present the Kripke-style modal type theory, Mint, which combines dependent types and the necessity modality. It extends the Kripke-style modal lambda-calculus by Pfenning and Davies to the full Martin-Löf type theory. As such it encompasses dependently typed variants of system K, T, K4, and S4. Further, Mint seamlessly supports a full universe hierarchy, usual inductive types, and large eliminations. In this paper, we give a modular sound and complete normalization-by-evaluation (NbE) proof for Mint based on an untyped domain model, which applies to all four aforementioned modal systems without modification. This NbE proof yields a normalization algorithm for Mint, which can be directly implemented. To further strengthen our results, our models and the NbE proof are fully mechanized in Agda and we extract a Haskell implementation of our NbE algorithm from it.","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":null,"pages":null},"PeriodicalIF":0.0,"publicationDate":"2023-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"135908024","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}
引用次数: 3
Contract lenses: Reasoning about bidirectional programs via calculation 契约透镜:通过计算对双向程序进行推理
3区 计算机科学 Q4 Computer Science Pub Date : 2023-01-01 DOI: 10.1017/s0956796823000059
HANLIANG ZHANG, WENHAO TANG, RUIFENG XIE, MENG WANG, ZHENJIANG HU
Abstract Bidirectional transformations (BXs) are a mechanism for maintaining consistency between multiple representations of related data. The lens framework, which usually constructs BXs from lens combinators, has become the mainstream approach to BX programming because of its modularity and correctness by construction. However, the involved bidirectional behaviors of lenses make the equational reasoning and optimization of them much harder than unidirectional programs. We propose a novel approach to deriving efficient lenses from clear specifications via program calculation, a correct-by-construction approach to reasoning about functional programs by algebraic laws. To support bidirectional program calculation, we propose contract lenses , which extend conventional lenses with a pair of predicates to enable safe and modular composition of partial lenses. We define several contract-lens combinators capturing common computation patterns including $textit{fold}, textit{filter},textit{map}$ , and $textit{scan}$ , and develop several bidirectional calculation laws to reason about and optimize contract lenses. We demonstrate the effectiveness of our new calculation framework based on contract lenses with nontrivial examples.
双向转换(BXs)是一种保持相关数据的多个表示之间一致性的机制。透镜框架通常由透镜组合子构造BX,由于其模块化和构造正确性,已经成为BX编程的主流方法。然而,透镜的双向行为使得它们的方程推理和优化比单向编程要困难得多。我们提出了一种新的方法,通过程序计算从清晰的规范中推导出有效的透镜,这是一种通过代数定律来推理函数程序的正确构造方法。为了支持双向程序计算,我们提出了契约透镜,它用一对谓词扩展了传统透镜,以实现部分透镜的安全和模块化组成。我们定义了几个契约透镜组合子,捕获了常见的计算模式,包括$textit{fold}, textit{filter},textit{map}$和$textit{scan}$,并开发了几个双向计算定律来推理和优化契约透镜。我们用非平凡的例子证明了基于收缩透镜的新计算框架的有效性。
{"title":"Contract lenses: Reasoning about bidirectional programs via calculation","authors":"HANLIANG ZHANG, WENHAO TANG, RUIFENG XIE, MENG WANG, ZHENJIANG HU","doi":"10.1017/s0956796823000059","DOIUrl":"https://doi.org/10.1017/s0956796823000059","url":null,"abstract":"Abstract Bidirectional transformations (BXs) are a mechanism for maintaining consistency between multiple representations of related data. The lens framework, which usually constructs BXs from lens combinators, has become the mainstream approach to BX programming because of its modularity and correctness by construction. However, the involved bidirectional behaviors of lenses make the equational reasoning and optimization of them much harder than unidirectional programs. We propose a novel approach to deriving efficient lenses from clear specifications via program calculation, a correct-by-construction approach to reasoning about functional programs by algebraic laws. To support bidirectional program calculation, we propose contract lenses , which extend conventional lenses with a pair of predicates to enable safe and modular composition of partial lenses. We define several contract-lens combinators capturing common computation patterns including $textit{fold}, textit{filter},textit{map}$ , and $textit{scan}$ , and develop several bidirectional calculation laws to reason about and optimize contract lenses. We demonstrate the effectiveness of our new calculation framework based on contract lenses with nontrivial examples.","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":null,"pages":null},"PeriodicalIF":0.0,"publicationDate":"2023-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"135449658","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
Modal FRP for all: Functional reactive programming without space leaks in Haskell Modal FRP for all: Haskell中没有空间泄漏的函数式响应式编程
IF 1.1 3区 计算机科学 Q4 Computer Science Pub Date : 2022-12-26 DOI: 10.1017/S0956796822000132
P. Bahr
Abstract Functional reactive programming (FRP) provides a high-level interface for implementing reactive systems in a declarative manner. However, this high-level interface has to be carefully reigned in to ensure that programs can in fact be executed in practice. Specifically, one must ensure that FRP programs are causal and can be implemented without introducing space leaks. In recent years, modal types have been demonstrated to be an effective tool to ensure these operational properties. In this paper, we present $mathsf{Rattus}$ , a modal FRP language that extends and simplifies previous modal FRP calculi while still maintaining the operational guarantees for productivity, causality, and space leaks. The simplified type system makes $mathsf{Rattus}$ a practical programming language that can be integrated with existing functional programming languages. To demonstrate this, we have implemented a shallow embedding of $mathsf{Rattus}$ in Haskell that allows the programmer to write $mathsf{Rattus}$ code in familiar Haskell syntax and seamlessly integrate it with regular Haskell code. Thus, $mathsf{Rattus}$ combines the benefits enjoyed by FRP libraries such as Yampa, namely access to a rich library ecosystem (e.g., for graphics programming), with the strong operational guarantees offered by a bespoke type system. To establish the productivity, causality, and memory properties of the language, we prove type soundness using a logical relations argument fully mechanised in the Coq proof assistant.
函数式响应式编程(FRP)为以声明的方式实现响应式系统提供了一个高级接口。但是,必须仔细控制这个高级接口,以确保程序实际上可以在实践中执行。具体来说,必须确保FRP方案是因果关系,并且可以在不引入空间泄漏的情况下实施。近年来,模态类型已被证明是确保这些操作特性的有效工具。在本文中,我们提出了$mathsf{Rattus}$,这是一种模态FRP语言,它扩展并简化了以前的模态FRP演算,同时仍然保持了对生产率、因果关系和空间泄漏的操作保证。简化的类型系统使$mathsf{Rattus}$成为一种实用的编程语言,可以与现有的函数式编程语言集成。为了演示这一点,我们在Haskell中实现了$mathsf{Rattus}$的浅嵌入,允许程序员用熟悉的Haskell语法编写$mathsf{Rattus}$代码,并将其与常规的Haskell代码无缝集成。因此,$mathsf{Rattus}$结合了诸如Yampa等FRP库所享有的好处,即访问丰富的库生态系统(例如,用于图形编程),以及定制类型系统提供的强大操作保证。为了建立语言的生产力、因果关系和记忆属性,我们使用Coq证明助手中完全机械化的逻辑关系论证来证明类型合理性。
{"title":"Modal FRP for all: Functional reactive programming without space leaks in Haskell","authors":"P. Bahr","doi":"10.1017/S0956796822000132","DOIUrl":"https://doi.org/10.1017/S0956796822000132","url":null,"abstract":"Abstract Functional reactive programming (FRP) provides a high-level interface for implementing reactive systems in a declarative manner. However, this high-level interface has to be carefully reigned in to ensure that programs can in fact be executed in practice. Specifically, one must ensure that FRP programs are causal and can be implemented without introducing space leaks. In recent years, modal types have been demonstrated to be an effective tool to ensure these operational properties. In this paper, we present \u0000$mathsf{Rattus}$\u0000 , a modal FRP language that extends and simplifies previous modal FRP calculi while still maintaining the operational guarantees for productivity, causality, and space leaks. The simplified type system makes \u0000$mathsf{Rattus}$\u0000 a practical programming language that can be integrated with existing functional programming languages. To demonstrate this, we have implemented a shallow embedding of \u0000$mathsf{Rattus}$\u0000 in Haskell that allows the programmer to write \u0000$mathsf{Rattus}$\u0000 code in familiar Haskell syntax and seamlessly integrate it with regular Haskell code. Thus, \u0000$mathsf{Rattus}$\u0000 combines the benefits enjoyed by FRP libraries such as Yampa, namely access to a rich library ecosystem (e.g., for graphics programming), with the strong operational guarantees offered by a bespoke type system. To establish the productivity, causality, and memory properties of the language, we prove type soundness using a logical relations argument fully mechanised in the Coq proof assistant.","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":null,"pages":null},"PeriodicalIF":1.1,"publicationDate":"2022-12-26","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"41911001","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}
引用次数: 3
期刊
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