Abstract
String constraint solving is a cornerstone of modern software verification and security analysis, yet many existing solvers struggle with complex functional transformations and lack formal completeness for expressive fragments. This report introduces Regular Constraint Propagation (RCP), a principled method for solving string constraints by iteratively propagating regular language information through string functions. We define the orderable fragment, a new decidable class of constraints that subsumes several previously known fragments. Experimental results show that RCP, implemented in the OSTRICH solver, significantly outperforms state-of-the-art solvers on challenging benchmarks, including Post’s Correspondence Problem (PCP) and bioinformatics-inspired string transformations.
1. Introduction
Automated string solving is essential for detecting vulnerabilities such as Cross-Site Scripting (XSS) and SQL injection. Most contemporary solvers rely on "equation splitting," a technique that decomposes complex word equations into simpler components. While effective in many scenarios, splitting often requires intricate, hand-tuned heuristics and lacks completeness guarantees for complex operations like replaceAll or general transducers.
There is a critical need for a more generic approach to handle the flow of information in string formulas, particularly when multiple operations act on the same variables. This paper addresses this gap by proposing Regular Constraint Propagation (RCP), which shifts the focus from structural splitting to the algorithmic propagation of regular language constraints.
2. Regular Constraint Propagation (RCP)
RCP operates by treating string functions as transformations on regular languages. The method relies on two primary mechanisms:
- Forward Propagation: Computing the "image" of regular languages from inputs to outputs. For instance, given a concatenation $z = x \cdot y$, if $x \in A$ and $y \in B$, then $z$ must belong to the language $A \cdot B$.
- Backward Propagation: Computing the "pre-image" from outputs back to inputs, allowing the solver to refine the possible values of variables based on the constraints of their results.
These mechanisms are formalized into a proof system consisting of four rules: Close (to detect unsatisfiability), Intersect (to merge multiple constraints on a single variable), Fwd-Prop, and Bwd-Prop. By treating functions as transducers, RCP handles global transformations like replaceAll as naturally as simple concatenation.
3. The Orderable Fragment
A major theoretical contribution of this work is the definition of the orderable fragment. To identify this fragment, the authors utilize a "Marking Algorithm" that tracks the flow of constraints through a set of equations. If a valid sequence of propagations can be found that "covers" all equations in the formula, the method is guaranteed to be sound and complete.
This orderable fragment represents a significant advancement in string theory, as it is a "super-fragment" that subsumes two of the most expressive previously known decidable fragments: straight-line and chain-free constraints. This provides a unified, flow-based understanding of decidability in string logic.
4. Experimental Evaluation
The authors integrated RCP into the OSTRICH solver and evaluated it against leading solvers, including Z3, cvc5, and Z3-Noodler, across three distinct benchmark suites:
- SMT-LIB '24: 2,000 formulas sampled from the standard industry benchmark suite.
- PCP Benchmarks: 1,000 random instances of Post’s Correspondence Problem. PCP is a classic undecidable problem that serves as a rigorous test for string solver robustness.
- Bioinformatics Benchmarks: 1,000 instances modeling RNA-to-DNA reverse transcription, characterized by complex sequences of
replaceAlloperations.
5. Results and Discussion
The experimental results demonstrate the transformative impact of RCP:
- PCP Dominance: RCP solved 901 out of 1,000 PCP instances. In stark contrast, every other tested solver (Z3, cvc5, etc.) solved zero instances. This highlights RCP's unique ability to reason about recursive string structures.
- Bioinformatics Success: RCP achieved a 100% success rate on the bioinformatics benchmarks, where general-purpose SMT solvers largely failed.
- Solver Enhancement: Integrating RCP into the OSTRICH solver reduced the number of unsolved SMT-LIB benchmarks by 60%. Furthermore, in a "virtual best portfolio" analysis, RCP reduced unsolved benchmarks by 25% to 74%, indicating it is a powerful complementary technique to existing algorithms.
Despite these strengths, RCP is not a universal replacement. For "easy" or standard SMT-LIB problems, solvers like Z3-Noodler may still maintain an edge in raw execution speed. Additionally, RCP alone cannot solve certain quadratic word equations (e.g., $xyxy = yxyx$), suggesting that it should be used in tandem with dedicated word equation algorithms.
6. Conclusion
Regular Constraint Propagation offers a simple yet potent framework for string solving. By moving away from rigid structural definitions toward a fluid, flow-based understanding of constraints, RCP provides both theoretical completeness for the orderable fragment and unprecedented empirical performance on complex benchmarks. Future work will focus on developing adaptive heuristics for the Cut rule, extending RCP to handle sequences over infinite alphabets, and integrating advanced length reasoning to further expand the solver's capabilities.
Summary updated