Over-approximating (OX) program logics, such as separation logic (SL), are used for verifying properties of heap-manipulating programs: all terminating behaviour is characterised, but established results and errors need not be reachable. OX function specifications are thus incompatible with true bug-finding supported by symbolic execution tools such as Pulse and Pulse-X. In contrast, under-approximating (UX) program logics, such as incorrectness separation logic, are used to find true results and bugs: established results and errors are reachable, but there is no mechanism for understanding if all terminating behaviour has been characterised. We introduce exact separation logic (ESL), which provides fully-verified function specifications compatible with both OX verification and UX true bug-funding: all terminating behaviour is characterised, and all established results and errors are reachable. We prove soundness for ESL with mutually recursive functions, demonstrating, for the first time, function compositionality for a UX logic. We show that UX program logics require subtle definitions of internal and external function specifications compared with the familiar definitions of OX logics. We investigate the expressivity of ESL and, for the first time, explore the role of abstraction in UX reasoning by verifying abstract ESL specifications of various data-structure algorithms. In doing so, we highlight the difference between abstraction (hiding information) and over-approximation (losing information). Our findings demonstrate that, expectedly, abstraction cannot be used as freely in UX logics as in OX logics, but also that it should be feasible to use ESL to provide tractable function specifications for self-contained, critical code, which would then be used for both verification and true bug-finding.
翻译:过近似(OX)程序逻辑(如分离逻辑SL)用于验证堆操作程序的属性:所有终止行为均被刻画,但已建立的结果和错误未必可达。因此,OX函数规约与基于符号执行工具(如Pulse和Pulse-X)的真实错误检测不兼容。相反,欠近似(UX)程序逻辑(如不正确性分离逻辑)用于发现真实结果和错误:已建立的结果和错误均为可达,但缺乏理解所有终止行为是否被刻画的机制。我们提出精确分离逻辑(ESL),它提供完全验证的函数规约,兼容OX验证和UX真实错误检测:所有终止行为均被刻画,且所有已建立的结果和错误均为可达。我们证明了带相互递归函数的ESL的正确性,首次展示了UX逻辑的函数组合性。我们发现,与OX逻辑中熟悉的定义相比,UX程序逻辑需要更精细地定义内部和外部函数规约。我们研究了ESL的表达能力,并首次通过验证多种数据结构算法的精确ESL规约,探索了抽象在UX推理中的作用。在此过程中,我们突出了抽象(隐藏信息)与过近似(丢失信息)之间的区别。研究结果表明,抽象在UX逻辑中显然不能像在OX逻辑中那样自由使用,但使用ESL为自包含的关键代码提供易于处理的函数规约应该是可行的,这些规约可同时用于验证和真实错误检测。