arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1708.02328cs.PLcs.LO
收藏

衍生守法型

Deriving Law-Abiding Instances

Ryan Scott, Vikraman Choudhury, Ryan Newton, Niki Vazou, Ranjit Jhala

摘要:

Liquid Haskell的精化-反射特性增强了Haskell语言的定理证明功能,允许程序员使用证明来改进现有代码。但是,这些证明中的许多都需要编写繁琐的常规样板代码。此外,许多这样的证明不能很好地扩展,因为证明项的大小可以随着证明中涉及的数据集的大小而超线性地增长。我们提出了一种技术,利用数据类型通用编程,解决了这个问题,细化反射编程。我们的观察是,我们可以采用任何代数数据类型,生成等价的表示类型,并让Liquid Haskell自动构造(并证明)原始类型和表示类型之间的同构。这减少了许多证明到简单的代数“积木”类型上的简单定理,允许程序员便宜而愉快地编写通用证明。

英文摘要:

Liquid Haskell's refinement-reflection feature augments the Haskell language with theorem proving capabilities, allowing programmers to retrofit their existing code with proofs. But many of these proofs require routine, boilerplate code that is tedious to write. Moreover, many such proofs do not scale well, as the size of proof terms can grow superlinearly with the size of the datatypes involved in the proofs. We present a technique for programming with refinement reflection which solves this problem by leveraging datatype-generic programming. Our observation is that we can take any algebraic datatype, generate an equivalent representation type, and have Liquid Haskell automatically construct (and prove) an isomorphism between the original type and the representation type. This reduces many proofs down to easy theorems over simple algebraic "building block" types, allowing programmers to write generic proofs cheaply and cheerfully.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑