1 /********************* */
2 /*! \file options_handler.cpp
4 ** Top contributors (to current version):
5 ** Tim King, Andrew Reynolds, Aina Niemetz
6 ** This file is part of the CVC4 project.
7 ** Copyright (c) 2009-2018 by the authors listed in the file AUTHORS
8 ** in the top-level source directory) and their institutional affiliations.
9 ** All rights reserved. See the file COPYING in the top-level source
10 ** directory for licensing information.\endverbatim
12 ** \brief Interface for custom handlers and predicates options.
14 ** Interface for custom handlers and predicates options.
17 #include "options/options_handler.h"
23 #include "cvc4autoconfig.h"
25 #include "base/configuration.h"
26 #include "base/configuration_private.h"
27 #include "base/cvc4_assert.h"
28 #include "base/exception.h"
29 #include "base/modal_exception.h"
30 #include "base/output.h"
31 #include "lib/strtok_r.h"
32 #include "options/arith_heuristic_pivot_rule.h"
33 #include "options/arith_propagation_mode.h"
34 #include "options/arith_unate_lemma_mode.h"
35 #include "options/base_options.h"
36 #include "options/bv_bitblast_mode.h"
37 #include "options/bv_options.h"
38 #include "options/decision_mode.h"
39 #include "options/decision_options.h"
40 #include "options/datatypes_modes.h"
41 #include "options/didyoumean.h"
42 #include "options/language.h"
43 #include "options/option_exception.h"
44 #include "options/printer_modes.h"
45 #include "options/smt_options.h"
46 #include "options/theory_options.h"
47 #include "options/theoryof_mode.h"
48 #include "options/ufss_mode.h"
56 void throwLazyBBUnsupported(theory::bv::SatSolverMode m
)
58 std::string sat_solver
;
59 if (m
== theory::bv::SAT_SOLVER_CADICAL
)
61 sat_solver
= "CaDiCaL";
65 Assert(m
== theory::bv::SAT_SOLVER_CRYPTOMINISAT
);
66 sat_solver
= "CryptoMiniSat";
68 std::string
indent(25, ' ');
69 throw OptionException(sat_solver
+ " does not support lazy bit-blasting.\n"
70 + indent
+ "Try --bv-sat-solver=minisat");
75 OptionsHandler::OptionsHandler(Options
* options
) : d_options(options
) { }
77 void OptionsHandler::notifyForceLogic(const std::string
& option
){
78 d_options
->d_forceLogicListeners
.notify();
81 void OptionsHandler::notifyBeforeSearch(const std::string
& option
)
84 d_options
->d_beforeSearchListeners
.notify();
85 } catch (ModalException
&){
87 ss
<< "cannot change option `" << option
<< "' after final initialization";
88 throw ModalException(ss
.str());
93 void OptionsHandler::notifyTlimit(const std::string
& option
) {
94 d_options
->d_tlimitListeners
.notify();
97 void OptionsHandler::notifyTlimitPer(const std::string
& option
) {
98 d_options
->d_tlimitPerListeners
.notify();
101 void OptionsHandler::notifyRlimit(const std::string
& option
) {
102 d_options
->d_rlimitListeners
.notify();
105 void OptionsHandler::notifyRlimitPer(const std::string
& option
) {
106 d_options
->d_rlimitPerListeners
.notify();
109 unsigned long OptionsHandler::limitHandler(std::string option
,
113 std::istringstream
convert(optarg
);
114 if (!(convert
>> ms
))
116 throw OptionException("option `" + option
117 + "` requires a number as an argument");
122 /* options/base_options_handlers.h */
123 void OptionsHandler::notifyPrintSuccess(std::string option
) {
124 d_options
->d_setPrintSuccessListeners
.notify();
127 // theory/arith/options_handlers.h
128 const std::string
OptionsHandler::s_arithUnateLemmasHelp
= "\
129 Unate lemmas are generated before SAT search begins using the relationship\n\
130 of constant terms and polynomials.\n\
131 Modes currently supported by the --unate-lemmas option:\n\
134 Outputs lemmas of the general form (<= p c) implies (<= p d) for c < d.\n\
136 Outputs lemmas of the general forms\n\
137 (= p c) implies (<= p d) for c < d, or\n\
138 (= p c) implies (not (= p d)) for c != d.\n\
140 A combination of inequalities and equalities.\n\
143 const std::string
OptionsHandler::s_arithPropagationModeHelp
= "\
144 This decides on kind of propagation arithmetic attempts to do during the search.\n\
147 use constraints to do unate propagation\n\
148 + bi (Bounds Inference)\n\
149 infers bounds on basic variables using the upper and lower bounds of the\n\
150 non-basic variables in the tableau.\n\
154 const std::string
OptionsHandler::s_errorSelectionRulesHelp
= "\
155 This decides on the rule used by simplex during heuristic rounds\n\
156 for deciding the next basic variable to select.\n\
157 Heuristic pivot rules available:\n\
159 The minimum abs() value of the variable's violation of its bound. (default)\n\
161 The maximum violation the bound\n\
163 The variable order\n\
166 ArithUnateLemmaMode
OptionsHandler::stringToArithUnateLemmaMode(
167 std::string option
, std::string optarg
)
169 if(optarg
== "all") {
170 return ALL_PRESOLVE_LEMMAS
;
171 } else if(optarg
== "none") {
172 return NO_PRESOLVE_LEMMAS
;
173 } else if(optarg
== "ineqs") {
174 return INEQUALITY_PRESOLVE_LEMMAS
;
175 } else if(optarg
== "eqs") {
176 return EQUALITY_PRESOLVE_LEMMAS
;
177 } else if(optarg
== "help") {
178 puts(s_arithUnateLemmasHelp
.c_str());
181 throw OptionException(std::string("unknown option for --unate-lemmas: `") +
182 optarg
+ "'. Try --unate-lemmas help.");
186 ArithPropagationMode
OptionsHandler::stringToArithPropagationMode(
187 std::string option
, std::string optarg
)
189 if(optarg
== "none") {
191 } else if(optarg
== "unate") {
193 } else if(optarg
== "bi") {
194 return BOUND_INFERENCE_PROP
;
195 } else if(optarg
== "both") {
197 } else if(optarg
== "help") {
198 puts(s_arithPropagationModeHelp
.c_str());
201 throw OptionException(std::string("unknown option for --arith-prop: `") +
202 optarg
+ "'. Try --arith-prop help.");
206 ErrorSelectionRule
OptionsHandler::stringToErrorSelectionRule(
207 std::string option
, std::string optarg
)
209 if(optarg
== "min") {
210 return MINIMUM_AMOUNT
;
211 } else if(optarg
== "varord") {
213 } else if(optarg
== "max") {
214 return MAXIMUM_AMOUNT
;
215 } else if(optarg
== "help") {
216 puts(s_errorSelectionRulesHelp
.c_str());
219 throw OptionException(std::string("unknown option for --heuristic-pivot-rule: `") +
220 optarg
+ "'. Try --heuristic-pivot-rule help.");
223 // theory/quantifiers/options_handlers.h
225 const std::string
OptionsHandler::s_instWhenHelp
= "\
226 Modes currently supported by the --inst-when option:\n\
228 full-last-call (default)\n\
229 + Alternate running instantiation rounds at full effort and last\n\
230 call. In other words, interleave instantiation and theory combination.\n\
233 + Run instantiation round at full effort, before theory combination.\n\
236 + Run instantiation round at full effort, before theory combination, after\n\
237 all other theories have finished.\n\
239 full-delay-last-call \n\
240 + Alternate running instantiation rounds at full effort after all other\n\
241 theories have finished, and last call. \n\
244 + Run instantiation at last call effort, after theory combination and\n\
245 and theories report sat.\n\
249 const std::string
OptionsHandler::s_literalMatchHelp
= "\
250 Literal match modes currently supported by the --literal-match option:\n\
253 + Do not use literal matching.\n\
256 + Consider phase requirements of triggers conservatively. For example, the\n\
257 trigger P( x ) in forall( x ). ( P( x ) V ~Q( x ) ) will not be matched with\n\
258 terms in the equivalence class of true, and likewise Q( x ) will not be matched\n\
259 terms in the equivalence class of false. Extends to equality.\n\
262 + Consider phase requirements aggressively for predicates. In the above example,\n\
263 only match P( x ) with terms that are in the equivalence class of false.\n\
266 + Consider the phase requirements aggressively for all triggers.\n\
270 const std::string
OptionsHandler::s_mbqiModeHelp
= "\
271 Model-based quantifier instantiation modes currently supported by the --mbqi option:\n\
274 + Use algorithm from Section 5.4.2 of thesis Finite Model Finding in Satisfiability \n\
278 + Disable model-based quantifier instantiation.\n\
281 + Use model-based quantifier instantiation algorithm from CADE 24 finite\n\
282 model finding paper based on generalizing evaluations.\n\
285 + Use abstract MBQI algorithm (uses disjoint sets). \n\
289 const std::string
OptionsHandler::s_qcfWhenModeHelp
= "\
290 Quantifier conflict find modes currently supported by the --quant-cf-when option:\n\
293 + Default, apply conflict finding at full effort.\n\
296 + Apply conflict finding at last call, after theory combination and \n\
297 and all theories report sat. \n\
300 + Apply conflict finding at standard effort.\n\
303 + Apply conflict finding at standard effort when heuristic says to. \n\
307 const std::string
OptionsHandler::s_qcfModeHelp
= "\
308 Quantifier conflict find modes currently supported by the --quant-cf option:\n\
311 + Default, apply QCF algorithm to propagate equalities as well as conflicts. \n\
314 + Apply QCF algorithm to find conflicts only.\n\
318 const std::string
OptionsHandler::s_userPatModeHelp
= "\
319 User pattern modes currently supported by the --user-pat option:\n\
322 + When provided, use only user-provided patterns for a quantified formula.\n\
325 + Use both user-provided and auto-generated patterns when patterns\n\
326 are provided for a quantified formula.\n\
329 + Use user-provided patterns only after auto-generated patterns saturate.\n\
332 + Ignore user-provided patterns. \n\
335 + Alternate between use/resort. \n\
339 const std::string
OptionsHandler::s_triggerSelModeHelp
= "\
340 Trigger selection modes currently supported by the --trigger-sel option:\n\
343 + Consider only minimal subterms that meet criteria for triggers.\n\
346 + Consider only maximal subterms that meet criteria for triggers. \n\
349 + Consider all subterms that meet criteria for triggers. \n\
352 + Consider only minimal subterms that meet criteria for single triggers, maximal otherwise. \n\
355 + Consider only minimal subterms that meet criteria for single triggers, all otherwise. \n\
358 const std::string
OptionsHandler::s_triggerActiveSelModeHelp
= "\
359 Trigger active selection modes currently supported by the --trigger-sel option:\n\
362 + Make all triggers active. \n\
365 + Activate triggers with minimal ground terms.\n\
368 + Activate triggers with maximal ground terms. \n\
371 const std::string
OptionsHandler::s_prenexQuantModeHelp
= "\
372 Prenex quantifiers modes currently supported by the --prenex-quant option:\n\
375 + Do no prenex nested quantifiers. \n\
378 + Default, do simple prenexing of same sign quantifiers.\n\
381 + Prenex to disjunctive prenex normal form.\n\
384 + Prenex to prenex normal form.\n\
388 const std::string
OptionsHandler::s_cegqiFairModeHelp
= "\
389 Modes for enforcing fairness for counterexample guided quantifier instantion, supported by --sygus-fair:\n\
392 + Enforce fairness using an uninterpreted function for datatypes size.\n\
395 + Enforce fairness using direct conflict lemmas.\n\
397 default | dt-size \n\
398 + Default, enforce fairness using size operator.\n\
401 + Enforce fairness by height bound predicate.\n\
404 + Do not enforce fairness. \n\
408 const std::string
OptionsHandler::s_termDbModeHelp
= "\
409 Modes for term database, supported by --term-db-mode:\n\
412 + Quantifiers module considers all ground terms.\n\
415 + Quantifiers module considers only ground terms connected to current assertions. \n\
419 const std::string
OptionsHandler::s_iteLiftQuantHelp
= "\
420 Modes for term database, supported by --ite-lift-quant:\n\
423 + Do not lift if-then-else in quantified formulas.\n\
426 + Lift if-then-else in quantified formulas if results in smaller term size.\n\
429 + Lift if-then-else in quantified formulas. \n\
433 const std::string
OptionsHandler::s_cbqiBvIneqModeHelp
=
435 Modes for single invocation techniques, supported by --cbqi-bv-ineq:\n\
437 eq-slack (default) \n\
438 + Solve for the inequality using the slack value in the model, e.g.,\
439 t > s becomes t = s + ( t-s )^M.\n\
442 + Solve for the boundary point of the inequality, e.g.,\
443 t > s becomes t = s+1.\n\
446 + Solve for the inequality directly using side conditions for invertibility.\n\
450 const std::string
OptionsHandler::s_cegqiSingleInvHelp
= "\
451 Modes for single invocation techniques, supported by --cegqi-si:\n\
454 + Do not use single invocation techniques.\n\
457 + Use single invocation techniques only if grammar is not restrictive.\n\
460 + Always use single invocation techniques, abort if solution reconstruction will likely fail,\
461 for instance, when the grammar does not have ITE and solution requires it.\n\
464 + Always use single invocation techniques. \n\
468 const std::string
OptionsHandler::s_cegqiSingleInvRconsHelp
=
470 Modes for reconstruction solutions while using single invocation techniques,\
471 supported by --cegqi-si-rcons:\n\
474 + Do not try to reconstruct solutions in the original (user-provided) grammar\
475 when using single invocation techniques. In this mode, solutions produced by\
476 CVC4 may violate grammar restrictions.\n\
479 + Try to reconstruct solutions in the original grammar when using single\
480 invocation techniques in an incomplete (fail-fast) manner.\n\
483 + Try to reconstruct solutions in the original grammar, but termintate if a\
484 maximum number of rounds for reconstruction is exceeded.\n\
487 + Try to reconstruct solutions in the original grammar. In this mode,\
488 we do not terminate until a solution is successfully reconstructed. \n\
492 const std::string
OptionsHandler::s_cegisSampleHelp
=
494 Modes for sampling with counterexample-guided inductive synthesis (CEGIS),\
495 supported by --cegis-sample:\n\
498 + Do not use sampling with CEGIS.\n\
501 + Use sampling to accelerate CEGIS. This will rule out solutions for a\
502 conjecture when they are not satisfied by a sample point.\n\
505 + Trust that when a solution for a conjecture is always true under sampling,\
506 then it is indeed a solution. Note this option may print out spurious\
507 solutions for synthesis conjectures.\n\
511 const std::string
OptionsHandler::s_sygusFilterSolHelp
=
513 Modes for filtering sygus solutions supported by --sygus-filter-sol:\n\
516 + Do not filter sygus solutions.\n\
519 + Filter solutions that are logically stronger than others.\n\
522 + Filter solutions that are logically weaker than others.\n\
526 const std::string
OptionsHandler::s_sygusInvTemplHelp
= "\
527 Template modes for sygus invariant synthesis, supported by --sygus-inv-templ:\n\
530 + Synthesize invariant directly.\n\
533 + Synthesize invariant based on weakening of precondition .\n\
536 + Synthesize invariant based on strengthening of postcondition. \n\
540 const std::string
OptionsHandler::s_sygusActiveGenHelp
=
542 Modes for actively-generated sygus enumerators, supported by --sygus-active-gen:\n\
545 + Do not use actively-generated sygus enumerators.\n\
548 + Use basic type enumerator for actively-generated sygus enumerators.\n\
551 + Use optimized enumerator for actively-generated sygus enumerators.\n\
554 + Use sygus solver to enumerate terms that are agnostic to variables. \n\
557 + Internally decide the best policy for each enumerator. \n\
561 const std::string
OptionsHandler::s_macrosQuantHelp
= "\
562 Modes for quantifiers macro expansion, supported by --macros-quant-mode:\n\
565 + Infer definitions for functions, including those containing quantified formulas.\n\
568 + Only infer ground definitions for functions.\n\
571 + Only infer ground definitions for functions that result in triggers for all free variables.\n\
575 const std::string
OptionsHandler::s_quantDSplitHelp
= "\
576 Modes for quantifiers splitting, supported by --quant-dsplit-mode:\n\
579 + Never split quantified formulas.\n\
582 + Split quantified formulas over some finite datatypes when finite model finding is enabled.\n\
585 + Aggressively split quantified formulas.\n\
589 const std::string
OptionsHandler::s_quantRepHelp
= "\
590 Modes for quantifiers representative selection, supported by --quant-rep-mode:\n\
593 + Let equality engine choose representatives.\n\
596 + Choose terms that appear first.\n\
599 + Choose terms that are of minimal depth.\n\
603 theory::quantifiers::InstWhenMode
OptionsHandler::stringToInstWhenMode(
604 std::string option
, std::string optarg
)
606 if(optarg
== "pre-full") {
607 return theory::quantifiers::INST_WHEN_PRE_FULL
;
608 } else if(optarg
== "full") {
609 return theory::quantifiers::INST_WHEN_FULL
;
610 } else if(optarg
== "full-delay") {
611 return theory::quantifiers::INST_WHEN_FULL_DELAY
;
612 } else if(optarg
== "full-last-call") {
613 return theory::quantifiers::INST_WHEN_FULL_LAST_CALL
;
614 } else if(optarg
== "full-delay-last-call") {
615 return theory::quantifiers::INST_WHEN_FULL_DELAY_LAST_CALL
;
616 } else if(optarg
== "last-call") {
617 return theory::quantifiers::INST_WHEN_LAST_CALL
;
618 } else if(optarg
== "help") {
619 puts(s_instWhenHelp
.c_str());
622 throw OptionException(std::string("unknown option for --inst-when: `") +
623 optarg
+ "'. Try --inst-when help.");
627 void OptionsHandler::checkInstWhenMode(std::string option
,
628 theory::quantifiers::InstWhenMode mode
)
630 if(mode
== theory::quantifiers::INST_WHEN_PRE_FULL
) {
631 throw OptionException(std::string("Mode pre-full for ") + option
+ " is not supported in this release.");
635 theory::quantifiers::LiteralMatchMode
OptionsHandler::stringToLiteralMatchMode(
636 std::string option
, std::string optarg
)
638 if(optarg
== "none") {
639 return theory::quantifiers::LITERAL_MATCH_NONE
;
640 } else if(optarg
== "use") {
641 return theory::quantifiers::LITERAL_MATCH_USE
;
642 } else if(optarg
== "agg-predicate") {
643 return theory::quantifiers::LITERAL_MATCH_AGG_PREDICATE
;
644 } else if(optarg
== "agg") {
645 return theory::quantifiers::LITERAL_MATCH_AGG
;
646 } else if(optarg
== "help") {
647 puts(s_literalMatchHelp
.c_str());
650 throw OptionException(std::string("unknown option for --literal-matching: `") +
651 optarg
+ "'. Try --literal-matching help.");
655 void OptionsHandler::checkLiteralMatchMode(
656 std::string option
, theory::quantifiers::LiteralMatchMode mode
)
660 theory::quantifiers::MbqiMode
OptionsHandler::stringToMbqiMode(
661 std::string option
, std::string optarg
)
663 if(optarg
== "gen-ev") {
664 return theory::quantifiers::MBQI_GEN_EVAL
;
665 } else if(optarg
== "none") {
666 return theory::quantifiers::MBQI_NONE
;
667 } else if(optarg
== "default" || optarg
== "fmc") {
668 return theory::quantifiers::MBQI_FMC
;
669 } else if(optarg
== "abs") {
670 return theory::quantifiers::MBQI_ABS
;
671 } else if(optarg
== "trust") {
672 return theory::quantifiers::MBQI_TRUST
;
673 } else if(optarg
== "help") {
674 puts(s_mbqiModeHelp
.c_str());
677 throw OptionException(std::string("unknown option for --mbqi: `") +
678 optarg
+ "'. Try --mbqi help.");
682 void OptionsHandler::checkMbqiMode(std::string option
,
683 theory::quantifiers::MbqiMode mode
)
687 theory::quantifiers::QcfWhenMode
OptionsHandler::stringToQcfWhenMode(
688 std::string option
, std::string optarg
)
690 if(optarg
== "default") {
691 return theory::quantifiers::QCF_WHEN_MODE_DEFAULT
;
692 } else if(optarg
== "last-call") {
693 return theory::quantifiers::QCF_WHEN_MODE_LAST_CALL
;
694 } else if(optarg
== "std") {
695 return theory::quantifiers::QCF_WHEN_MODE_STD
;
696 } else if(optarg
== "std-h") {
697 return theory::quantifiers::QCF_WHEN_MODE_STD_H
;
698 } else if(optarg
== "help") {
699 puts(s_qcfWhenModeHelp
.c_str());
702 throw OptionException(std::string("unknown option for --quant-cf-when: `") +
703 optarg
+ "'. Try --quant-cf-when help.");
707 theory::quantifiers::QcfMode
OptionsHandler::stringToQcfMode(std::string option
,
710 if(optarg
== "conflict") {
711 return theory::quantifiers::QCF_CONFLICT_ONLY
;
712 } else if(optarg
== "default" || optarg
== "prop-eq") {
713 return theory::quantifiers::QCF_PROP_EQ
;
714 } else if(optarg
== "help") {
715 puts(s_qcfModeHelp
.c_str());
718 throw OptionException(std::string("unknown option for --quant-cf-mode: `") +
719 optarg
+ "'. Try --quant-cf-mode help.");
723 theory::quantifiers::UserPatMode
OptionsHandler::stringToUserPatMode(
724 std::string option
, std::string optarg
)
726 if(optarg
== "use") {
727 return theory::quantifiers::USER_PAT_MODE_USE
;
728 } else if(optarg
== "default" || optarg
== "trust") {
729 return theory::quantifiers::USER_PAT_MODE_TRUST
;
730 } else if(optarg
== "resort") {
731 return theory::quantifiers::USER_PAT_MODE_RESORT
;
732 } else if(optarg
== "ignore") {
733 return theory::quantifiers::USER_PAT_MODE_IGNORE
;
734 } else if(optarg
== "interleave") {
735 return theory::quantifiers::USER_PAT_MODE_INTERLEAVE
;
736 } else if(optarg
== "help") {
737 puts(s_userPatModeHelp
.c_str());
740 throw OptionException(std::string("unknown option for --user-pat: `") +
741 optarg
+ "'. Try --user-pat help.");
745 theory::quantifiers::TriggerSelMode
OptionsHandler::stringToTriggerSelMode(
746 std::string option
, std::string optarg
)
748 if(optarg
== "default" || optarg
== "min") {
749 return theory::quantifiers::TRIGGER_SEL_MIN
;
750 } else if(optarg
== "max") {
751 return theory::quantifiers::TRIGGER_SEL_MAX
;
752 } else if(optarg
== "min-s-max") {
753 return theory::quantifiers::TRIGGER_SEL_MIN_SINGLE_MAX
;
754 } else if(optarg
== "min-s-all") {
755 return theory::quantifiers::TRIGGER_SEL_MIN_SINGLE_ALL
;
756 } else if(optarg
== "all") {
757 return theory::quantifiers::TRIGGER_SEL_ALL
;
758 } else if(optarg
== "help") {
759 puts(s_triggerSelModeHelp
.c_str());
762 throw OptionException(std::string("unknown option for --trigger-sel: `") +
763 optarg
+ "'. Try --trigger-sel help.");
767 theory::quantifiers::TriggerActiveSelMode
768 OptionsHandler::stringToTriggerActiveSelMode(std::string option
,
771 if(optarg
== "default" || optarg
== "all") {
772 return theory::quantifiers::TRIGGER_ACTIVE_SEL_ALL
;
773 } else if(optarg
== "min") {
774 return theory::quantifiers::TRIGGER_ACTIVE_SEL_MIN
;
775 } else if(optarg
== "max") {
776 return theory::quantifiers::TRIGGER_ACTIVE_SEL_MAX
;
777 } else if(optarg
== "help") {
778 puts(s_triggerActiveSelModeHelp
.c_str());
781 throw OptionException(std::string("unknown option for --trigger-active-sel: `") +
782 optarg
+ "'. Try --trigger-active-sel help.");
786 theory::quantifiers::PrenexQuantMode
OptionsHandler::stringToPrenexQuantMode(
787 std::string option
, std::string optarg
)
789 if(optarg
== "default" || optarg
== "simple" ) {
790 return theory::quantifiers::PRENEX_QUANT_SIMPLE
;
791 } else if(optarg
== "none") {
792 return theory::quantifiers::PRENEX_QUANT_NONE
;
793 } else if(optarg
== "dnorm") {
794 return theory::quantifiers::PRENEX_QUANT_DISJ_NORMAL
;
795 } else if(optarg
== "norm") {
796 return theory::quantifiers::PRENEX_QUANT_NORMAL
;
797 } else if(optarg
== "help") {
798 puts(s_prenexQuantModeHelp
.c_str());
801 throw OptionException(std::string("unknown option for --prenex-quant: `") +
802 optarg
+ "'. Try --prenex-quant help.");
806 theory::SygusFairMode
OptionsHandler::stringToSygusFairMode(std::string option
,
809 if(optarg
== "direct") {
810 return theory::SYGUS_FAIR_DIRECT
;
811 } else if(optarg
== "default" || optarg
== "dt-size") {
812 return theory::SYGUS_FAIR_DT_SIZE
;
813 } else if(optarg
== "dt-height-bound" ){
814 return theory::SYGUS_FAIR_DT_HEIGHT_PRED
;
815 } else if(optarg
== "dt-size-bound" ){
816 return theory::SYGUS_FAIR_DT_SIZE_PRED
;
817 } else if(optarg
== "none") {
818 return theory::SYGUS_FAIR_NONE
;
819 } else if(optarg
== "help") {
820 puts(s_cegqiFairModeHelp
.c_str());
823 throw OptionException(std::string("unknown option for --cegqi-fair: `") +
824 optarg
+ "'. Try --cegqi-fair help.");
828 theory::quantifiers::TermDbMode
OptionsHandler::stringToTermDbMode(
829 std::string option
, std::string optarg
)
831 if(optarg
== "all" ) {
832 return theory::quantifiers::TERM_DB_ALL
;
833 } else if(optarg
== "relevant") {
834 return theory::quantifiers::TERM_DB_RELEVANT
;
835 } else if(optarg
== "help") {
836 puts(s_termDbModeHelp
.c_str());
839 throw OptionException(std::string("unknown option for --term-db-mode: `") +
840 optarg
+ "'. Try --term-db-mode help.");
844 theory::quantifiers::IteLiftQuantMode
OptionsHandler::stringToIteLiftQuantMode(
845 std::string option
, std::string optarg
)
847 if(optarg
== "all" ) {
848 return theory::quantifiers::ITE_LIFT_QUANT_MODE_ALL
;
849 } else if(optarg
== "simple") {
850 return theory::quantifiers::ITE_LIFT_QUANT_MODE_SIMPLE
;
851 } else if(optarg
== "none") {
852 return theory::quantifiers::ITE_LIFT_QUANT_MODE_NONE
;
853 } else if(optarg
== "help") {
854 puts(s_iteLiftQuantHelp
.c_str());
857 throw OptionException(std::string("unknown option for --ite-lift-quant: `") +
858 optarg
+ "'. Try --ite-lift-quant help.");
862 theory::quantifiers::CbqiBvIneqMode
OptionsHandler::stringToCbqiBvIneqMode(
863 std::string option
, std::string optarg
)
865 if (optarg
== "eq-slack")
867 return theory::quantifiers::CBQI_BV_INEQ_EQ_SLACK
;
869 else if (optarg
== "eq-boundary")
871 return theory::quantifiers::CBQI_BV_INEQ_EQ_BOUNDARY
;
873 else if (optarg
== "keep")
875 return theory::quantifiers::CBQI_BV_INEQ_KEEP
;
877 else if (optarg
== "help")
879 puts(s_cbqiBvIneqModeHelp
.c_str());
884 throw OptionException(std::string("unknown option for --cbqi-bv-ineq: `")
886 + "'. Try --cbqi-bv-ineq help.");
890 theory::quantifiers::CegqiSingleInvMode
891 OptionsHandler::stringToCegqiSingleInvMode(std::string option
,
894 if(optarg
== "none" ) {
895 return theory::quantifiers::CEGQI_SI_MODE_NONE
;
896 } else if(optarg
== "use" || optarg
== "default") {
897 return theory::quantifiers::CEGQI_SI_MODE_USE
;
898 } else if(optarg
== "all") {
899 return theory::quantifiers::CEGQI_SI_MODE_ALL
;
900 } else if(optarg
== "help") {
901 puts(s_cegqiSingleInvHelp
.c_str());
904 throw OptionException(std::string("unknown option for --cegqi-si: `") +
905 optarg
+ "'. Try --cegqi-si help.");
909 theory::quantifiers::CegqiSingleInvRconsMode
910 OptionsHandler::stringToCegqiSingleInvRconsMode(std::string option
,
913 if (optarg
== "none")
915 return theory::quantifiers::CEGQI_SI_RCONS_MODE_NONE
;
917 else if (optarg
== "try")
919 return theory::quantifiers::CEGQI_SI_RCONS_MODE_TRY
;
921 else if (optarg
== "all")
923 return theory::quantifiers::CEGQI_SI_RCONS_MODE_ALL
;
925 else if (optarg
== "all-limit")
927 return theory::quantifiers::CEGQI_SI_RCONS_MODE_ALL_LIMIT
;
929 else if (optarg
== "help")
931 puts(s_cegqiSingleInvRconsHelp
.c_str());
936 throw OptionException(std::string("unknown option for --cegqi-si-rcons: `")
937 + optarg
+ "'. Try --cegqi-si-rcons help.");
941 theory::quantifiers::CegisSampleMode
OptionsHandler::stringToCegisSampleMode(
942 std::string option
, std::string optarg
)
944 if (optarg
== "none")
946 return theory::quantifiers::CEGIS_SAMPLE_NONE
;
948 else if (optarg
== "use")
950 return theory::quantifiers::CEGIS_SAMPLE_USE
;
952 else if (optarg
== "trust")
954 return theory::quantifiers::CEGIS_SAMPLE_TRUST
;
956 else if (optarg
== "help")
958 puts(s_cegisSampleHelp
.c_str());
963 throw OptionException(std::string("unknown option for --cegis-sample: `")
965 + "'. Try --cegis-sample help.");
969 theory::quantifiers::SygusFilterSolMode
970 OptionsHandler::stringToSygusFilterSolMode(std::string option
,
973 if (optarg
== "none")
975 return theory::quantifiers::SYGUS_FILTER_SOL_NONE
;
977 else if (optarg
== "strong")
979 return theory::quantifiers::SYGUS_FILTER_SOL_STRONG
;
981 else if (optarg
== "weak")
983 return theory::quantifiers::SYGUS_FILTER_SOL_WEAK
;
985 else if (optarg
== "help")
987 puts(s_cegisSampleHelp
.c_str());
992 throw OptionException(
993 std::string("unknown option for --sygus-filter-sol: `") + optarg
994 + "'. Try --sygus-filter-sol help.");
998 theory::quantifiers::SygusInvTemplMode
999 OptionsHandler::stringToSygusInvTemplMode(std::string option
,
1002 if(optarg
== "none" ) {
1003 return theory::quantifiers::SYGUS_INV_TEMPL_MODE_NONE
;
1004 } else if(optarg
== "pre") {
1005 return theory::quantifiers::SYGUS_INV_TEMPL_MODE_PRE
;
1006 } else if(optarg
== "post") {
1007 return theory::quantifiers::SYGUS_INV_TEMPL_MODE_POST
;
1008 } else if(optarg
== "help") {
1009 puts(s_sygusInvTemplHelp
.c_str());
1012 throw OptionException(std::string("unknown option for --sygus-inv-templ: `") +
1013 optarg
+ "'. Try --sygus-inv-templ help.");
1017 theory::quantifiers::SygusActiveGenMode
1018 OptionsHandler::stringToSygusActiveGenMode(std::string option
,
1021 if (optarg
== "none")
1023 return theory::quantifiers::SYGUS_ACTIVE_GEN_NONE
;
1025 else if (optarg
== "basic")
1027 return theory::quantifiers::SYGUS_ACTIVE_GEN_ENUM_BASIC
;
1029 else if (optarg
== "enum")
1031 return theory::quantifiers::SYGUS_ACTIVE_GEN_ENUM
;
1033 else if (optarg
== "var-agnostic")
1035 return theory::quantifiers::SYGUS_ACTIVE_GEN_VAR_AGNOSTIC
;
1037 else if (optarg
== "auto")
1039 return theory::quantifiers::SYGUS_ACTIVE_GEN_AUTO
;
1041 else if (optarg
== "help")
1043 puts(s_sygusActiveGenHelp
.c_str());
1048 throw OptionException(std::string("unknown option for --sygus-inv-templ: `")
1049 + optarg
+ "'. Try --sygus-inv-templ help.");
1053 theory::quantifiers::MacrosQuantMode
OptionsHandler::stringToMacrosQuantMode(
1054 std::string option
, std::string optarg
)
1056 if(optarg
== "all" ) {
1057 return theory::quantifiers::MACROS_QUANT_MODE_ALL
;
1058 } else if(optarg
== "ground") {
1059 return theory::quantifiers::MACROS_QUANT_MODE_GROUND
;
1060 } else if(optarg
== "ground-uf") {
1061 return theory::quantifiers::MACROS_QUANT_MODE_GROUND_UF
;
1062 } else if(optarg
== "help") {
1063 puts(s_macrosQuantHelp
.c_str());
1066 throw OptionException(std::string("unknown option for --macros-quant-mode: `") +
1067 optarg
+ "'. Try --macros-quant-mode help.");
1071 theory::quantifiers::QuantDSplitMode
OptionsHandler::stringToQuantDSplitMode(
1072 std::string option
, std::string optarg
)
1074 if(optarg
== "none" ) {
1075 return theory::quantifiers::QUANT_DSPLIT_MODE_NONE
;
1076 } else if(optarg
== "default") {
1077 return theory::quantifiers::QUANT_DSPLIT_MODE_DEFAULT
;
1078 } else if(optarg
== "agg") {
1079 return theory::quantifiers::QUANT_DSPLIT_MODE_AGG
;
1080 } else if(optarg
== "help") {
1081 puts(s_quantDSplitHelp
.c_str());
1084 throw OptionException(std::string("unknown option for --quant-dsplit-mode: `") +
1085 optarg
+ "'. Try --quant-dsplit-mode help.");
1089 theory::quantifiers::QuantRepMode
OptionsHandler::stringToQuantRepMode(
1090 std::string option
, std::string optarg
)
1092 if(optarg
== "none" ) {
1093 return theory::quantifiers::QUANT_REP_MODE_EE
;
1094 } else if(optarg
== "first" || optarg
== "default") {
1095 return theory::quantifiers::QUANT_REP_MODE_FIRST
;
1096 } else if(optarg
== "depth") {
1097 return theory::quantifiers::QUANT_REP_MODE_DEPTH
;
1098 } else if(optarg
== "help") {
1099 puts(s_quantRepHelp
.c_str());
1102 throw OptionException(std::string("unknown option for --quant-rep-mode: `") +
1103 optarg
+ "'. Try --quant-rep-mode help.");
1107 // theory/bv/options_handlers.h
1108 void OptionsHandler::abcEnabledBuild(std::string option
, bool value
)
1110 #ifndef CVC4_USE_ABC
1112 std::stringstream ss
;
1113 ss
<< "option `" << option
<< "' requires an abc-enabled build of CVC4; this binary was not built with abc support";
1114 throw OptionException(ss
.str());
1116 #endif /* CVC4_USE_ABC */
1119 void OptionsHandler::abcEnabledBuild(std::string option
, std::string value
)
1121 #ifndef CVC4_USE_ABC
1122 if(!value
.empty()) {
1123 std::stringstream ss
;
1124 ss
<< "option `" << option
<< "' requires an abc-enabled build of CVC4; this binary was not built with abc support";
1125 throw OptionException(ss
.str());
1127 #endif /* CVC4_USE_ABC */
1130 void OptionsHandler::satSolverEnabledBuild(std::string option
, bool value
)
1132 #if !defined(CVC4_USE_CRYPTOMINISAT) && !defined(CVC4_USE_CADICAL)
1135 std::stringstream ss
;
1136 ss
<< "option `" << option
1137 << "' requires a CVC4 to be built with CryptoMiniSat or CaDiCaL";
1138 throw OptionException(ss
.str());
1143 void OptionsHandler::satSolverEnabledBuild(std::string option
,
1146 #if !defined(CVC4_USE_CRYPTOMINISAT) && !defined(CVC4_USE_CADICAL)
1149 std::stringstream ss
;
1150 ss
<< "option `" << option
1151 << "' requires a CVC4 to be built with CryptoMiniSat or CaDiCaL";
1152 throw OptionException(ss
.str());
1157 const std::string
OptionsHandler::s_bvSatSolverHelp
= "\
1158 Sat solvers currently supported by the --bv-sat-solver option:\n\
1160 minisat (default)\n\
1167 theory::bv::SatSolverMode
OptionsHandler::stringToSatSolver(std::string option
,
1170 if(optarg
== "minisat") {
1171 return theory::bv::SAT_SOLVER_MINISAT
;
1172 } else if(optarg
== "cryptominisat") {
1173 if (options::bitblastMode() == theory::bv::BITBLAST_MODE_LAZY
&&
1174 options::bitblastMode
.wasSetByUser()) {
1175 throwLazyBBUnsupported(theory::bv::SAT_SOLVER_CRYPTOMINISAT
);
1177 if (!options::bitvectorToBool
.wasSetByUser()) {
1178 options::bitvectorToBool
.set(true);
1180 return theory::bv::SAT_SOLVER_CRYPTOMINISAT
;
1182 else if (optarg
== "cadical")
1184 if (options::incrementalSolving()
1185 && options::incrementalSolving
.wasSetByUser())
1187 throw OptionException(
1188 std::string("CaDiCaL does not support incremental mode. \n\
1189 Try --bv-sat-solver=cryptominisat or "
1190 "--bv-sat-solver=minisat"));
1193 if (options::bitblastMode() == theory::bv::BITBLAST_MODE_LAZY
1194 && options::bitblastMode
.wasSetByUser())
1196 throwLazyBBUnsupported(theory::bv::SAT_SOLVER_CADICAL
);
1198 if (!options::bitvectorToBool
.wasSetByUser())
1200 options::bitvectorToBool
.set(true);
1202 return theory::bv::SAT_SOLVER_CADICAL
;
1203 } else if(optarg
== "help") {
1204 puts(s_bvSatSolverHelp
.c_str());
1207 throw OptionException(std::string("unknown option for --bv-sat-solver: `") +
1208 optarg
+ "'. Try --bv-sat-solver=help.");
1212 const std::string
OptionsHandler::s_bitblastingModeHelp
= "\
1213 Bit-blasting modes currently supported by the --bitblast option:\n\
1216 + Separate boolean structure and term reasoning between the core\n\
1217 SAT solver and the bv SAT solver\n\
1220 + Bitblast eagerly to bv SAT solver\n\
1223 theory::bv::BitblastMode
OptionsHandler::stringToBitblastMode(
1224 std::string option
, std::string optarg
)
1226 if(optarg
== "lazy") {
1227 if (!options::bitvectorPropagate
.wasSetByUser()) {
1228 options::bitvectorPropagate
.set(true);
1230 if (!options::bitvectorEqualitySolver
.wasSetByUser()) {
1231 options::bitvectorEqualitySolver
.set(true);
1233 if (!options::bitvectorEqualitySlicer
.wasSetByUser()) {
1234 if (options::incrementalSolving() ||
1235 options::produceModels()) {
1236 options::bitvectorEqualitySlicer
.set(theory::bv::BITVECTOR_SLICER_OFF
);
1238 options::bitvectorEqualitySlicer
.set(theory::bv::BITVECTOR_SLICER_AUTO
);
1242 if (!options::bitvectorInequalitySolver
.wasSetByUser()) {
1243 options::bitvectorInequalitySolver
.set(true);
1245 if (!options::bitvectorAlgebraicSolver
.wasSetByUser()) {
1246 options::bitvectorAlgebraicSolver
.set(true);
1248 if (options::bvSatSolver() != theory::bv::SAT_SOLVER_MINISAT
)
1250 throwLazyBBUnsupported(options::bvSatSolver());
1252 return theory::bv::BITBLAST_MODE_LAZY
;
1253 } else if(optarg
== "eager") {
1254 if (!options::bitvectorToBool
.wasSetByUser()) {
1255 options::bitvectorToBool
.set(true);
1258 if (!options::bvAbstraction
.wasSetByUser() &&
1259 !options::skolemizeArguments
.wasSetByUser()) {
1260 options::bvAbstraction
.set(true);
1261 options::skolemizeArguments
.set(true);
1263 return theory::bv::BITBLAST_MODE_EAGER
;
1264 } else if(optarg
== "help") {
1265 puts(s_bitblastingModeHelp
.c_str());
1268 throw OptionException(std::string("unknown option for --bitblast: `") +
1269 optarg
+ "'. Try --bitblast=help.");
1273 const std::string
OptionsHandler::s_bvSlicerModeHelp
= "\
1274 Bit-vector equality slicer modes supported by the --bv-eq-slicer option:\n\
1277 + Turn slicer on if input has only equalities over core symbols\n\
1283 + Turn slicer off\n\
1286 theory::bv::BvSlicerMode
OptionsHandler::stringToBvSlicerMode(
1287 std::string option
, std::string optarg
)
1289 if(optarg
== "auto") {
1290 return theory::bv::BITVECTOR_SLICER_AUTO
;
1291 } else if(optarg
== "on") {
1292 return theory::bv::BITVECTOR_SLICER_ON
;
1293 } else if(optarg
== "off") {
1294 return theory::bv::BITVECTOR_SLICER_OFF
;
1295 } else if(optarg
== "help") {
1296 puts(s_bvSlicerModeHelp
.c_str());
1299 throw OptionException(std::string("unknown option for --bv-eq-slicer: `") +
1300 optarg
+ "'. Try --bv-eq-slicer=help.");
1304 const std::string
OptionsHandler::s_boolToBVModeHelp
=
1306 BoolToBV pass modes supported by the --bool-to-bv option:\n\
1309 + Don't push any booleans to width one bit-vectors\n\
1312 + Try to turn ITEs into BITVECTOR_ITE when possible. It can fail per-formula \n\
1313 if not all sub-formulas can be turned to bit-vectors\n\
1316 + Force all booleans to be bit-vectors of width one except at the top level.\n\
1317 Most aggressive mode\n\
1320 preprocessing::passes::BoolToBVMode
OptionsHandler::stringToBoolToBVMode(
1321 std::string option
, std::string optarg
)
1323 if (optarg
== "off")
1325 return preprocessing::passes::BOOL_TO_BV_OFF
;
1327 else if (optarg
== "ite")
1329 return preprocessing::passes::BOOL_TO_BV_ITE
;
1331 else if (optarg
== "all")
1333 return preprocessing::passes::BOOL_TO_BV_ALL
;
1335 else if (optarg
== "help")
1337 puts(s_boolToBVModeHelp
.c_str());
1342 throw OptionException(std::string("unknown option for --bool-to-bv: `")
1344 + "'. Try --bool-to-bv=help");
1348 void OptionsHandler::setBitblastAig(std::string option
, bool arg
)
1351 if(options::bitblastMode
.wasSetByUser()) {
1352 if(options::bitblastMode() != theory::bv::BITBLAST_MODE_EAGER
) {
1353 throw OptionException("bitblast-aig must be used with eager bitblaster");
1356 theory::bv::BitblastMode mode
= stringToBitblastMode("", "eager");
1357 options::bitblastMode
.set(mode
);
1359 if(!options::bitvectorAigSimplifications
.wasSetByUser()) {
1360 options::bitvectorAigSimplifications
.set("balance;drw");
1365 // theory/uf/options_handlers.h
1366 const std::string
OptionsHandler::s_ufssModeHelp
= "\
1367 UF strong solver options currently supported by the --uf-ss option:\n\
1370 + Default, use uf strong solver to find minimal models for uninterpreted sorts.\n\
1373 + Use uf strong solver to shrink model sizes, but do no enforce minimality.\n\
1376 + Do not use uf strong solver to shrink model sizes. \n\
1380 theory::uf::UfssMode
OptionsHandler::stringToUfssMode(std::string option
,
1383 if(optarg
== "default" || optarg
== "full" ) {
1384 return theory::uf::UF_SS_FULL
;
1385 } else if(optarg
== "no-minimal") {
1386 return theory::uf::UF_SS_NO_MINIMAL
;
1387 } else if(optarg
== "none") {
1388 return theory::uf::UF_SS_NONE
;
1389 } else if(optarg
== "help") {
1390 puts(s_ufssModeHelp
.c_str());
1393 throw OptionException(std::string("unknown option for --uf-ss: `") +
1394 optarg
+ "'. Try --uf-ss help.");
1400 // theory/options_handlers.h
1401 const std::string
OptionsHandler::s_theoryOfModeHelp
= "\
1402 TheoryOf modes currently supported by the --theoryof-mode option:\n\
1405 + type variables, constants and equalities by type\n\
1408 + type variables as uninterpreted, equalities by the parametric theory\n\
1411 theory::TheoryOfMode
OptionsHandler::stringToTheoryOfMode(std::string option
, std::string optarg
) {
1412 if(optarg
== "type") {
1413 return theory::THEORY_OF_TYPE_BASED
;
1414 } else if(optarg
== "term") {
1415 return theory::THEORY_OF_TERM_BASED
;
1416 } else if(optarg
== "help") {
1417 puts(s_theoryOfModeHelp
.c_str());
1420 throw OptionException(std::string("unknown option for --theoryof-mode: `") +
1421 optarg
+ "'. Try --theoryof-mode help.");
1425 // theory/options_handlers.h
1426 std::string
OptionsHandler::handleUseTheoryList(std::string option
, std::string optarg
) {
1427 std::string currentList
= options::useTheoryList();
1428 if(currentList
.empty()){
1431 return currentList
+','+ optarg
;
1435 void OptionsHandler::notifyUseTheoryList(std::string option
) {
1436 d_options
->d_useTheoryListListeners
.notify();
1441 // printer/options_handlers.h
1442 const std::string
OptionsHandler::s_modelFormatHelp
= "\
1443 Model format modes currently supported by the --model-format option:\n\
1446 + Print model as expressions in the output language format.\n\
1449 + Print functional expressions over finite domains in a table format.\n\
1452 const std::string
OptionsHandler::s_instFormatHelp
= "\
1453 Inst format modes currently supported by the --model-format option:\n\
1456 + Print instantiations as a list in the output language format.\n\
1459 + Print instantiations as SZS compliant proof.\n\
1462 ModelFormatMode
OptionsHandler::stringToModelFormatMode(std::string option
,
1465 if(optarg
== "default") {
1466 return MODEL_FORMAT_MODE_DEFAULT
;
1467 } else if(optarg
== "table") {
1468 return MODEL_FORMAT_MODE_TABLE
;
1469 } else if(optarg
== "help") {
1470 puts(s_modelFormatHelp
.c_str());
1473 throw OptionException(std::string("unknown option for --model-format: `") +
1474 optarg
+ "'. Try --model-format help.");
1478 InstFormatMode
OptionsHandler::stringToInstFormatMode(std::string option
,
1481 if(optarg
== "default") {
1482 return INST_FORMAT_MODE_DEFAULT
;
1483 } else if(optarg
== "szs") {
1484 return INST_FORMAT_MODE_SZS
;
1485 } else if(optarg
== "help") {
1486 puts(s_instFormatHelp
.c_str());
1489 throw OptionException(std::string("unknown option for --inst-format: `") +
1490 optarg
+ "'. Try --inst-format help.");
1495 // decision/options_handlers.h
1496 const std::string
OptionsHandler::s_decisionModeHelp
= "\
1497 Decision modes currently supported by the --decision option:\n\
1499 internal (default)\n\
1500 + Use the internal decision heuristics of the SAT solver\n\
1503 + An ATGP-inspired justification heuristic\n\
1505 justification-stoponly\n\
1506 + Use the justification heuristic only to stop early, not for decisions\n\
1509 decision::DecisionMode
OptionsHandler::stringToDecisionMode(std::string option
,
1512 options::decisionStopOnly
.set(false);
1514 if(optarg
== "internal") {
1515 return decision::DECISION_STRATEGY_INTERNAL
;
1516 } else if(optarg
== "justification") {
1517 return decision::DECISION_STRATEGY_JUSTIFICATION
;
1518 } else if(optarg
== "justification-stoponly") {
1519 options::decisionStopOnly
.set(true);
1520 return decision::DECISION_STRATEGY_JUSTIFICATION
;
1521 } else if(optarg
== "help") {
1522 puts(s_decisionModeHelp
.c_str());
1525 throw OptionException(std::string("unknown option for --decision: `") +
1526 optarg
+ "'. Try --decision help.");
1530 decision::DecisionWeightInternal
OptionsHandler::stringToDecisionWeightInternal(
1531 std::string option
, std::string optarg
)
1534 return decision::DECISION_WEIGHT_INTERNAL_OFF
;
1535 else if(optarg
== "max")
1536 return decision::DECISION_WEIGHT_INTERNAL_MAX
;
1537 else if(optarg
== "sum")
1538 return decision::DECISION_WEIGHT_INTERNAL_SUM
;
1539 else if(optarg
== "usr1")
1540 return decision::DECISION_WEIGHT_INTERNAL_USR1
;
1542 throw OptionException(std::string("--decision-weight-internal must be off, max or sum."));
1546 // smt/options_handlers.h
1547 const std::string
OptionsHandler::s_simplificationHelp
= "\
1548 Simplification modes currently supported by the --simplification option:\n\
1551 + save up all ASSERTions; run nonclausal simplification and clausal\n\
1552 (MiniSat) propagation for all of them only after reaching a querying command\n\
1553 (CHECKSAT or QUERY or predicate SUBTYPE declaration)\n\
1556 + do not perform nonclausal simplification\n\
1559 SimplificationMode
OptionsHandler::stringToSimplificationMode(
1560 std::string option
, std::string optarg
)
1562 if(optarg
== "batch") {
1563 return SIMPLIFICATION_MODE_BATCH
;
1564 } else if(optarg
== "none") {
1565 return SIMPLIFICATION_MODE_NONE
;
1566 } else if(optarg
== "help") {
1567 puts(s_simplificationHelp
.c_str());
1570 throw OptionException(std::string("unknown option for --simplification: `") +
1571 optarg
+ "'. Try --simplification help.");
1575 const std::string
OptionsHandler::s_modelCoresHelp
=
1577 Model cores modes currently supported by the --simplification option:\n\
1580 + do not compute model cores\n\
1583 + only include a subset of variables whose values are sufficient to show the\n\
1584 input formula is satisfied by the given model\n\
1587 + only include a subset of variables whose values, in addition to the values\n\
1588 of variables whose values are implied, are sufficient to show the input\n\
1589 formula is satisfied by the given model\n\
1593 ModelCoresMode
OptionsHandler::stringToModelCoresMode(std::string option
,
1596 if (optarg
== "none")
1598 return MODEL_CORES_NONE
;
1600 else if (optarg
== "simple")
1602 return MODEL_CORES_SIMPLE
;
1604 else if (optarg
== "non-implied")
1606 return MODEL_CORES_NON_IMPLIED
;
1608 else if (optarg
== "help")
1610 puts(s_modelCoresHelp
.c_str());
1615 throw OptionException(std::string("unknown option for --model-cores: `")
1616 + optarg
+ "'. Try --model-cores help.");
1620 const std::string
OptionsHandler::s_sygusSolutionOutModeHelp
=
1622 Modes for finite model finding bound minimization, supported by --sygus-out:\n\
1625 + Print only status for check-synth calls.\n\
1627 status-and-def (default) \n\
1628 + Print status followed by definition corresponding to solution.\n\
1631 + Print status if infeasible, or definition corresponding to\n\
1632 solution if feasible.\n\
1635 + Print based on SyGuS standard.\n\
1639 SygusSolutionOutMode
OptionsHandler::stringToSygusSolutionOutMode(
1640 std::string option
, std::string optarg
)
1642 if (optarg
== "status")
1644 return SYGUS_SOL_OUT_STATUS
;
1646 else if (optarg
== "status-and-def")
1648 return SYGUS_SOL_OUT_STATUS_AND_DEF
;
1650 else if (optarg
== "status-or-def")
1652 return SYGUS_SOL_OUT_STATUS_OR_DEF
;
1654 else if (optarg
== "sygus-standard")
1656 return SYGUS_SOL_OUT_STANDARD
;
1658 else if (optarg
== "help")
1660 puts(s_sygusSolutionOutModeHelp
.c_str());
1665 throw OptionException(std::string("unknown option for --sygus-out: `")
1667 + "'. Try --sygus-out help.");
1671 void OptionsHandler::setProduceAssertions(std::string option
, bool value
)
1673 options::produceAssertions
.set(value
);
1674 options::interactiveMode
.set(value
);
1677 void OptionsHandler::proofEnabledBuild(std::string option
, bool value
)
1680 if (value
&& options::bitblastMode() == theory::bv::BITBLAST_MODE_EAGER
1681 && options::bvSatSolver() != theory::bv::SAT_SOLVER_MINISAT
)
1683 throw OptionException(
1684 "Eager BV proofs only supported when minisat is used");
1688 std::stringstream ss
;
1689 ss
<< "option `" << option
<< "' requires a proofs-enabled build of CVC4; this binary was not built with proof support";
1690 throw OptionException(ss
.str());
1692 #endif /* CVC4_PROOF */
1695 void OptionsHandler::LFSCEnabledBuild(std::string option
, bool value
) {
1696 #ifndef CVC4_USE_LFSC
1698 std::stringstream ss
;
1699 ss
<< "option `" << option
<< "' requires a build of CVC4 with integrated "
1700 "LFSC; this binary was not built with LFSC";
1701 throw OptionException(ss
.str());
1703 #endif /* CVC4_USE_LFSC */
1706 void OptionsHandler::notifyDumpToFile(std::string option
) {
1707 d_options
->d_dumpToFileListeners
.notify();
1711 void OptionsHandler::notifySetRegularOutputChannel(std::string option
) {
1712 d_options
->d_setRegularChannelListeners
.notify();
1715 void OptionsHandler::notifySetDiagnosticOutputChannel(std::string option
) {
1716 d_options
->d_setDiagnosticChannelListeners
.notify();
1720 std::string
OptionsHandler::checkReplayFilename(std::string option
, std::string optarg
) {
1723 throw OptionException (std::string("Bad file name for --replay"));
1727 #else /* CVC4_REPLAY */
1728 throw OptionException("The replay feature was disabled in this build of CVC4.");
1729 #endif /* CVC4_REPLAY */
1732 void OptionsHandler::notifySetReplayLogFilename(std::string option
) {
1733 d_options
->d_setReplayFilenameListeners
.notify();
1736 void OptionsHandler::statsEnabledBuild(std::string option
, bool value
)
1738 #ifndef CVC4_STATISTICS_ON
1740 std::stringstream ss
;
1741 ss
<< "option `" << option
<< "' requires a statistics-enabled build of CVC4; this binary was not built with statistics support";
1742 throw OptionException(ss
.str());
1744 #endif /* CVC4_STATISTICS_ON */
1747 void OptionsHandler::threadN(std::string option
) {
1748 throw OptionException(option
+ " is not a real option by itself. Use e.g. --thread0=\"--random-seed=10 --random-freq=0.02\" --thread1=\"--random-seed=20 --random-freq=0.05\"");
1751 void OptionsHandler::notifyDumpMode(std::string option
)
1753 d_options
->d_setDumpModeListeners
.notify();
1757 // expr/options_handlers.h
1758 void OptionsHandler::setDefaultExprDepthPredicate(std::string option
, int depth
) {
1760 throw OptionException("--default-expr-depth requires a positive argument, or -1.");
1764 void OptionsHandler::setDefaultDagThreshPredicate(std::string option
, int dag
) {
1766 throw OptionException("--default-dag-thresh requires a nonnegative argument.");
1770 void OptionsHandler::notifySetDefaultExprDepth(std::string option
) {
1771 d_options
->d_setDefaultExprDepthListeners
.notify();
1774 void OptionsHandler::notifySetDefaultDagThresh(std::string option
) {
1775 d_options
->d_setDefaultDagThreshListeners
.notify();
1778 void OptionsHandler::notifySetPrintExprTypes(std::string option
) {
1779 d_options
->d_setPrintExprTypesListeners
.notify();
1783 // main/options_handlers.h
1785 static void print_config (const char * str
, std::string config
) {
1788 if (s
.size() < sz
) s
.resize(sz
, ' ');
1789 std::cout
<< s
<< ": " << config
<< std::endl
;
1792 static void print_config_cond (const char * str
, bool cond
= false) {
1793 print_config(str
, cond
? "yes" : "no");
1796 void OptionsHandler::copyright(std::string option
) {
1797 std::cout
<< Configuration::copyright() << std::endl
;
1801 void OptionsHandler::showConfiguration(std::string option
) {
1802 std::cout
<< Configuration::about() << std::endl
;
1804 print_config ("version", Configuration::getVersionString());
1806 if(Configuration::isGitBuild()) {
1807 const char* branchName
= Configuration::getGitBranchName();
1808 if(*branchName
== '\0') { branchName
= "-"; }
1809 std::stringstream ss
;
1811 << branchName
<< " "
1812 << std::string(Configuration::getGitCommit()).substr(0, 8)
1813 << (Configuration::hasGitModifications() ? " (with modifications)" : "")
1815 print_config("scm", ss
.str());
1817 print_config_cond("scm", false);
1820 std::cout
<< std::endl
;
1822 std::stringstream ss
;
1823 ss
<< Configuration::getVersionMajor() << "."
1824 << Configuration::getVersionMinor() << "."
1825 << Configuration::getVersionRelease();
1826 print_config("library", ss
.str());
1828 std::cout
<< std::endl
;
1830 print_config_cond("debug code", Configuration::isDebugBuild());
1831 print_config_cond("statistics", Configuration::isStatisticsBuild());
1832 print_config_cond("replay", Configuration::isReplayBuild());
1833 print_config_cond("tracing", Configuration::isTracingBuild());
1834 print_config_cond("dumping", Configuration::isDumpingBuild());
1835 print_config_cond("muzzled", Configuration::isMuzzledBuild());
1836 print_config_cond("assertions", Configuration::isAssertionBuild());
1837 print_config_cond("proof", Configuration::isProofBuild());
1838 print_config_cond("coverage", Configuration::isCoverageBuild());
1839 print_config_cond("profiling", Configuration::isProfilingBuild());
1840 print_config_cond("asan", Configuration::isAsanBuild());
1841 print_config_cond("competition", Configuration::isCompetitionBuild());
1843 std::cout
<< std::endl
;
1845 print_config_cond("abc", Configuration::isBuiltWithAbc());
1846 print_config_cond("cln", Configuration::isBuiltWithCln());
1847 print_config_cond("glpk", Configuration::isBuiltWithGlpk());
1848 print_config_cond("cadical", Configuration::isBuiltWithCadical());
1849 print_config_cond("cryptominisat", Configuration::isBuiltWithCryptominisat());
1850 print_config_cond("gmp", Configuration::isBuiltWithGmp());
1851 print_config_cond("lfsc", Configuration::isBuiltWithLfsc());
1852 print_config_cond("readline", Configuration::isBuiltWithReadline());
1853 print_config_cond("symfpu", Configuration::isBuiltWithSymFPU());
1858 static void printTags(unsigned ntags
, char const* const* tags
)
1860 std::cout
<< "available tags:";
1861 for (unsigned i
= 0; i
< ntags
; ++ i
)
1863 std::cout
<< " " << tags
[i
] << std::endl
;
1865 std::cout
<< std::endl
;
1868 void OptionsHandler::showDebugTags(std::string option
)
1870 if (!Configuration::isDebugBuild())
1872 throw OptionException("debug tags not available in non-debug builds");
1874 else if (!Configuration::isTracingBuild())
1876 throw OptionException("debug tags not available in non-tracing builds");
1878 printTags(Configuration::getNumDebugTags(),Configuration::getDebugTags());
1882 void OptionsHandler::showTraceTags(std::string option
)
1884 if (!Configuration::isTracingBuild())
1886 throw OptionException("trace tags not available in non-tracing build");
1888 printTags(Configuration::getNumTraceTags(), Configuration::getTraceTags());
1892 static std::string
suggestTags(char const* const* validTags
,
1893 std::string inputTag
,
1894 char const* const* additionalTags
)
1896 DidYouMean didYouMean
;
1899 for (size_t i
= 0; (opt
= validTags
[i
]) != nullptr; ++i
)
1901 didYouMean
.addWord(validTags
[i
]);
1903 if (additionalTags
!= nullptr)
1905 for (size_t i
= 0; (opt
= additionalTags
[i
]) != nullptr; ++i
)
1907 didYouMean
.addWord(additionalTags
[i
]);
1911 return didYouMean
.getMatchAsString(inputTag
);
1914 void OptionsHandler::enableTraceTag(std::string option
, std::string optarg
)
1916 if(!Configuration::isTracingBuild())
1918 throw OptionException("trace tags not available in non-tracing builds");
1920 else if(!Configuration::isTraceTag(optarg
.c_str()))
1922 if (optarg
== "help")
1925 Configuration::getNumTraceTags(), Configuration::getTraceTags());
1929 throw OptionException(
1930 std::string("trace tag ") + optarg
+ std::string(" not available.")
1931 + suggestTags(Configuration::getTraceTags(), optarg
, nullptr));
1936 void OptionsHandler::enableDebugTag(std::string option
, std::string optarg
)
1938 if (!Configuration::isDebugBuild())
1940 throw OptionException("debug tags not available in non-debug builds");
1942 else if (!Configuration::isTracingBuild())
1944 throw OptionException("debug tags not available in non-tracing builds");
1947 if (!Configuration::isDebugTag(optarg
.c_str())
1948 && !Configuration::isTraceTag(optarg
.c_str()))
1950 if (optarg
== "help")
1953 Configuration::getNumDebugTags(), Configuration::getDebugTags());
1957 throw OptionException(std::string("debug tag ") + optarg
1958 + std::string(" not available.")
1959 + suggestTags(Configuration::getDebugTags(),
1961 Configuration::getTraceTags()));
1967 OutputLanguage
OptionsHandler::stringToOutputLanguage(std::string option
,
1970 if(optarg
== "help") {
1971 options::languageHelp
.set(true);
1972 return language::output::LANG_AUTO
;
1976 return language::toOutputLanguage(optarg
);
1977 } catch(OptionException
& oe
) {
1978 throw OptionException("Error in " + option
+ ": " + oe
.getMessage() +
1979 "\nTry --output-language help");
1985 InputLanguage
OptionsHandler::stringToInputLanguage(std::string option
,
1988 if(optarg
== "help") {
1989 options::languageHelp
.set(true);
1990 return language::input::LANG_AUTO
;
1994 return language::toInputLanguage(optarg
);
1995 } catch(OptionException
& oe
) {
1996 throw OptionException("Error in " + option
+ ": " + oe
.getMessage() + "\nTry --language help");
2002 /* options/base_options_handlers.h */
2003 void OptionsHandler::setVerbosity(std::string option
, int value
)
2005 if(Configuration::isMuzzledBuild()) {
2006 DebugChannel
.setStream(&CVC4::null_os
);
2007 TraceChannel
.setStream(&CVC4::null_os
);
2008 NoticeChannel
.setStream(&CVC4::null_os
);
2009 ChatChannel
.setStream(&CVC4::null_os
);
2010 MessageChannel
.setStream(&CVC4::null_os
);
2011 WarningChannel
.setStream(&CVC4::null_os
);
2014 ChatChannel
.setStream(&CVC4::null_os
);
2016 ChatChannel
.setStream(&std::cout
);
2019 NoticeChannel
.setStream(&CVC4::null_os
);
2021 NoticeChannel
.setStream(&std::cout
);
2024 MessageChannel
.setStream(&CVC4::null_os
);
2025 WarningChannel
.setStream(&CVC4::null_os
);
2027 MessageChannel
.setStream(&std::cout
);
2028 WarningChannel
.setStream(&std::cerr
);
2033 void OptionsHandler::increaseVerbosity(std::string option
) {
2034 options::verbosity
.set(options::verbosity() + 1);
2035 setVerbosity(option
, options::verbosity());
2038 void OptionsHandler::decreaseVerbosity(std::string option
) {
2039 options::verbosity
.set(options::verbosity() - 1);
2040 setVerbosity(option
, options::verbosity());
2044 }/* CVC4::options namespace */
2045 }/* CVC4 namespace */