一句话:在 Coq 中为 Why3 逻辑片段建立形式语义,并机器化验证其证明系统与变换的可靠性。
Why3、Boogie 等中间验证语言把程序验证器的构建转化为逻辑编译问题,但工具链本身是否正确缺乏保证;VST、CakeML 等基础方法虽提供强保证,却难以构建且无法利用 SMT 求解器自动化。作为迈向兼具基础保证与自动化的工具的第一步,本文在 Coq 中为 Why3 的逻辑片段(含多态、代数数据类型、递归函数与谓词、归纳谓词)给出形式语义,并基于该语义构造了一个正确性由构造保证的自然演绎证明系统。作者用该系统验证了 Why3 标准库的部分内容,并证明 Why3 中两个将项与公式转换到后端求解器所支持更简单逻辑的变换是可靠的。
Intermediate verification languages like Why3 and Boogie have made it much easier to build program verifiers, transforming the process into a logic compilation problem rather than a proof automation one. Why3 in particular implements a rich logic for program specification with polymorphism, algebraic data types, recursive functions and predicates, and inductive predicates; it translates this logic to over a dozen solvers and proof assistants. Accordingly, it serves as a backend for many tools, including Frama-C, EasyCrypt, and GNATProve for Ada SPARK. But how can we be sure that these tools are correct? The alternate foundational approach, taken by tools like VST and CakeML, provides strong guarantees by implementing the entire toolchain in a proof assistant, but these tools are harder to build and cannot directly take advantage of SMT solver automation. As a first step toward enabling automated tools with similar foundational guarantees, we give a formal semantics in Coq for the logic fragment of Why3. We show that our semantics are useful by giving a correct-by-construction natural deduction proof system for this logic, using this proof system to verify parts of Why3’s standard library, and proving sound two of Why3’s transformations used to convert terms and formulas into the simpler logics supported by the backend solvers.