We present a tool for verification of deterministic programs with shared mutable references against specifications such as assertions, preconditions, postconditions, and read/write effects. We implement our tool by encoding programs with mutable references into annotated purely functional recursive programs. We then rely on function unfolding and the SMT solver Z3 to prove or disprove safety and to establish program termination. Our tool uses a new translation of programs where frame conditions are encoded using quantifier-free formulas in first-order logic (instead of relying on quantifiers or separation logic). This quantifier-free encoding enables SMT solvers to prove safety or report counterexamples relative to the semantics of procedure specifications. Our encoding is possible thanks to the expressive power of the extended array theory of the Z3 SMT solver. In addition to the ability to report counterexamples, our tool retains efficiency of reasoning about purely functional layers of data structures, providing expressiveness for mutable data but also a significant level of automation for purely functional aspects of software. We illustrate our tool through examples manipulating mutable linked structures and arrays.
翻译:我们提出了一个工具,用于核查确定性程序,其参照规格,如断言、先决条件、后期条件和读写/文字效果等,具有共同的可变引用。我们通过将带有可变引用的可变引用程序编码为附加注释的纯功能递转程序来实施我们的工具。我们随后依靠正在展开的函数和SMT SS求解器 Z3 来证明或否定安全,并建立程序终止。我们的工具使用一种新的程序翻译,其中框架条件使用第一阶逻辑中无限定性公式编码(而不是依赖量化或分离逻辑 ) 。这种无量化编码使 SMT 解码器能够证明安全,或者报告与程序规格的语义相对的反抽样。我们编码之所以可能,是因为Z3 SMTS求解码器的扩展阵列理论具有明确的力量。除了报告反抽样的能力外,我们的工具保留了纯功能数据结构层次的推理效率,为变异性数据提供了清晰度,但软件的纯功能方面也有相当的自动化程度。我们通过操纵变动结构与阵列的例子来说明我们的工具。