An SMT Solver for Regular Expressions and Linear Arithmetic over String Length
Murphy Berzish, Mitja Kulczynski, Federico Mora, Florin Manea, Joel D. Day, Dirk Nowotka, Vijay Ganesh
Abstract
Abstract We present a novel length-aware solving algorithm for the quantifier-free first-order theory over regex membership predicate and linear arithmetic over string length. We implement and evaluate this algorithm and related heuristics in the Z3 theorem prover. A crucial insight that underpins our algorithm is that real-world regex and string formulas contain a wealth of information about upper and lower bounds on lengths of strings, and such information can be used very effectively to simplify operations on automata representing regular expressions. Additionally, we present a number of novel general heuristics, such as the prefix/suffix method, that can be used to make a variety of regex solving algorithms more efficient in practice. We showcase the power of our algorithm and heuristics via an extensive empirical evaluation over a large and diverse benchmark of 57256 regex-heavy instances, almost 75% of which are derived from industrial applications or contributed by other solver developers. Our solver outperforms five other state-of-the-art string solvers, namely, CVC4, OSTRICH, Z3seq, Z3str3, and Z3-Trau, over this benchmark, in particular achieving a speedup of 2.4 × over CVC4, 4.4 × over Z3seq, 6.4 × over Z3-Trau, 9.1 × over Z3str3, and 13 × over OSTRICH.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Cited by top-tier papers11
- Word Equations in Synergy with Regular ConstraintsFrantisek Blahoudek, Yu-Fang Chen, David Chocholatý, Vojtech Havlena et al.FM 2023 · 16 citations
- Solving String Constraints Using SATKevin Lotz, Amit Goel, Bruno Dutertre, Benjamin Kiesl-Reiter et al.CAV 2023 · 11 citations
- Speeding up SMT Solving via Compiler OptimizationBenjamin Mikek, Qirun ZhangFSE 2023 · 11 citations
- Incremental Dead State Detection in Logarithmic TimeCaleb Stanford, Margus VeanesCAV 2023 · 4 citations
- Coinductive Proofs of Regular Expression Equivalence in Zero KnowledgeJohn C. Kolesar, Shan Ali, Timos Antonopoulos, Ruzica PiskacOOPSLA 2025 · 4 citations
Builds on2
- Symbolic Boolean derivatives for efficiently solving extended regular expression constraintsCaleb Stanford, Margus Veanes, Nikolaj S. BjørnerPLDI 2021 · 38 citations
- Efficient handling of string-number conversionParosh Aziz Abdulla, Mohamed Faouzi Atig, Yu-Fang Chen, Bui Phi Diep et al.PLDI 2020 · 25 citations
Related papers
- String Solving with Stabilization and TransducersDavid Chocholatý, Vojtech Havlena, Lukás Holík, Juraj Síc et al.CAV 2026
- Inter-theory dependency analysis for SMT string solversMinh-Thai Trinh, Duc-Hiep Chu, Joxan JaffarOOPSLA 2020 · 5 citations
- Regex Decision Procedures in Extended RE#Ian Erik Varatalu, Margus Veanes, Ekaterina Zhuchko, Juhan P. ErnitsCAV 2025 · 3 citations
- The Power of Regular Constraint PropagationMatthew Hague, Artur Jez, Anthony Widjaja Lin, Oliver Markgraf et al.OOPSLA 2025 · 2 citations
- A Constraint Solving Approach to Parikh Images of Regular LanguagesAmanda Stjerna, Philipp RümmerOOPSLA 2024 · 2 citations
