有界量词实例化用于检查归纳不变量
Bounded Quantifier Instantiation for Checking Inductive Invariants
AI总结:
本文提出有界视界量词实例化方法,限制实例化项深度以保证SMT求解器终止,能有效检查归纳不变量,且界限1时可自动模拟插桩,无需修改代码。
摘要:
我们考虑了检查一个用带量词交替的一阶逻辑表示的建议不变量 $φ$ 是否为归纳的(即被一段代码所保持)的问题。虽然该问题不可判定,但现代SMT求解器有时能自动解决它。然而,它们采用强大的量词实例化方法可能会发散,尤其是当 $φ$ 不被保持时。一个显著的困难源于无限大小的反例。本文研究了有界视界实例化,这是一种保证SMT求解器终止的自然方法。该方法限制了量词实例化过程中使用的项的深度。我们表明,这种方法在无解释域中检查量化不变量时出奇地强大。此外,通过产生部分模型,它可以帮助用户诊断 $φ$ 不是归纳的情况,特别是当根本原因是存在无限反例时。我们的主要技术结果是,有界视界至少与插桩一样强大,插桩是一种通过修改程序使其承认一个纯全称不变量来手动保证求解器收敛的方法。我们表明,使用界限1,我们可以模拟一类自然的插桩,而无需修改代码且完全自动。我们还报告了一个基于Z3的原型实现,我们用它通过界限1的有界视界验证了几个示例。
英文摘要:
We consider the problem of checking whether a proposed invariant $φ$ 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 $φ$ 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 $φ$ 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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。