Extensional equality preservation and verified generic programming

IF 1.1 3区 计算机科学 Q4 COMPUTER SCIENCE, SOFTWARE ENGINEERING
N. Botta, N. Brede, Patrik Jansson, T. Richter
{"title":"Extensional equality preservation and verified generic programming","authors":"N. Botta, N. Brede, Patrik Jansson, T. Richter","doi":"10.1017/S0956796821000204","DOIUrl":null,"url":null,"abstract":"Abstract In verified generic programming, one cannot exploit the structure of concrete data types but has to rely on well chosen sets of specifications or abstract data types (ADTs). Functors and monads are at the core of many applications of functional programming. This raises the question of what useful ADTs for verified functors and monads could look like. The functorial map of many important monads preserves extensional equality. For instance, if \n$$f,g \\, : \\, A \\, \\to \\, B$$\n are extensionally equal, that is, \n$$\\forall x \\in A$$\n , \n$$f \\, x = g \\, x$$\n , then \n$$map \\, f \\, : \\, List \\, A \\to List \\, B$$\n and \n$$map \\, g$$\n are also extensionally equal. This suggests that preservation of extensional equality could be a useful principle in verified generic programming. We explore this possibility with a minimalist approach: we deal with (the lack of) extensional equality in Martin-Löf’s intensional type theories without extending the theories or using full-fledged setoids. Perhaps surprisingly, this minimal approach turns out to be extremely useful. It allows one to derive simple generic proofs of monadic laws but also verified, generic results in dynamical systems and control theory. In turn, these results avoid tedious code duplication and ad-hoc proofs. Thus, our work is a contribution toward pragmatic, verified generic programming.","PeriodicalId":15874,"journal":{"name":"Journal of Functional Programming","volume":" ","pages":""},"PeriodicalIF":1.1000,"publicationDate":"2020-08-05","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"4","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Journal of Functional Programming","FirstCategoryId":"94","ListUrlMain":"https://doi.org/10.1017/S0956796821000204","RegionNum":3,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q4","JCRName":"COMPUTER SCIENCE, SOFTWARE ENGINEERING","Score":null,"Total":0}
引用次数: 4

Abstract

Abstract In verified generic programming, one cannot exploit the structure of concrete data types but has to rely on well chosen sets of specifications or abstract data types (ADTs). Functors and monads are at the core of many applications of functional programming. This raises the question of what useful ADTs for verified functors and monads could look like. The functorial map of many important monads preserves extensional equality. For instance, if $$f,g \, : \, A \, \to \, B$$ are extensionally equal, that is, $$\forall x \in A$$ , $$f \, x = g \, x$$ , then $$map \, f \, : \, List \, A \to List \, B$$ and $$map \, g$$ are also extensionally equal. This suggests that preservation of extensional equality could be a useful principle in verified generic programming. We explore this possibility with a minimalist approach: we deal with (the lack of) extensional equality in Martin-Löf’s intensional type theories without extending the theories or using full-fledged setoids. Perhaps surprisingly, this minimal approach turns out to be extremely useful. It allows one to derive simple generic proofs of monadic laws but also verified, generic results in dynamical systems and control theory. In turn, these results avoid tedious code duplication and ad-hoc proofs. Thus, our work is a contribution toward pragmatic, verified generic programming.
可扩展的等式保持和已验证的泛型编程
摘要在经过验证的泛型编程中,不能利用具体数据类型的结构,而必须依赖于精心选择的规范集或抽象数据类型(ADT)。函数和单元是函数编程的许多应用程序的核心。这就提出了一个问题,即对于已验证的函子和单元,什么样的ADT是有用的。许多重要单元的函数映射保持了外延相等性。例如,如果$$f,g\,:\,A\,\to\,B$$外延相等,也就是说,$$\对于A$$,$$f\,x=g\,x$$中的所有x\,那么$$map\,f\,:\List\,A\toList\,B$$和$$map \,g$$也外延相等。这表明,在经过验证的泛型编程中,保持外延相等可能是一个有用的原则。我们用一种极简主义的方法来探索这种可能性:我们在不扩展理论或使用完整的setoid的情况下,处理Martin-Löf的内涵类型理论中(缺乏)外延平等的问题。也许令人惊讶的是,这种最小的方法被证明是非常有用的。它允许人们导出一元定律的简单通用证明,但也可以在动力系统和控制理论中得到验证的通用结果。反过来,这些结果避免了乏味的代码重复和特别的证明。因此,我们的工作是对实用的、经过验证的通用编程的贡献。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
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.
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信