cprover: add external SMT2 solver backend (--smt2-solver)#9068
cprover: add external SMT2 solver backend (--smt2-solver)#9068tautschnig wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds an external SMT-LIBv2 (SMT2) solver backend that can be selected via a new --smt2-solver command-line option, enabling cprover to pipe constraints to an external solver (e.g., z3) instead of the built-in SAT backend.
Changes:
- Introduces
cprover_smt2_dectas an SMT2 decision procedure configured for cprover’s state encoding. - Adds
--smt2-solveroption and plumbs the configured solver binary throughsolver_optionst. - Updates inductiveness subsumption checks and counterexample search to use the external SMT2 solver when configured.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/cprover/solver.h | Adds solver_optionst::smt2_solver_binary to configure external SMT2 solver usage. |
| src/cprover/inductiveness.cpp | Routes subsumption and counterexample logic to either external SMT2 or built-in SAT. |
| src/cprover/cprover_smt2_dec.h | Adds a configured SMT2 decision procedure specialization for cprover. |
| src/cprover/cprover_parse_options.h | Registers new CLI option --smt2-solver. |
| src/cprover/cprover_parse_options.cpp | Parses and stores --smt2-solver into solver options. |
| src/cprover/counterexample_found.h | Extends API to pass SMT2 solver binary + adds generic show_assignment overload. |
| src/cprover/counterexample_found.cpp | Adds external SMT2 solver path for counterexample search. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #9068 +/- ##
========================================
Coverage 80.68% 80.69%
========================================
Files 1714 1717 +3
Lines 189522 189548 +26
Branches 73 73
========================================
+ Hits 152925 152953 +28
+ Misses 36597 36595 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
9530233 to
6f47377
Compare
Add cprover_smt2_dect (a decision_proceduret that pipes constraints to an external SMT2 solver such as z3), an --external-smt2-solver command-line option, the solver_optionst::smt2_solver_binary field, and the plumbing in the inductiveness check and counterexample search to use the external solver when configured (falling back to the built-in SAT backend otherwise). The option is named to match the rest of the suite (cbmc's --external-smt2-solver) and to avoid confusion with cprover's own --smt2 output-formula flag; it is listed in --help. Backend selection is centralised in make_state_encoding_solver() (state_encoding_solver_factory.h) and shared by the counterexample search and the inductiveness/subsumption check, rather than duplicated. smt2_dect::read_result returns D_ERROR for an "unknown" answer as well as for hard errors. In the base-case counterexample search a D_ERROR is now propagated as an error rather than treated as "no counterexample" -- the latter would let an undecided query be reported as a proof, which is unsound. In the subsumption check, returning "not subsumed" on D_ERROR is conservative (we keep an obligation we could have pruned) and hence sound; this deliberately-opposite choice is documented at both sites. cprover_smt2_dect uses solvert::GENERIC (portable SMT2) so any configured solver binary can discharge the queries; this is now documented on the class, and the dead show_assignment(const bv_pointers_widet &) overload has been removed. regression/cprover/external_smt2_solver exercises the backend end to end with z3 (installed on every CI platform that runs this suite). Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
6f47377 to
4eee0b3
Compare
Add cprover_smt2_dect (a decision_proceduret that pipes constraints to an external SMT2 solver such as z3), a --smt2-solver command-line option, the solver_optionst::smt2_solver_binary field, and the plumbing in the inductiveness check and counterexample search to use the external solver when configured (falling back to the built-in SAT backend otherwise).