Skip to content

Commit 8fdb8bb

Browse files
committed
SMT back-end: add support for Bitwuzla and CVC 5
Adds support for two actively developed SMT solvers, with the caveat that these do not currently pass all regression tests (Bitwuzla fails two tests, CVC 5 times out on one and fails on nine others). Some performance data running (in `regression/cbmc`, for varying values of `<SOLVER>`): ``` /usr/bin/time -v ../test.pl -e -c "../../../build/bin/cbmc <SOLVER>" \ -X broken-smt-backend -X thorough-smt-backend \ -X broken-cprover-smt-backend -X thorough-cprover-smt-backend \ -X broken-z3-smt-backend -X thorough-z3-smt-backend ``` Note that the following data has bias: it only has the subset of tests that all back-ends are expected to be able to solve. That is, some SMT solver may be faster on this minimum common set of tests, but might be unable to solve tests that another (possibly slower) solver can handle. * Bitwuzla (`--bitwuzla` for `<SOLVER>`): ``` User time (seconds): 90.59 System time (seconds): 8.68 Elapsed (wall clock) time (h:mm:ss or m:ss): 1:39.31 Maximum resident set size (kbytes): 81240 Exit status: 2 ``` * CVC 5 (`--cvc5` for `<SOLVER>`): ``` User time (seconds): 483.24 System time (seconds): 10.69 Elapsed (wall clock) time (h:mm:ss or m:ss): 8:14.18 Maximum resident set size (kbytes): 473876 Exit status: 10 ``` * Z3 (`--z3` for `<SOLVER>`): ``` User time (seconds): 202.90 System time (seconds): 11.29 Elapsed (wall clock) time (h:mm:ss or m:ss): 3:34.21 Maximum resident set size (kbytes): 131760 Exit status: 0 ``` * In-tree SMT solver (`--cprover-smt2` for `<SOLVER>`): ``` User time (seconds): 64.08 System time (seconds): 9.44 Elapsed (wall clock) time (h:mm:ss or m:ss): 1:13.51 Maximum resident set size (kbytes): 81932 Exit status: 0 ``` * SAT back-end (omitting `<SOLVER>`): ``` User time (seconds): 33.43 System time (seconds): 7.94 Elapsed (wall clock) time (h:mm:ss or m:ss): 0:41.29 Maximum resident set size (kbytes): 79088 Exit status: 0 ```
1 parent 3f578e1 commit 8fdb8bb

File tree

7 files changed

+64
-2
lines changed

7 files changed

+64
-2
lines changed

Diff for: doc/man/cbmc.1

+6
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,9 @@ use default SMT1 solver (obsolete)
407407
\fB\-\-smt2\fR
408408
use default SMT2 solver (Z3)
409409
.TP
410+
\fB\-\-bitwuzla\fR
411+
use Bitwuzla
412+
.TP
410413
\fB\-\-boolector\fR
411414
use Boolector
412415
.TP
@@ -419,6 +422,9 @@ use CVC3
419422
\fB\-\-cvc4\fR
420423
use CVC4
421424
.TP
425+
\fB\-\-cvc5\fR
426+
use CVC5
427+
.TP
422428
\fB\-\-mathsat\fR
423429
use MathSAT
424430
.TP

Diff for: doc/man/jbmc.1

+6
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,9 @@ use default SMT1 solver (obsolete)
401401
\fB\-\-smt2\fR
402402
use default SMT2 solver (Z3)
403403
.TP
404+
\fB\-\-bitwuzla\fR
405+
use Boolector
406+
.TP
404407
\fB\-\-boolector\fR
405408
use Boolector
406409
.TP
@@ -413,6 +416,9 @@ use CVC3
413416
\fB\-\-cvc4\fR
414417
use CVC4
415418
.TP
419+
\fB\-\-cvc5\fR
420+
use CVC5
421+
.TP
416422
\fB\-\-mathsat\fR
417423
use MathSAT
418424
.TP

Diff for: src/goto-checker/solver_factory.cpp

+17-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ smt2_dect::solvert solver_factoryt::get_smt2_solver_type() const
163163

164164
smt2_dect::solvert s = smt2_dect::solvert::GENERIC;
165165

166-
if(options.get_bool_option("boolector"))
166+
if(options.get_bool_option("bitwuzla"))
167+
s = smt2_dect::solvert::BITWUZLA;
168+
else if(options.get_bool_option("boolector"))
167169
s = smt2_dect::solvert::BOOLECTOR;
168170
else if(options.get_bool_option("cprover-smt2"))
169171
s = smt2_dect::solvert::CPROVER_SMT2;
@@ -173,6 +175,8 @@ smt2_dect::solvert solver_factoryt::get_smt2_solver_type() const
173175
s = smt2_dect::solvert::CVC3;
174176
else if(options.get_bool_option("cvc4"))
175177
s = smt2_dect::solvert::CVC4;
178+
else if(options.get_bool_option("cvc5"))
179+
s = smt2_dect::solvert::CVC5;
176180
else if(options.get_bool_option("yices"))
177181
s = smt2_dect::solvert::YICES;
178182
else if(options.get_bool_option("z3"))
@@ -525,6 +529,12 @@ static void parse_smt2_options(const cmdlinet &cmdline, optionst &options)
525529

526530
bool solver_set = false;
527531

532+
if(cmdline.isset("bitwuzla"))
533+
{
534+
options.set_option("bitwuzla", true), solver_set = true;
535+
options.set_option("smt2", true);
536+
}
537+
528538
if(cmdline.isset("boolector"))
529539
{
530540
options.set_option("boolector", true), solver_set = true;
@@ -549,6 +559,12 @@ static void parse_smt2_options(const cmdlinet &cmdline, optionst &options)
549559
options.set_option("smt2", true);
550560
}
551561

562+
if(cmdline.isset("cvc5"))
563+
{
564+
options.set_option("cvc5", true), solver_set = true;
565+
options.set_option("smt2", true);
566+
}
567+
552568
if(cmdline.isset("incremental-smt2-solver"))
553569
{
554570
options.set_option(

Diff for: src/goto-checker/solver_factory.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void parse_solver_options(const cmdlinet &cmdline, optionst &options);
100100
"(smt2)" \
101101
"(fpa)" \
102102
"(cvc3)" \
103-
"(cvc4)(boolector)(yices)(z3)" \
103+
"(cvc4)(cvc5)(bitwuzla)(boolector)(yices)(z3)" \
104104
"(mathsat)" \
105105
"(cprover-smt2)" \
106106
"(incremental-smt2-solver):" \
@@ -124,10 +124,12 @@ void parse_solver_options(const cmdlinet &cmdline, optionst &options);
124124
" (greedy heuristic)\n" \
125125
" --smt1 use default SMT1 solver (obsolete)\n" \
126126
" --smt2 use default SMT2 solver (Z3)\n" \
127+
" --bitwuzla use Bitwuzla\n" \
127128
" --boolector use Boolector\n" \
128129
" --cprover-smt2 use CPROVER SMT2 solver\n" \
129130
" --cvc3 use CVC3\n" \
130131
" --cvc4 use CVC4\n" \
132+
" --cvc5 use CVC5\n" \
131133
" --mathsat use MathSAT\n" \
132134
" --yices use Yices\n" \
133135
" --z3 use Z3\n" \

Diff for: src/solvers/smt2/smt2_conv.cpp

+20
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ smt2_convt::smt2_convt(
8383
case solvert::GENERIC:
8484
break;
8585

86+
case solvert::BITWUZLA:
87+
use_FPA_theory = true;
88+
use_array_of_bool = true;
89+
use_as_const = true;
90+
use_check_sat_assuming = true;
91+
use_lambda_for_array = true;
92+
emit_set_logic = false;
93+
break;
94+
8695
case solvert::BOOLECTOR:
8796
break;
8897

@@ -103,6 +112,15 @@ smt2_convt::smt2_convt(
103112
use_as_const = true;
104113
break;
105114

115+
case solvert::CVC5:
116+
logic = "ALL";
117+
use_array_of_bool = true;
118+
use_as_const = true;
119+
use_check_sat_assuming = true;
120+
use_lambda_for_array = true;
121+
use_datatypes = true;
122+
break;
123+
106124
case solvert::MATHSAT:
107125
break;
108126

@@ -158,11 +176,13 @@ void smt2_convt::write_header()
158176
{
159177
// clang-format off
160178
case solvert::GENERIC: break;
179+
case solvert::BITWUZLA: out << "; Generated for Bitwuzla\n"; break;
161180
case solvert::BOOLECTOR: out << "; Generated for Boolector\n"; break;
162181
case solvert::CPROVER_SMT2:
163182
out << "; Generated for the CPROVER SMT2 solver\n"; break;
164183
case solvert::CVC3: out << "; Generated for CVC 3\n"; break;
165184
case solvert::CVC4: out << "; Generated for CVC 4\n"; break;
185+
case solvert::CVC5: out << "; Generated for CVC 5\n"; break;
166186
case solvert::MATHSAT: out << "; Generated for MathSAT\n"; break;
167187
case solvert::YICES: out << "; Generated for Yices\n"; break;
168188
case solvert::Z3: out << "; Generated for Z3\n"; break;

Diff for: src/solvers/smt2/smt2_conv.h

+2
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ class smt2_convt : public stack_decision_proceduret
3939
enum class solvert
4040
{
4141
GENERIC,
42+
BITWUZLA,
4243
BOOLECTOR,
4344
CPROVER_SMT2,
4445
CVC3,
4546
CVC4,
47+
CVC5,
4648
MATHSAT,
4749
YICES,
4850
Z3

Diff for: src/solvers/smt2/smt2_dec.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ std::string smt2_dect::decision_procedure_text() const
2020
// clang-format off
2121
return "SMT2 " + logic + (use_FPA_theory ? " (with FPA)" : "") + " using " +
2222
(solver==solvert::GENERIC?"Generic":
23+
solver==solvert::BITWUZLA?"Bitwuzla":
2324
solver==solvert::BOOLECTOR?"Boolector":
2425
solver==solvert::CPROVER_SMT2?"CPROVER SMT2":
2526
solver==solvert::CVC3?"CVC3":
2627
solver==solvert::CVC4?"CVC4":
28+
solver==solvert::CVC5?"CVC5":
2729
solver==solvert::MATHSAT?"MathSAT":
2830
solver==solvert::YICES?"Yices":
2931
solver==solvert::Z3?"Z3":
@@ -54,6 +56,10 @@ decision_proceduret::resultt smt2_dect::dec_solve()
5456

5557
switch(solver)
5658
{
59+
case solvert::BITWUZLA:
60+
argv = {"bitwuzla", temp_file_problem()};
61+
break;
62+
5763
case solvert::BOOLECTOR:
5864
argv = {"boolector", "--smt2", temp_file_problem(), "-m"};
5965
break;
@@ -79,6 +85,10 @@ decision_proceduret::resultt smt2_dect::dec_solve()
7985
argv = {"cvc4", "-L", "smt2", temp_file_problem()};
8086
break;
8187

88+
case solvert::CVC5:
89+
argv = {"cvc5", "--lang", "smtlib", temp_file_problem()};
90+
break;
91+
8292
case solvert::MATHSAT:
8393
// The options below were recommended by Alberto Griggio
8494
// on 10 July 2013

0 commit comments

Comments
 (0)