一句话:提出有界视界量词实例化,使 SMT 检查归纳不变式终止,并证明其至少等价于手工 instrumentation。
判断一阶带量词交替的不变式 φ 是否被代码保持(归纳)不可判定;SMT 求解器可自动处理,但强量词实例化可能不终止,尤其当 φ 不归纳且存在无限反例时。本文研究 Bounded-Horizon 实例化,通过限制实例化项深度来保证终止。作者证明该方法在未解释域上检查量化不变式时意外强大,并能生成部分模型以诊断非归纳情形。核心技术结果是它至少与 instrumentation 一样强大:后者通过修改程序以允许纯全称不变式来手工保证收敛。界为 1 时即可自动模拟一类自然 instrumentation,无需修改代码。基于 Z3 的原型验证了界为 1 方法的有效性。
We consider the problem of checking whether a proposed invariant $\varphi$ expressed in first-order logic with quantifier alternation is inductive, i.e. preserved by a piece of code. While the problem is undecidable, modern SMT solvers can sometimes solve it automatically. However, they employ powerful quantifier instantiation methods that may diverge, especially when $\varphi$ is not preserved. A notable difficulty arises due to counterexamples of infinite size. This paper studies Bounded-Horizon instantiation, a natural method for guaranteeing the termination of SMT solvers. The method bounds the depth of terms used in the quantifier instantiation process. We show that this method is surprisingly powerful for checking quantified invariants in uninterpreted domains. Furthermore, by producing partial models it can help the user diagnose the case when $\varphi$ is not inductive, especially when the underlying reason is the existence of infinite counterexamples. Our main technical result is that Bounded-Horizon is at least as powerful as instrumentation, which is a manual method to guarantee convergence of the solver by modifying the program so that it admits a purely universal invariant. We show that with a bound of 1 we can simulate a natural class of instrumentations, without the need to modify the code and in a fully automatic way. We also report on a prototype implementation on top of Z3, which we used to verify several examples by Bounded-Horizon of bound 1.
@article{paperbot767,
title = {Bounded Quantifier Instantiation for Checking Inductive Invariants},
author = {Yotam M. Y. Feldman and Oded Padon and Neil Immerman and Mooly Sagiv and Sharon Shoham},
journal = {Logical Methods in Computer Science},
volume = {Volume 15, Issue 3},
year = {2019},
doi = {10.23638/lmcs-15(3:18)2019}
}