arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 1012.2553cs.LO
收藏

具有局部推理和前/后状态性质的作用域逻辑

Scope Logic with Local Reasoning and Pre/Post-State Properties

Jianhua Zhao, Xuandong Li

摘要:

本文提出了一种扩展霍尔逻辑的指针程序验证方法。逻辑公式与用户定义的递归函数用于指定属性的程序状态之前/之后的程序执行。介绍了存储器访问、记录字段访问和数组元素访问的三个基本函数。引入了一些公理来指定我们逻辑中的这些基本函数。在我们的逻辑中引入了内存作用域函数(MSF)的概念。给定递归函数$f$,$f$的MSF计算在$f$的评估期间访问的存储器单元的集合。给出了一组规则来从$f$的定义中从语法上导出此MSF的定义。由于MSF也是递归函数,因此它们也有自己的MSF。给出了一个公理来说明一个MSF包含它的MSF。基于这一公理,局部推理支持谓词变量。前状态项用于指定前状态和后状态之间的关系。人们可以在后置条件中使用前状态项来表示前状态上的值。Hoare逻辑中的赋值语句公理被修改以处理指针。其基本思想是,在程序执行期间,只要递归函数的内存作用域中没有内存单元被修改,它就被求值为相同的值。另一个证明规则是为内存分配语句添加的。本文用一个简单的例子说明我们的逻辑可以处理指针程序。在附录中,Shorre-Waite算法被证明使用我们的逻辑。我们还使用选择排序程序来证明我们的逻辑可以用来证明程序与间接指定的组件。

英文摘要:

This paper presents an extension to Hoare logic for pointer program verification. Logic formulas with user-defined recursive functions are used to specify properties on the program states before/after program executions. Three basic functions are introduced to represents memory access, record-field access and array-element access. Some axioms are introduced to specify these basic functions in our logic. The concept Memory Scope Function (MSF) is introduced in our logic. Given a recursive function $f$, the MSF of $f$ computes the set of memory units accessed during the evaluation of $f$. A set of rules are given to derive the definition of this MSF syntactically from the definition of $f$. As MSFs are also recursive functions, they also have their MSFs. An axiom is given to specify that an MSF contains its MSF. Based on this axiom, local reasoning is supported with predicate variables. Pre-state terms are used to specify the relations between pre-states and post-states. People can use pre-state terms in post-conditions to represents the values on the pre-state. The axiom of assignment statements in Hoare's logic is modified to deal with pointers. The basic idea is that during the program execution, a recursive function is evaluated to the same value as long as no memory unit in its memory scope is modified. Another proof rule is added for memory allocation statements. We use a simple example to show that our logic can deal with pointer programs in this paper. In the appendix, the Shorre-Waite algorithm is proved using our logic. We also use the selection-sort program to show that our logic can be used to prove program with indirectly-specified components.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑