Introduction
Formal program verification often faces a significant "usability" hurdle: the manual effort required to design appropriate abstractions. In a paper presented at CAV 2005, researchers bridged the gap between static analysis and machine learning to automate the discovery of complex logical properties necessary for proving program correctness. By employing Inductive Logic Programming (ILP), the authors demonstrate a method to learn new logical relations from observed program states, eliminating the need for human experts to manually define "instrumentation relations."
The Challenge of Shape Analysis
Static program analysis, particularly "shape analysis" for pointers and heap-allocated data structures, frequently utilizes 3-valued logic. In this framework, memory is abstracted such that a single "summary individual" can represent multiple concrete memory cells. While this abstraction manages state space explosion, it often loses critical information, resulting in "maybe" ($1/2$) truth values.
To prove properties like "is this list sorted?", analysts traditionally had to manually define instrumentation relations—additional logical formulas that track specific properties, such as reachability or data ordering ($dle$). Identifying these relations requires deep insight into program behavior and has long been considered the "black art" of shape analysis. Furthermore, because the underlying logic is often undecidable, standard refinement techniques relying on theorem provers are frequently ineffective or computationally expensive.
Automated Refinement via Inductive Logic Programming
The proposed solution is an iterative abstraction-refinement loop that replaces the theorem prover with an inductive learning component. Integrated into the Three-Valued Logic Analyzer (TVLA), the system identifies "information-loss points" where concrete memory configurations are merged into an abstract one, causing precision loss.
The refinement process follows several key steps:
- Subformula-Based Refinement: The system attempts to decompose the user's query into constituent parts to use as new relations.
- ILP-Based Learning: If subformulas are insufficient, the system uses a modified First-Order Inductive Learner (FOIL) algorithm. It treats merged individuals as positive examples and others as negative examples to find a distinguishing logical formula.
- Finite Differencing: Once a new relation is learned, the system automatically generates update rules for how that relation evolves during program execution.
By learning from observed instances rather than attempting to prove general theorems, the system bypasses the limitations of undecidability in complex logical domains.
Evaluation and Results
The approach was evaluated on classic pointer-manipulating routines, including sorting algorithms (InsertSort, BubbleSort), list operations (Merge, Reverse), and binary search tree operations.
The system achieved full automation, successfully verifying properties like sortedness and stability without manual intervention. Notably, the ILP algorithm "rediscovered" complex relations, such as inOrder, which previously required significant human effort to define. The performance overhead was minimal; the learning step typically took less than 10 seconds, with total analysis times comparable to those using manually-tuned abstractions. The method even handled "stability" queries—proving that relative order is preserved for equal keys—a notoriously difficult verification task.
Conclusion
This research demonstrates that the exact point of abstraction failure contains the necessary data to fix it. By leveraging ILP to discover unary and binary relations, the authors have provided a path toward more usable and automated formal verification. Future work aims to refine the pruning of learned relations and scale the framework to larger software systems.
Summary updated