Source-linked AI summary
Quantifying SMT Solver Instability for Formal Verification
Daniel Evans, Rylie Hansen, John Shorter
TL;DR
Small changes to semantically equivalent SMT queries can produce sharply different solver runtimes, while timeout-heavy runtime distributions have made instability difficult to quantify. The paper measures instability across three software domains using CV and other methods. Instability appears in every domain and is associated with greater query difficulty; runtime-focused query restructuring is presented as a possible way to reduce instability and runtime.
Problem
The scope of SMT instability remains uncertain, and abnormal runtime distributions and timeouts make it difficult to quantify or compare.
Source: §1 · p. 2Method
The study applies CV and other statistical methods to 60,000 semantically equivalent SMT query mutations across three software domains, using success-rate analysis when timeouts prevent runtime estimation.
Source: §1 · p. 2, §3.1 · pp. 3–4Results
Instability affects cvc5 and Z3 in all three domains, and greater query difficulty is a significant positive predictor of instability.
Source: §5 · p. 8Takeaways & Limitations
Optimizing query structure for runtime rather than only success rate or variance could mitigate instability while reducing solver runtimes.
Source: §4.3 · p. 8, §5 · p. 8
Abstract
from arXiv · showhide
Program verification has become commonplace in software development projects, and much of its feasibility can be attributed to the potential of SMT solvers to automate model checking and other verification techniques. However, SMT instability, a phenomenon where semantically equivalent permutations of source code take much longer to solve or timeout, has been found to interrupt workflows and make software engineers more likely to avoid verification. Previous efforts to measure SMT instability have had difficulty quantifying it due to the abnormal runtime distributions it produces. In this paper, we use the coefficient of variation to model instability across an extensive dataset of SMT queries from three software domains. Our results show that SMT instability is significant in each area, and that it increases for queries that take longer on average. However, using a novel method to quantify instability, we show that a different approach is possible: if a solution were to optimize the structure of queries for runtime, rather than variance, instability could be mitigated while also improving overall solver performance.
1 Introduction
SMT solvers make formal verification more feasible, but their heuristics can make runtimes sensitive to small source-code changes or equivalent query permutations. This paper measures instability across 60,000 SMT query forms in three software domains and examines runtime-focused mitigation.
1 Introduction
- SMT solvers support model checking, symbolic execution, and proof-oriented programming, but solving queries can be time-consuming because the problem is NP-complete.Solvers use heuristics to navigate the solution space.Source: §1 · p. 2
- Small source-code changes or logically equivalent query permutations can produce significantly different solver runtimes, making verification potentially intractable after minor edits.The paper describes this phenomenon as the butterfly effect, proof brittleness, or proof instability.Source: §1 · p. 2
- The study applies the coefficient of variation and other statistical methods to 60,000 SMT query forms across three software domains.It reports significant instability in complete samples and evidence of instability in distributions with timeouts.Source: §1 · p. 2
2 Background
Prior work established SMT instability and developed ways to measure or mitigate it, but runtime distributions and timeouts complicate comparison. Existing measures also leave gaps in quantifying instability or accounting for query difficulty.
2 Background
- Instability has been observed in large-scale industry verification projects, including work at Microsoft and Amazon,,,.Source: §2 · p. 2
- Mariposa treated a query as one of a distribution of semantically equivalent mutations, while success rate simplified timeout-heavy results but lost the ability to compare instability across query sets.Mariposa was developed to investigate instability in Dafny proofs.Source: §2 · pp. 2–3
- Shake uses context pruning, and Cazamariposas identifies candidate qualifiers for instability and suggests repairs,.Prior work also linked problematic axioms to instability.Source: §2 · p. 3
- A canonical form for equivalent queries could eliminate instability from irrelevant changes, but finding one is NP-complete; MAD over penalized runtime scores also cannot establish timeout runtimes or adjust for query difficulty.The penalized runtime score uses twice the timeout time for failed solves; MAD is the Median Absolute Deviation.Source: §2 · p. 3
3 Methodology
The methodology measures runtime variation across semantically equivalent query mutations, using CV when runtimes are estimable and a success-rate procedure when timeouts prevent estimation. It evaluates cvc5 and Z3 on three query domains, with random and difficult samples and assertion shuffling.
3.1 Quantifying Instability
- The coefficient of variation (CV) measures runtime variation relative to the mutant set’s mean runtime, separating instability from query difficulty.The method estimates CV variability with nonparametric bootstrap resampling and constructs confidence intervals from the resampled CVs.Source: §3.1 · p. 4
- A query is unstable when the lower bound of its 95% CV confidence interval is at least one; the threshold is arbitrary and can be tailored.This corresponds to mutant-set standard deviation at least as large as its mean, with 95% confidence.Source: §3.1 · p. 4
- When timeouts leave runtime data missing, the study uses success rate and a z-test of proportions to classify instability, stability, or unsolvability.A timeout rate below 5% marks the original query unsolvable and not unstable; SR above .95 marks it stable and not unstable.Source: §3.1 · p. 4
3.2.1 Domain
- The analysis is limited to cvc5 and Z3 and draws queries from bounded model checking, symbolic execution, and SMT-Comp.BMC and SymEx queries came from a public dataset using ESBMC and KLEE; BMC and SymEx had not been directly explored in prior instability work,.Source: §3.2.1 · pp. 4–5
3.2.2 Query Selection
- Random samples comprised 100 queries each from BMC and SymEx and 150 from SMT-Comp, with every query run on both solvers.The SMT-Comp sample was equally sourced across 15 logics; errors led to query replacement.Source: §3.2.2 · p. 5
- The difficult-query samples contained 100 BMC and SymEx queries each and 120 SMT-Comp queries from six logics, selected for timeouts on either solver.BMC and SymEx samples were split evenly between cvc5-only and Z3-only timeouts, with reallocation if needed.Source: §3.2.2 · pp. 5–6
3.2.3 Query Shuffling
- The study modified the SMT-Comp scrambler to shuffle assertions only and normalized variable names to prevent declaration effects.This limits the mutation scope; other work has examined shuffling clauses of commutative functions.Source: §3.2.3 · p. 6
4 Results
Instability appears across solver and query categories, and queries that take longer on average tend to be more unstable. The results also suggest that structuring queries for runtime may reduce solver time while stabilizing performance.
4.1 Prevalence of Instability
- More than 10% of Z3 hard BMC queries were unstable, although unstable queries formed a small proportion in most categories.Table 1 reports results by solver, domain, and selection category; CVC5's success rate below one for original SymEx hard queries prevented an accurate CV calculation.Source: §4.1 · p. 6, Table 1 · p. 6
- CV showed about 22% average runtime variation for randomly selected Z3 BMC queries, despite an average success rate of about 95% and an unstable proportion of 0.08.The comparison indicates that the proportion marked unstable depends on the timeout threshold, while CV captures runtime variation directly.Source: §4.1 · pp. 6–7
4.2 Relationship Between Query Difficulty and Instability
- Logarithm of CV was a significant positive predictor of logarithm of average runtime (t = 10.5, df = 263, p < .001), indicating that harder queries tend to be more unstable within this analysis.CVs also tended to be higher in hard selections; difficult queries without estimable CVs are likely to show significant variation on average.Source: §4.2 · p. 7
4.3 Leveraging Instability
- Figure 2 excludes mutant sets averaging less than 10 or equal to 1200 seconds and highlights Z3's potential time savings between mean and minimum runtimes.The prevalence of instability, particularly among difficult queries, suggests that better-structured queries could save solver time.Source: Figure 2 · p. 7, §4.3 · p. 8
- Software tools generate queries to produce rigorous proofs, not to create structures suited to SMT solver heuristics.The paper notes that such queries may therefore be treated as effectively random permutations when their structure is not considered.Source: §4.3 · p. 8
- With 95% confidence, restructuring a hard BMC query could decrease Z3 runtimes by as much as 38% on average.The authors recommend optimizing query structure for runtime rather than only for success rate or variance.Source: §4.3 · p. 8
5 Conclusion
Across three software domains, instability affected both cvc5 and Z3, and query difficulty significantly predicted instability. The conclusion presents runtime-oriented query restructuring as a possible way to mitigate instability and save time, with machine learning proposed as a candidate for runtime optimization.
5 Conclusion
- Instability affected both cvc5 and Z3 in every studied domain, and query difficulty was a significant positive predictor of instability.The study covered three software development areas, two previously unexplored.Source: §5 · p. 8
- For difficult queries with timeouts, the authors expect significant instability as well.Source: §5 · p. 8
- Restructuring queries to better suit solver heuristics could mitigate instability while saving time, if an efficient method is developed.Source: §5 · p. 8
- The authors conjecture that machine-learning models capable of reasoning about algorithm and program-data structure could optimize queries for runtime.Source: §5 · p. 9