Abstract
Traditional numeric static analysis domains, such as intervals or polyhedra, are often constrained by a fixed set of variables and suffer from computational complexity as the number of variables grows. This paper introduces a systematic framework to upgrade these domains to handle an unbounded number of variables using "summary dimensions." By implementing four primitive operations—add, drop, fold, and expand—the authors enable precise and sound reasoning over complex, dynamic data structures like arrays and heap-allocated objects.
Introduction
Static analysis tools rely on numeric domains to track relationships between program variables. However, these domains face two significant challenges:
- Fixed Capacity: They are typically designed for a pre-defined set of variables, making it difficult to analyze programs with dynamic memory or variable-sized arrays.
- Complexity Explosion: High-precision relational domains (e.g., Polyhedra) scale poorly, often becoming computationally intractable as the number of variables increases.
When faced with large arrays or unknown heap structures, traditional analyses often resort to conservative approximations that lose critical precision. This paper addresses these limitations by introducing a formal method for dimension summarization.
The Summarization Framework
The core innovation is the ability to represent a collection of variables using a single "summary dimension." To maintain soundness and precision, the authors define four essential operations that any numeric domain must implement:
add/drop: Standard operations for managing the set of dimensions.fold: This operation merges multiple dimensions into a single summary dimension. While this abstraction step may lose some precision, it is vital for keeping the analysis tractable.expand: This operation creates an exact copy of a summary dimension, effectively "materializing" a specific element from a collection. This allows the analysis to reason about individual elements with high precision before folding them back into the summary.
The figure above illustrates the geometric intuition behind the fold operation, where multiple dimensions in the original space (a) are projected into a summarized representation (b).
The Three-Step Transformer
To apply standard program transformations to summarized domains without losing soundness, the authors propose a three-step process:
- Preparation: Use
expandto materialize temporary, individual dimensions for the variables involved in a specific calculation. - Transformation: Apply standard numeric domain operations on these temporary dimensions.
- Clean-up: Use
foldordropto merge the results back into the summary dimensions.
This "Expand-Transform-Fold" cycle prevents the "unsoundness trap" where naive operations on summary dimensions could lead to incorrect conclusions about variable relationships.
Evaluation and Key Results
The framework was evaluated using complex programmatic benchmarks, most notably the Compressed Sparse Row (CSR) format for sparse matrix-vector multiplication. CSR is notoriously difficult for static analysis due to its use of multiple arrays and indirect indexing (e.g., a[ja[k]]).
By using a summarizing version of the Polyhedral domain, the authors successfully proved that array accesses in CSR loops remain within bounds. The approach reduced a complex state involving entire arrays to a manageable 7-dimensional polyhedron, demonstrating both the precision and efficiency of the method.
Conclusion and Future Work
This research provides a robust foundation for scaling numeric static analysis. While the framework currently relies on a "client analysis" to determine variable groupings, future work aims to integrate this approach with Shape Analysis (such as TVLA). This integration would allow for the automated verification of complex data structures like balanced trees and sorted linked lists by combining structural and numeric reasoning.
Summary updated