Introduction
Verifying the safety of procedural programs, particularly those written in C, presents a significant challenge due to the complex nature of the heap (memory). Traditional automated verifiers often rely on "inlining"—the process of expanding function calls into the caller's code. While effective for small programs, inlining leads to exponential state-space explosion and fails to handle recursion, making it unsuitable for large-scale systems. This paper presents a novel approach to compositional verification that treats memory as a first-class citizen using the theory of arrays, enabling the verification of programs function-by-function.
The Challenge of Heap Modeling
The standard mathematical framework for modeling computer memory is the Theory of Arrays (ARR). However, SMT-based (Satisfiability Modulo Theories) solvers often struggle with ARR because they lack efficient mechanisms for "projections." Projection is the process of simplifying logical formulas while preserving the essential information needed for a proof. Without efficient projection, solvers cannot generate the procedure summaries required for modular reasoning, forcing them back into the inefficient paradigm of inlining.
Methodology: Model-Based Projection for Arrays
The authors address this by developing a polynomial-time Model-Based Projection (MBP) algorithm for arrays and integrating it into the SPACER framework. The approach follows these key steps:
- CHC Representation: Program verification conditions are encoded as Constrained Horn Clauses (CHCs), a logic-based format ideal for program safety.
- Model-Based Simplification: Unlike traditional Quantifier Elimination, which is exponentially slow, MBP uses a concrete model of a program state to guide the simplification process. This transforms an exponential problem into a polynomial one.
- Compositional Reasoning: By implementing MBP within SPACER, the tool can generate "must" and "may" summaries for procedures. This allows the solver to reason about functions in isolation and reuse proofs, preventing the explosion of the state space.
Experimental Results
The researchers evaluated their tool, SPACER with ARRAYMBP, using 215 challenging benchmarks from the Device Drivers category of SV-COMP'15.
The Advantage of Compositionality
A key finding was that modularity directly translates to scalability. By avoiding inlining, the solver can prove programs safe much faster. In many instances where inlining caused standard tools to time out or exhaust memory, the compositional approach succeeded in seconds.
Performance Comparison
SPACER with ARRAYMBP significantly outperformed state-of-the-art solvers like Z3-PDR. Even when compared on inlined benchmarks, SPACER demonstrated superior performance, but its true strength lies in its ability to handle non-inlined, modular representations.
Conclusion
The introduction of a finite MBP for array-valued variables marks a significant step forward in automated program verification. By enabling efficient, compositional reasoning over the theory of arrays, the authors have provided a path toward verifying large, complex C programs that were previously out of reach for SMT-based tools. Future work will focus on extending these techniques to handle universal quantifiers, which are necessary for verifying complex data structure invariants.
Summary updated