We use cookies to improve your experience with our site.

形状图逻辑和形状图系统

A Shape Graph Logic and A Shape System

  • 摘要: 指针程序的分析和验证一直是个难题,本文用形状图逻辑和形状系统来解决其中的困难,并采取先用形状分析构建各程序点的形状图,再借助形状图进行其它性质验证的两阶段方式完成指针程序的验证。所实现的系统原型可自动验证使用splay tree, treap, AVL tree 和 AA tree等数据结构的程序。本文提出一种直接把形状图作为程序中指针断言的形状图逻辑。它是Hoare逻辑的一种扩展,可用于对操作易变数据结构的指针程序的分析和验证。用形状图表示指针断言的好处是,便于程序验证阶段获取所需的指针信息。其次,提出形状系统概念。它要求程序员在声明递归结构体的类型时,指明其指针域参与构建的数据结构的形状,在形状分析阶段的形状检查据此排除所构建的形状偏离程序员期望的程序。其好处是可免去程序员为程序验证提供有关指针的函数前后条件和循环不变式。此外,还提出利用形状图来消除访问路径别名,让程序验证阶段对形状以外性质的验证仍用Hoare逻辑的规则进行推理的方法。该方法使得程序验证阶段生成的验证条件仍可以用通常的定理证明器来证明。

     

    Abstract: Analysis and verification of pointer programs are still difficult problems so far. This paper uses a shape graph logic and a shape system to solve these problems in two stages. First, shape graphs at every program point are constructed using an analysis tool. Then, they are used to support the verification of other properties (e.g., orderedness). Our prototype supports automatic verification of programs manipulating complex data structures such as splay trees, treaps, AVL trees and AA trees, etc. The proposed shape graph logic, as an extension to Hoare logic, uses shape graphs directly as assertions. It can be used in the analysis and verification of programs manipulating mutable data structures. The benefit using shape graphs as assertions is that it is convenient for acquiring the relations between pointers in the verification stage. The proposed shape system requires programmers to provide lightweight shape declarations in recursive structure type declarations. It can help rule out programs that construct shapes deviating from what programmers expect (reflected in shape declarations) in the analysis stage. As a benefit, programmers need not provide specifications (e.g., pre-/post-conditions, loop invariants) about pointers. Moreover, we present a method doing verification in the second stage using traditional Hoare logic rules directly by eliminating aliasing with the aid of shape graphs. Thus, verification conditions could be discharged by general theorem provers.

     

/

返回文章
返回