49 : decision_procedure_ptr(
std::move(p))
54 std::unique_ptr<stack_decision_proceduret>
p1,
55 std::unique_ptr<propt>
p2)
56 : prop_ptr(
std::move(
p2)), decision_procedure_ptr(
std::move(
p1))
61 std::unique_ptr<stack_decision_proceduret>
p1,
62 std::unique_ptr<std::ofstream>
p2)
63 : ofstream_ptr(
std::move(
p2)), decision_procedure_ptr(
std::move(
p1))
68 std::unique_ptr<boolbvt>
p1,
69 std::unique_ptr<propt>
p2)
70 : prop_ptr(
std::move(
p2)), decision_procedure_is_boolbvt_ptr(
std::move(
p1))
75 std::unique_ptr<boolbvt>
p1,
76 std::unique_ptr<propt>
p2,
77 std::unique_ptr<std::ofstream>
p3)
78 : ofstream_ptr(
std::move(
p3)),
79 prop_ptr(
std::move(
p2)),
80 decision_procedure_is_boolbvt_ptr(
std::move(
p1))
87 (decision_procedure_ptr !=
nullptr) !=
88 (decision_procedure_is_boolbvt_ptr !=
nullptr));
89 if(decision_procedure_ptr)
90 return *decision_procedure_ptr;
92 return *decision_procedure_is_boolbvt_ptr;
97 PRECONDITION(decision_procedure_is_boolbvt_ptr !=
nullptr);
98 return *decision_procedure_is_boolbvt_ptr;
105 options.get_signed_int_option(
"solver-time-limit");
113 if(
options.get_bool_option(
"dimacs"))
115 if(
options.is_set(
"external-sat-solver"))
118 options.get_bool_option(
"refine") &&
119 !
options.get_bool_option(
"refine-strings"))
123 else if(
options.get_bool_option(
"refine-strings"))
126 options.get_option(
"incremental-smt2-solver");
129 if(
options.get_bool_option(
"smt2"))
143 if(
options.get_bool_option(
"bitwuzla"))
145 else if(
options.get_bool_option(
"boolector"))
147 else if(
options.get_bool_option(
"cprover-smt2"))
149 else if(
options.get_bool_option(
"mathsat"))
151 else if(
options.get_bool_option(
"cvc3"))
153 else if(
options.get_bool_option(
"cvc4"))
155 else if(
options.get_bool_option(
"cvc5"))
157 else if(
options.get_bool_option(
"yices"))
159 else if(
options.get_bool_option(
"z3"))
161 else if(
options.get_bool_option(
"generic"))
170 const std::string &
solver)
173 log.warning() <<
"The specified solver, '" <<
solver
174 <<
"', is not available. "
175 <<
"The default solver will be used instead." <<
messaget::eom;
178template <
typename SatcheckT>
179static typename std::enable_if<
180 !std::is_base_of<hardness_collectort, SatcheckT>::value,
181 std::unique_ptr<SatcheckT>>::type
185 if(
options.is_set(
"write-solver-stats-to"))
189 <<
"Configured solver does not support --write-solver-stats-to. "
195template <
typename SatcheckT>
196static typename std::enable_if<
197 std::is_base_of<hardness_collectort, SatcheckT>::value,
198 std::unique_ptr<SatcheckT>>::type
202 if(
options.is_set(
"write-solver-stats-to"))
204 std::unique_ptr<solver_hardnesst> solver_hardness =
205 std::make_unique<solver_hardnesst>();
206 solver_hardness->set_outfile(
options.get_option(
"write-solver-stats-to"));
207 satcheck->solver_hardness = std::move(solver_hardness);
212static std::unique_ptr<propt>
216 !
options.get_bool_option(
"sat-preprocessor") ||
217 options.get_bool_option(
"refine-strings");
219 if(
options.is_set(
"sat-solver"))
224#if defined SATCHECK_ZCHAFF
232#if defined SATCHECK_BOOLERFORCE
240#if defined SATCHECK_MINISAT1
248#if defined SATCHECK_MINISAT2
266#if defined SATCHECK_IPASIR
274#if defined SATCHECK_PICOSAT
282#if defined SATCHECK_LINGELING
290#if defined SATCHECK_GLUCOSE
308#if defined SATCHECK_CADICAL
338 const std::string &filename,
350 "failed to open file: " + filename,
arg_name);
354 log.status() <<
"Outputting formula to file: " << filename <<
messaget::eom;
362 bool get_array_constraints =
363 options.get_bool_option(
"show-array-constraints");
367 if(
options.get_option(
"arrays-uf") ==
"never")
369 else if(
options.get_option(
"arrays-uf") ==
"always")
374 std::unique_ptr<boolbvt> boolbv = std::move(
bv_pointers);
375 return std::make_unique<solvert>(std::move(boolbv), std::move(
sat_solver));
385 std::string filename =
options.get_option(
"outfile");
387 if(filename.empty() || filename ==
"-")
392 return std::make_unique<solvert>(std::move(
bv_dimacs), std::move(prop));
400 return std::make_unique<solvert>(
401 std::move(
bv_dimacs), std::move(prop), std::move(outfile));
416 return std::make_unique<solvert>(std::move(
bv_pointers), std::move(prop));
425 info.prop = prop.get();
429 if(
options.get_bool_option(
"max-node-refinement"))
430 info.max_node_refinement =
431 options.get_unsigned_int_option(
"max-node-refinement");
433 info.refine_arrays =
options.get_bool_option(
"refine-arrays");
434 info.refine_arithmetic =
options.get_bool_option(
"refine-arithmetic");
437 std::unique_ptr<boolbvt> decision_procedure =
438 std::make_unique<bv_refinementt>(
info);
440 return std::make_unique<solvert>(
441 std::move(decision_procedure), std::move(prop));
447std::unique_ptr<solver_factoryt::solvert>
453 info.prop = prop.get();
456 if(
options.get_bool_option(
"max-node-refinement"))
457 info.max_node_refinement =
458 options.get_unsigned_int_option(
"max-node-refinement");
459 info.refine_arrays =
options.get_bool_option(
"refine-arrays");
460 info.refine_arithmetic =
options.get_bool_option(
"refine-arithmetic");
463 std::unique_ptr<boolbvt> decision_procedure =
464 std::make_unique<string_refinementt>(
info);
466 return std::make_unique<solvert>(
467 std::move(decision_procedure), std::move(prop));
470std::unique_ptr<solver_factoryt::solvert>
481 "Argument --outfile is incompatible with --dump-smt-formula. ",
485 std::unique_ptr<smt_base_solver_processt> solver_process =
nullptr;
490 std::unique_ptr<std::ostream> outfile =
494 solver_process = std::make_unique<smt_incremental_dry_run_solvert>(
503 solver_process = std::make_unique<smt_piped_solver_processt>(
510 return std::make_unique<solvert>(
511 std::make_unique<smt2_incremental_decision_proceduret>(
515std::unique_ptr<solver_factoryt::solvert>
520 const std::string &filename =
options.get_option(
"outfile");
527 "required filename not provided",
529 "provide a filename with --outfile");
532 auto smt2_dec = std::make_unique<smt2_dect>(
538 options.get_option(
"external-smt2-solver"),
541 if(
options.get_bool_option(
"fpa"))
544 return std::make_unique<solvert>(std::move(
smt2_dec));
546 else if(filename ==
"-")
548 auto smt2_conv = std::make_unique<smt2_convt>(
556 if(
options.get_bool_option(
"fpa"))
557 smt2_conv->use_FPA_theory =
true;
559 return std::make_unique<solvert>(std::move(smt2_conv));
565 auto smt2_conv = std::make_unique<smt2_convt>(
573 if(
options.get_bool_option(
"fpa"))
574 smt2_conv->use_FPA_theory =
true;
576 return std::make_unique<solvert>(std::move(smt2_conv), std::move(out));
582 if(
options.get_bool_option(
"beautify"))
585 "the chosen solver does not support beautification",
"--beautify");
598 "the chosen solver does not support incremental solving",
604 "the chosen solver does not support incremental solving",
"--cover");
609 "the chosen solver does not support incremental solving",
610 "--incremental-loop");
616 if(cmdline.
isset(
"external-sat-solver"))
619 "external-sat-solver", cmdline.
get_value(
"external-sat-solver"));
622 options.set_option(
"sat-preprocessor", !cmdline.
isset(
"no-sat-preprocessor"));
624 if(cmdline.
isset(
"dimacs"))
625 options.set_option(
"dimacs",
true);
627 if(cmdline.
isset(
"sat-solver"))
633 if(cmdline.
isset(
"smt2"))
634 options.set_option(
"smt2",
true);
636 if(cmdline.
isset(
"fpa"))
637 options.set_option(
"fpa",
true);
641 if(cmdline.
isset(
"bitwuzla"))
644 options.set_option(
"smt2",
true);
647 if(cmdline.
isset(
"boolector"))
650 options.set_option(
"smt2",
true);
653 if(cmdline.
isset(
"cprover-smt2"))
656 options.set_option(
"smt2",
true);
659 if(cmdline.
isset(
"mathsat"))
662 options.set_option(
"smt2",
true);
665 if(cmdline.
isset(
"cvc4"))
668 options.set_option(
"smt2",
true);
671 if(cmdline.
isset(
"cvc5"))
674 options.set_option(
"smt2",
true);
677 if(cmdline.
isset(
"incremental-smt2-solver"))
680 "incremental-smt2-solver", cmdline.
get_value(
"incremental-smt2-solver")),
684 if(cmdline.
isset(
"yices"))
687 options.set_option(
"smt2",
true);
690 if(cmdline.
isset(
"z3"))
693 options.set_option(
"smt2",
true);
696 if(cmdline.
isset(
"external-smt2-solver"))
699 "external-smt2-solver", cmdline.
get_value(
"external-smt2-solver"));
701 options.set_option(
"smt2",
true);
706 if(cmdline.
isset(
"outfile"))
709 options.set_option(
"generic",
true);
714 options.set_option(
"z3",
true);
724 if(cmdline.
isset(
"outfile"))
727 if(cmdline.
isset(
"dump-smt-formula"))
729 "dump-smt-formula", cmdline.
get_value(
"dump-smt-formula"));
731 if(cmdline.
isset(
"write-solver-stats-to"))
734 "write-solver-stats-to", cmdline.
get_value(
"write-solver-stats-to"));
737 if(cmdline.
isset(
"beautify"))
738 options.set_option(
"beautify",
true);
740 if(cmdline.
isset(
"refine-arrays"))
742 options.set_option(
"refine",
true);
743 options.set_option(
"refine-arrays",
true);
746 if(cmdline.
isset(
"refine-arithmetic"))
748 options.set_option(
"refine",
true);
749 options.set_option(
"refine-arithmetic",
true);
752 if(cmdline.
isset(
"refine"))
754 options.set_option(
"refine",
true);
755 options.set_option(
"refine-arrays",
true);
756 options.set_option(
"refine-arithmetic",
true);
759 if(cmdline.
isset(
"max-node-refinement"))
762 "max-node-refinement", cmdline.
get_value(
"max-node-refinement"));
Abstraction Refinement Loop.
message_handlert & message_handler
virtual xmlt output_xml(const namespacet &ns, const irep_idt &function_id, const goto_programt &goto_program) const
Output the abstract states for a single function as XML.
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
std::string get_value(char option) const
virtual bool isset(char option) const
Thrown when users pass incorrect command line arguments, for example passing no files to analysis or ...
Class that provides messages with a built-in verbosity 'level'.
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
boolbvt & boolbv_decision_procedure() const
solvert(std::unique_ptr< stack_decision_proceduret > p)
stack_decision_proceduret & decision_procedure() const
message_handlert & message_handler
std::unique_ptr< solvert > get_external_sat()
std::unique_ptr< solvert > get_default()
solver_factoryt(const optionst &_options, const namespacet &_ns, message_handlert &_message_handler, bool _output_xml_in_refinement)
Note: The solver returned will hold a reference to the namespace ns.
void set_decision_procedure_time_limit(solver_resource_limitst &decision_procedure)
Sets the timeout of decision_procedure if the solver-time-limit option has a positive value (in secon...
std::unique_ptr< solvert > get_dimacs()
void no_incremental_check()
std::unique_ptr< solvert > get_string_refinement()
the string refinement adds to the bit vector refinement specifications for functions from the Java st...
std::unique_ptr< solvert > get_smt2(smt2_dect::solvert solver)
const bool output_xml_in_refinement
smt2_dect::solvert get_smt2_solver_type() const
Uses the options to pick an SMT 2.0 solver.
virtual std::unique_ptr< solvert > get_solver()
Returns a solvert object.
std::unique_ptr< solvert > get_incremental_smt2(std::string solver_command)
std::unique_ptr< solvert > get_bv_refinement()
virtual void set_time_limit_seconds(uint32_t)=0
Set the limit for the solver to time out in seconds.
Document and give macros for the exit codes of CPROVER binaries.
#define CPROVER_EXIT_USAGE_ERROR
A usage error is returned when the command line is invalid or conflicting.
Allows calling an external SAT solver to allow faster integration of newer SAT solvers.
Decision procedure with incremental SMT2 solving.
void solver(std::vector< framet > &frames, const std::unordered_set< symbol_exprt, irep_hash > &address_taken, const solver_optionst &solver_options, const namespacet &ns, std::vector< propertyt > &properties, std::size_t property_index)
static std::enable_if<!std::is_base_of< hardness_collectort, SatcheckT >::value, std::unique_ptr< SatcheckT > >::type make_satcheck_prop(message_handlert &message_handler, const optionst &options)
static void parse_sat_options(const cmdlinet &cmdline, optionst &options)
static std::unique_ptr< std::ofstream > open_outfile_and_check(const std::string &filename, message_handlert &message_handler, const std::string &arg_name)
static void parse_smt2_options(const cmdlinet &cmdline, optionst &options)
static std::unique_ptr< propt > get_sat_solver(message_handlert &message_handler, const optionst &options)
static void emit_solver_warning(message_handlert &message_handler, const std::string &solver)
Emit a warning for non-existent solver solver via message_handler.
void parse_solver_options(const cmdlinet &cmdline, optionst &options)
Parse solver-related command-line parameters in cmdline and set corresponding values in options.
Solver capability to set resource limits.
#define PRECONDITION(CONDITION)
String support via creating string constraints and progressively instantiating the universal constrai...
#define DEFAULT_MAX_NB_REFINEMENT
string_refinementt constructor arguments
#define widen_if_needed(s)
const char * CBMC_VERSION