TL;DR
This paper introduces a novel approach called Inductive Reachability Witnesses (IRWs) to automatically verify whether a program can reach a specific set of target states, even for complex loops and real-valued variables. Their method leverages powerful mathematical theorems from real algebraic geometry to synthesize these witnesses, achieving completeness for linear programs and semi-completeness for polynomial programs, outperforming existing tools on challenging benchmarks.
What Problem Does This Paper Address?
The paper tackles the fundamental problem of reachability analysis in imperative programs with real variables. This is crucial for program verification, as it allows us to determine if a program can enter undesirable states (bugs) or reach desirable states. Existing methods struggle with:
- General loops: Many techniques can't handle loops that run an unbounded number of times.
- Completeness guarantees: Abstract interpretation often provides over-approximations, meaning it might miss reachable states or incorrectly report non-reachability.
- Automation: Some methods require significant manual effort (e.g., writing assertions).
- Real variables: Handling continuous domains is inherently more complex than discrete ones.
The authors aim to provide a method that is complete (for linear programs), sound, fully automated, and capable of handling complex loops and real variables.
Methods
The core of the paper's contribution lies in the concept of Inductive Reachability Witnesses (IRWs). An IRW is a pair consisting of:
- A T-inductive set (Tº): This is an under-approximation of states from which a target state can be reached. Unlike invariants (which over-approximate reachable states), Tº represents states that can lead to the target. This set has an "inductive" property: from any state in Tº (that isn't already a target), there's a way to transition to another state within Tº.
- A T-ranking function (f): This function, defined over Tº, provides a measure that strictly decreases with each step. This guarantees that execution cannot stay within Tº forever without eventually reaching the target set.
The authors then develop automated synthesis algorithms for linear and polynomial IRWs. These algorithms leverage:
- Stellensätze (Positivstellensätze): These are powerful theorems from real algebraic geometry (like Putinar's Positivstellensatz and Hilbert's Strong Nullstellensatz) that connect polynomial inequalities with the existence of sums of squares and algebraic structures.
- Farkas' Lemma: Used for linear constraints, it provides a way to check entailment between linear inequalities.
- Handelman's Theorem: Used for polynomial constraints, it characterizes positive polynomials over polyhedra.
The synthesis process involves:
- Template generation: Creating symbolic templates for the unknown coefficients of the IRW.
- Constraint pair generation: Encoding the IRW properties (T-inductivity, ranking function, initial state) into mathematical constraints.
- Stellensätze application: Translating these constraints into a system of quadratic (in)equalities over the template variables, eliminating program variables.
- Initial constraint computation: Ensuring a valid initial state exists.
- Quadratic Programming (QP) solving: Using off-the-shelf solvers to find values for the template coefficients.
Datasets
- SV-COMP 2020 Benchmarks: The authors evaluated their linear approach on a subset of benchmarks from the Software Verification Competition (SV-COMP) 2020, specifically those in the "Reachability/Safety" category that could be modeled with real variables.
- Newly Introduced Polynomial Benchmarks: For the polynomial case, the authors created 6 simple programs designed to showcase their approach's ability to handle complex reachability scenarios, as existing benchmarks primarily focused on safety.
Key Insights and Ideas
- Dual Nature of Invariants and Reachability: The paper highlights that inductive sets used for reachability (under-approximations of states leading to a target) are natural duals of inductive invariants (over-approximations of reachable states).
- Stellensätze as a Powerful Tool for Verification: The authors demonstrate that advanced theorems from real algebraic geometry can be effectively applied to automate program verification tasks like reachability analysis, bridging the gap between theoretical mathematics and practical software engineering.
- IRWs Handle "Deep Bugs" Effectively: The approach's independence from path length makes it adept at finding bugs that are only reachable after very long execution paths, a challenge for many other methods.
- Completeness for Linear Programs: The theoretical guarantees of soundness and completeness for linear IRWs are significant, providing strong assurances for this class of programs.
Key Results
- Outperforms Existing Tools: The approach successfully verified all linear reachability benchmarks from SV-COMP 2020, outperforming tools like CPAchecker and VeriAbs, especially on benchmarks with longer and sparser paths.
- Handles Polynomial Programs: The method successfully handled all 6 custom polynomial benchmarks, demonstrating its capability in more complex scenarios where other tools failed.
- Efficiency: For linear benchmarks, the total runtime was competitive, and for some deep bug scenarios, it was significantly faster than other methods.
- Soundness and Completeness: The paper provides theoretical proofs for the soundness and completeness of IRWs for existential reachability and UIRWs for universal reachability.
Limitations and Future Work
- Semi-Completeness for Polynomials: The polynomial synthesis algorithm is semi-complete, meaning it might not find a witness even if one exists, due to the need to fix polynomial degrees. The authors suggest that increasing technical constants can improve completeness in practice.
- Floating-Point Numbers: The current approach is not directly applicable to floating-point numbers, as abstracting them to reals is unsound.
- Manual Effort for Incorrectness Logic: While the approach is automated for IRW synthesis, extending it to automate proofs in incorrectness logic would be a valuable direction.
- Advanced Ranking Functions: Incorporating more sophisticated ranking function synthesis methods (e.g., lexicographic ranking functions) could enhance the approach.
- Disjunctive IRWs: Extending the framework to handle disjunctive IRWs (where Tº is defined by a disjunction of inequalities) is a promising avenue for increased expressiveness.
Summary updated