arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1904.13049cs.PL
收藏

数据不变量编程的目标综合

Targeted Synthesis for Programming with Data Invariants

John Sarracino, Shraddha Barke, Hila Peleg, Sorin Lerner, Nadia Polikarpova

摘要:

程序员经常维护隐式数据不变量,它们是程序中不同数据结构之间的关系。传统上,这种不变量是由程序员手动执行和检查的。这种特别的实践是困难的,因为程序员必须手动考虑破坏不变式的所有位置和配置。此外,隐式不变量在代码进化下是脆弱的:当不变量和数据结构发生变化时,程序员必须重复手动修复违反不变量的所有代码位置的过程。更好的方法是将数据不变量作为语言特性引入,并依赖语言支持来维护不变量。为了应对这一挑战,我们引入了目标合成,这是一种在编译时将数据不变量与不变量无关的命令式代码集成的技术。这种技术是不平凡的,由于两个不变的规范,以及一般的命令式代码的复杂结构。关键的见解是采取一种语言协同设计方法,涉及数据不变式语言和命令式语言。我们利用这一洞察力产生两个高层次的结果:第一,我们支持迭代器的语言,而不需要一般的量化推理,第二,我们推断复杂的不变保持补丁。我们评估这些索赔通过一种语言称为Spyder,一个核心演算的数据不变式的命令式迭代程序。我们评估的表现力和性能的Spyder的各种程序的灵感来自Web应用程序,我们发现,Spyder有效地编译和维护数据不变。

英文摘要:

Programmers frequently maintain implicit data invariants, which are relations between different data structures in a program. Traditionally, such invariants are manually enforced and checked by programmers. This ad-hoc practice is difficult because the programmer must manually account for all the locations and configurations that break an invariant. Moreover, implicit invariants are brittle under code-evolution: when the invariants and data structures change, the programmer must repeat the process of manually repairing all of the code locations where invariants are violated. A much better approach is to introduce data invariants as a language feature and rely on language support to maintain invariants. To handle this challenge, we introduce Targeted Synthesis, a technique for integrating data invariants with invariant-agnostic imperative code at compile-time. This technique is nontrivial due to the complex structure of both invariant specifications, as well as general imperative code. The key insight is to take a language co-design approach involving both the language of data invariants, as well as the imperative language. We leverage this insight to produce two high-level results: first, we support a language with iterators without requiring general quantified reasoning, and second, we infer complicated invariant-preserving patches. We evaluate these claims through a language termed Spyder, a core calculus of data invariants over imperative iterator programs. We evaluate the expressiveness and performance of Spyder on a variety of programs inspired by web applications, and we find that Spyder efficiently compiles and maintains data invariants.

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

↑