Symbolically Computing Most-Precise Abstract Operations for Shape Analysis

Greta Yorsh, Thomas W. Reps, Shmuel Sagiv

Introduction

Shape analysis is a critical component of software verification, focused on determining how programs manipulate complex memory structures such as linked lists, trees, and graphs. By employing abstract interpretation, tools like the Three-Valued Logic Analyzer (TVLA) represent an infinite variety of concrete memory states using a finite set of abstract structures. However, a persistent challenge in this field is maintaining precision. Traditional abstract transformers—the operations that update the analyzer's "guess" of the memory state—are often manually designed and overly conservative. This conservatism, while safe, frequently leads to false alarms by losing more information than necessary.

The Challenge of Precision

When a program encounters a conditional statement or a function call, the analyzer must refine its abstract representation. The goal is to compute the "most-precise" update possible. Historically, this has been a manual engineering task. This paper introduces a symbolic algorithm to automate this process, pushing abstract operations to their theoretical limit of accuracy.

The relationship between concrete and abstract domains during the assume operation.

As illustrated in Figure 1, the operation $\widehat{assume}[\phi](a)$ aims to find the tightest abstract representation for all concrete memory states that satisfy both the current abstraction $a$ and a logical condition $\phi$. This process effectively narrows the set of represented concrete states to the subset $X$ that satisfies the condition.

Methodology: Symbolic Computation of $\widehat{assume}$

The authors propose a two-phase algorithm to compute the most-precise abstract value. The core innovation lies in treating precision as a search problem guided by logic-based decision procedures and theorem provers.

  1. Materialization (Bifurcation): Abstract structures often use "summary nodes" to represent multiple concrete memory cells. If a condition $\phi$ implies the existence of a specific cell, the algorithm "bifurcates" these summary nodes into individual, distinct nodes.
  2. Refining Predicate Values: The algorithm iteratively examines "indefinite" values (marked as $1/2$ in three-valued logic), where the analyzer is uncertain about a pointer's existence. It uses a theorem prover to determine if a concrete version of the structure can exist where the pointer is definitely present (1) or absent (0). If a possibility is logically impossible, it is discarded, thereby sharpening the abstraction.
Example of abstract structures representing linked-list states during analysis.

Figure 2 demonstrates how TVLA represents these states. The nodes $u_1, u_y, u_2$ represent memory elements, and the arrows represent pointer relationships. The algorithm refines these structures (from $S$ to the set $S_0-S_7$) by systematically eliminating inconsistent configurations based on the program's logic.

Experimental Evaluation

The symbolic approach was implemented within the TVLA framework using the SPASS theorem prover. The authors evaluated the prototype on linked-list manipulations, such as checking if a list contains at least two elements. In a representative test case, the prototype made 158 calls to SPASS and completed the analysis in approximately 27 seconds. While slower than traditional manual methods, these results prove that symbolic precision is computationally feasible for complex data structures.

Key Insights and Future Directions

A major advantage of this approach is that it iterates from "above." By starting with a general abstraction and whittling it down, the algorithm remains safe even if the theorem prover times out; it simply returns the most refined version found so far.

However, limitations remain. The current reliance on general-purpose theorem provers like SPASS introduces performance overhead and lacks support for "transitive closure," which is essential for analyzing reachability in structures like trees. Future work will focus on developing specialized decision procedures for logics like $\exists\forall^{DTC(E)}$ to improve both speed and the range of supported data structures.

Summary updated

BibTeX
@inproceedings{yorsh2004symbolically,
  author = {Greta Yorsh and Thomas W. Reps and Shmuel Sagiv},
  title = {{Symbolically Computing Most-Precise Abstract Operations for Shape Analysis}},
  booktitle = {TACAS},
  year = {2004},
  doi = {10.1007/978-3-540-24730-2\_39},
}
Figure