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/quantifiers_modes.h"
46 #include "options/simplification_mode.h"
47 #include "options/smt_options.h"
48 #include "options/theory_options.h"
49 #include "options/theoryof_mode.h"
50 #include "options/ufss_mode.h"
58 void throwLazyBBUnsupported(theory::bv::SatSolverMode m
)
60 std::string sat_solver
;
61 if (m
== theory::bv::SAT_SOLVER_CADICAL
)
63 sat_solver
= "CaDiCaL";
67 Assert(m
== theory::bv::SAT_SOLVER_CRYPTOMINISAT
);
68 sat_solver
= "CryptoMiniSat";
70 std::string
indent(25, ' ');
71 throw OptionException(sat_solver
+ " does not support lazy bit-blasting.\n"
72 + indent
+ "Try --bv-sat-solver=minisat");
77 OptionsHandler::OptionsHandler(Options
* options
) : d_options(options
) { }
79 void OptionsHandler::notifyForceLogic(const std::string
& option
){
80 d_options
->d_forceLogicListeners
.notify();
83 void OptionsHandler::notifyBeforeSearch(const std::string
& option
)
86 d_options
->d_beforeSearchListeners
.notify();
87 } catch (ModalException
&){
89 ss
<< "cannot change option `" << option
90 << "' after final initialization (i.e., after logic has been set)";
91 throw ModalException(ss
.str());
96 void OptionsHandler::notifyTlimit(const std::string
& option
) {
97 d_options
->d_tlimitListeners
.notify();
100 void OptionsHandler::notifyTlimitPer(const std::string
& option
) {
101 d_options
->d_tlimitPerListeners
.notify();
104 void OptionsHandler::notifyRlimit(const std::string
& option
) {
105 d_options
->d_rlimitListeners
.notify();
108 void OptionsHandler::notifyRlimitPer(const std::string
& option
) {
109 d_options
->d_rlimitPerListeners
.notify();
112 unsigned long OptionsHandler::limitHandler(std::string option
,
116 std::istringstream
convert(optarg
);
117 if (!(convert
>> ms
))
119 throw OptionException("option `" + option
120 + "` requires a number as an argument");
125 /* options/base_options_handlers.h */
126 void OptionsHandler::notifyPrintSuccess(std::string option
) {
127 d_options
->d_setPrintSuccessListeners
.notify();
130 // theory/arith/options_handlers.h
131 const std::string
OptionsHandler::s_arithUnateLemmasHelp
= "\
132 Unate lemmas are generated before SAT search begins using the relationship\n\
133 of constant terms and polynomials.\n\
134 Modes currently supported by the --unate-lemmas option:\n\
137 Outputs lemmas of the general form (<= p c) implies (<= p d) for c < d.\n\
139 Outputs lemmas of the general forms\n\
140 (= p c) implies (<= p d) for c < d, or\n\
141 (= p c) implies (not (= p d)) for c != d.\n\
143 A combination of inequalities and equalities.\n\
146 const std::string
OptionsHandler::s_arithPropagationModeHelp
= "\
147 This decides on kind of propagation arithmetic attempts to do during the search.\n\
150 use constraints to do unate propagation\n\
151 + bi (Bounds Inference)\n\
152 infers bounds on basic variables using the upper and lower bounds of the\n\
153 non-basic variables in the tableau.\n\
157 const std::string
OptionsHandler::s_errorSelectionRulesHelp
= "\
158 This decides on the rule used by simplex during heuristic rounds\n\
159 for deciding the next basic variable to select.\n\
160 Heuristic pivot rules available:\n\
162 The minimum abs() value of the variable's violation of its bound. (default)\n\
164 The maximum violation the bound\n\
166 The variable order\n\
169 ArithUnateLemmaMode
OptionsHandler::stringToArithUnateLemmaMode(
170 std::string option
, std::string optarg
)
172 if(optarg
== "all") {
173 return ALL_PRESOLVE_LEMMAS
;
174 } else if(optarg
== "none") {
175 return NO_PRESOLVE_LEMMAS
;
176 } else if(optarg
== "ineqs") {
177 return INEQUALITY_PRESOLVE_LEMMAS
;
178 } else if(optarg
== "eqs") {
179 return EQUALITY_PRESOLVE_LEMMAS
;
180 } else if(optarg
== "help") {
181 puts(s_arithUnateLemmasHelp
.c_str());
184 throw OptionException(std::string("unknown option for --unate-lemmas: `") +
185 optarg
+ "'. Try --unate-lemmas help.");
189 ArithPropagationMode
OptionsHandler::stringToArithPropagationMode(
190 std::string option
, std::string optarg
)
192 if(optarg
== "none") {
194 } else if(optarg
== "unate") {
196 } else if(optarg
== "bi") {
197 return BOUND_INFERENCE_PROP
;
198 } else if(optarg
== "both") {
200 } else if(optarg
== "help") {
201 puts(s_arithPropagationModeHelp
.c_str());
204 throw OptionException(std::string("unknown option for --arith-prop: `") +
205 optarg
+ "'. Try --arith-prop help.");
209 ErrorSelectionRule
OptionsHandler::stringToErrorSelectionRule(
210 std::string option
, std::string optarg
)
212 if(optarg
== "min") {
213 return MINIMUM_AMOUNT
;
214 } else if(optarg
== "varord") {
216 } else if(optarg
== "max") {
217 return MAXIMUM_AMOUNT
;
218 } else if(optarg
== "help") {
219 puts(s_errorSelectionRulesHelp
.c_str());
222 throw OptionException(std::string("unknown option for --heuristic-pivot-rule: `") +
223 optarg
+ "'. Try --heuristic-pivot-rule help.");
226 // theory/quantifiers/options_handlers.h
228 const std::string
OptionsHandler::s_instWhenHelp
= "\
229 Modes currently supported by the --inst-when option:\n\
231 full-last-call (default)\n\
232 + Alternate running instantiation rounds at full effort and last\n\
233 call. In other words, interleave instantiation and theory combination.\n\
236 + Run instantiation round at full effort, before theory combination.\n\
239 + Run instantiation round at full effort, before theory combination, after\n\
240 all other theories have finished.\n\
242 full-delay-last-call \n\
243 + Alternate running instantiation rounds at full effort after all other\n\
244 theories have finished, and last call. \n\
247 + Run instantiation at last call effort, after theory combination and\n\
248 and theories report sat.\n\
252 const std::string
OptionsHandler::s_literalMatchHelp
= "\
253 Literal match modes currently supported by the --literal-match option:\n\
256 + Do not use literal matching.\n\
259 + Consider phase requirements of triggers conservatively. For example, the\n\
260 trigger P( x ) in forall( x ). ( P( x ) V ~Q( x ) ) will not be matched with\n\
261 terms in the equivalence class of true, and likewise Q( x ) will not be matched\n\
262 terms in the equivalence class of false. Extends to equality.\n\
265 + Consider phase requirements aggressively for predicates. In the above example,\n\
266 only match P( x ) with terms that are in the equivalence class of false.\n\
269 + Consider the phase requirements aggressively for all triggers.\n\
273 const std::string
OptionsHandler::s_mbqiModeHelp
= "\
274 Model-based quantifier instantiation modes currently supported by the --mbqi option:\n\
277 + Use algorithm from Section 5.4.2 of thesis Finite Model Finding in Satisfiability \n\
281 + Disable model-based quantifier instantiation.\n\
284 + Use model-based quantifier instantiation algorithm from CADE 24 finite\n\
285 model finding paper based on generalizing evaluations.\n\
288 + Use abstract MBQI algorithm (uses disjoint sets). \n\
292 const std::string
OptionsHandler::s_qcfWhenModeHelp
= "\
293 Quantifier conflict find modes currently supported by the --quant-cf-when option:\n\
296 + Default, apply conflict finding at full effort.\n\
299 + Apply conflict finding at last call, after theory combination and \n\
300 and all theories report sat. \n\
303 + Apply conflict finding at standard effort.\n\
306 + Apply conflict finding at standard effort when heuristic says to. \n\
310 const std::string
OptionsHandler::s_qcfModeHelp
= "\
311 Quantifier conflict find modes currently supported by the --quant-cf option:\n\
314 + Default, apply QCF algorithm to propagate equalities as well as conflicts. \n\
317 + Apply QCF algorithm to find conflicts only.\n\
321 const std::string
OptionsHandler::s_userPatModeHelp
= "\
322 User pattern modes currently supported by the --user-pat option:\n\
325 + When provided, use only user-provided patterns for a quantified formula.\n\
328 + Use both user-provided and auto-generated patterns when patterns\n\
329 are provided for a quantified formula.\n\
332 + Use user-provided patterns only after auto-generated patterns saturate.\n\
335 + Ignore user-provided patterns. \n\
338 + Alternate between use/resort. \n\
342 const std::string
OptionsHandler::s_triggerSelModeHelp
= "\
343 Trigger selection modes currently supported by the --trigger-sel option:\n\
346 + Consider only minimal subterms that meet criteria for triggers.\n\
349 + Consider only maximal subterms that meet criteria for triggers. \n\
352 + Consider all subterms that meet criteria for triggers. \n\
355 + Consider only minimal subterms that meet criteria for single triggers, maximal otherwise. \n\
358 + Consider only minimal subterms that meet criteria for single triggers, all otherwise. \n\
361 const std::string
OptionsHandler::s_triggerActiveSelModeHelp
= "\
362 Trigger active selection modes currently supported by the --trigger-sel option:\n\
365 + Make all triggers active. \n\
368 + Activate triggers with minimal ground terms.\n\
371 + Activate triggers with maximal ground terms. \n\
374 const std::string
OptionsHandler::s_prenexQuantModeHelp
= "\
375 Prenex quantifiers modes currently supported by the --prenex-quant option:\n\
378 + Do no prenex nested quantifiers. \n\
381 + Default, do simple prenexing of same sign quantifiers.\n\
384 + Prenex to disjunctive prenex normal form.\n\
387 + Prenex to prenex normal form.\n\
391 const std::string
OptionsHandler::s_cegqiFairModeHelp
= "\
392 Modes for enforcing fairness for counterexample guided quantifier instantion, supported by --sygus-fair:\n\
395 + Enforce fairness using an uninterpreted function for datatypes size.\n\
398 + Enforce fairness using direct conflict lemmas.\n\
400 default | dt-size \n\
401 + Default, enforce fairness using size operator.\n\
404 + Enforce fairness by height bound predicate.\n\
407 + Do not enforce fairness. \n\
411 const std::string
OptionsHandler::s_termDbModeHelp
= "\
412 Modes for term database, supported by --term-db-mode:\n\
415 + Quantifiers module considers all ground terms.\n\
418 + Quantifiers module considers only ground terms connected to current assertions. \n\
422 const std::string
OptionsHandler::s_iteLiftQuantHelp
= "\
423 Modes for term database, supported by --ite-lift-quant:\n\
426 + Do not lift if-then-else in quantified formulas.\n\
429 + Lift if-then-else in quantified formulas if results in smaller term size.\n\
432 + Lift if-then-else in quantified formulas. \n\
436 const std::string
OptionsHandler::s_cbqiBvIneqModeHelp
=
438 Modes for single invocation techniques, supported by --cbqi-bv-ineq:\n\
440 eq-slack (default) \n\
441 + Solve for the inequality using the slack value in the model, e.g.,\
442 t > s becomes t = s + ( t-s )^M.\n\
445 + Solve for the boundary point of the inequality, e.g.,\
446 t > s becomes t = s+1.\n\
449 + Solve for the inequality directly using side conditions for invertibility.\n\
453 const std::string
OptionsHandler::s_cegqiSingleInvHelp
= "\
454 Modes for single invocation techniques, supported by --cegqi-si:\n\
457 + Do not use single invocation techniques.\n\
460 + Use single invocation techniques only if grammar is not restrictive.\n\
463 + Always use single invocation techniques, abort if solution reconstruction will likely fail,\
464 for instance, when the grammar does not have ITE and solution requires it.\n\
467 + Always use single invocation techniques. \n\
471 const std::string
OptionsHandler::s_cegqiSingleInvRconsHelp
=
473 Modes for reconstruction solutions while using single invocation techniques,\
474 supported by --cegqi-si-rcons:\n\
477 + Do not try to reconstruct solutions in the original (user-provided) grammar\
478 when using single invocation techniques. In this mode, solutions produced by\
479 CVC4 may violate grammar restrictions.\n\
482 + Try to reconstruct solutions in the original grammar when using single\
483 invocation techniques in an incomplete (fail-fast) manner.\n\
486 + Try to reconstruct solutions in the original grammar, but termintate if a\
487 maximum number of rounds for reconstruction is exceeded.\n\
490 + Try to reconstruct solutions in the original grammar. In this mode,\
491 we do not terminate until a solution is successfully reconstructed. \n\
495 const std::string
OptionsHandler::s_cegisSampleHelp
=
497 Modes for sampling with counterexample-guided inductive synthesis (CEGIS),\
498 supported by --cegis-sample:\n\
501 + Do not use sampling with CEGIS.\n\
504 + Use sampling to accelerate CEGIS. This will rule out solutions for a\
505 conjecture when they are not satisfied by a sample point.\n\
508 + Trust that when a solution for a conjecture is always true under sampling,\
509 then it is indeed a solution. Note this option may print out spurious\
510 solutions for synthesis conjectures.\n\
514 const std::string
OptionsHandler::s_sygusInvTemplHelp
= "\
515 Template modes for sygus invariant synthesis, supported by --sygus-inv-templ:\n\
518 + Synthesize invariant directly.\n\
521 + Synthesize invariant based on weakening of precondition .\n\
524 + Synthesize invariant based on strengthening of postcondition. \n\
528 const std::string
OptionsHandler::s_macrosQuantHelp
= "\
529 Modes for quantifiers macro expansion, supported by --macros-quant-mode:\n\
532 + Infer definitions for functions, including those containing quantified formulas.\n\
535 + Only infer ground definitions for functions.\n\
538 + Only infer ground definitions for functions that result in triggers for all free variables.\n\
542 const std::string
OptionsHandler::s_quantDSplitHelp
= "\
543 Modes for quantifiers splitting, supported by --quant-dsplit-mode:\n\
546 + Never split quantified formulas.\n\
549 + Split quantified formulas over some finite datatypes when finite model finding is enabled.\n\
552 + Aggressively split quantified formulas.\n\
556 const std::string
OptionsHandler::s_quantRepHelp
= "\
557 Modes for quantifiers representative selection, supported by --quant-rep-mode:\n\
560 + Let equality engine choose representatives.\n\
563 + Choose terms that appear first.\n\
566 + Choose terms that are of minimal depth.\n\
570 theory::quantifiers::InstWhenMode
OptionsHandler::stringToInstWhenMode(
571 std::string option
, std::string optarg
)
573 if(optarg
== "pre-full") {
574 return theory::quantifiers::INST_WHEN_PRE_FULL
;
575 } else if(optarg
== "full") {
576 return theory::quantifiers::INST_WHEN_FULL
;
577 } else if(optarg
== "full-delay") {
578 return theory::quantifiers::INST_WHEN_FULL_DELAY
;
579 } else if(optarg
== "full-last-call") {
580 return theory::quantifiers::INST_WHEN_FULL_LAST_CALL
;
581 } else if(optarg
== "full-delay-last-call") {
582 return theory::quantifiers::INST_WHEN_FULL_DELAY_LAST_CALL
;
583 } else if(optarg
== "last-call") {
584 return theory::quantifiers::INST_WHEN_LAST_CALL
;
585 } else if(optarg
== "help") {
586 puts(s_instWhenHelp
.c_str());
589 throw OptionException(std::string("unknown option for --inst-when: `") +
590 optarg
+ "'. Try --inst-when help.");
594 void OptionsHandler::checkInstWhenMode(std::string option
,
595 theory::quantifiers::InstWhenMode mode
)
597 if(mode
== theory::quantifiers::INST_WHEN_PRE_FULL
) {
598 throw OptionException(std::string("Mode pre-full for ") + option
+ " is not supported in this release.");
602 theory::quantifiers::LiteralMatchMode
OptionsHandler::stringToLiteralMatchMode(
603 std::string option
, std::string optarg
)
605 if(optarg
== "none") {
606 return theory::quantifiers::LITERAL_MATCH_NONE
;
607 } else if(optarg
== "use") {
608 return theory::quantifiers::LITERAL_MATCH_USE
;
609 } else if(optarg
== "agg-predicate") {
610 return theory::quantifiers::LITERAL_MATCH_AGG_PREDICATE
;
611 } else if(optarg
== "agg") {
612 return theory::quantifiers::LITERAL_MATCH_AGG
;
613 } else if(optarg
== "help") {
614 puts(s_literalMatchHelp
.c_str());
617 throw OptionException(std::string("unknown option for --literal-matching: `") +
618 optarg
+ "'. Try --literal-matching help.");
622 void OptionsHandler::checkLiteralMatchMode(
623 std::string option
, theory::quantifiers::LiteralMatchMode mode
)
627 theory::quantifiers::MbqiMode
OptionsHandler::stringToMbqiMode(
628 std::string option
, std::string optarg
)
630 if(optarg
== "gen-ev") {
631 return theory::quantifiers::MBQI_GEN_EVAL
;
632 } else if(optarg
== "none") {
633 return theory::quantifiers::MBQI_NONE
;
634 } else if(optarg
== "default" || optarg
== "fmc") {
635 return theory::quantifiers::MBQI_FMC
;
636 } else if(optarg
== "abs") {
637 return theory::quantifiers::MBQI_ABS
;
638 } else if(optarg
== "trust") {
639 return theory::quantifiers::MBQI_TRUST
;
640 } else if(optarg
== "help") {
641 puts(s_mbqiModeHelp
.c_str());
644 throw OptionException(std::string("unknown option for --mbqi: `") +
645 optarg
+ "'. Try --mbqi help.");
649 void OptionsHandler::checkMbqiMode(std::string option
,
650 theory::quantifiers::MbqiMode mode
)
654 theory::quantifiers::QcfWhenMode
OptionsHandler::stringToQcfWhenMode(
655 std::string option
, std::string optarg
)
657 if(optarg
== "default") {
658 return theory::quantifiers::QCF_WHEN_MODE_DEFAULT
;
659 } else if(optarg
== "last-call") {
660 return theory::quantifiers::QCF_WHEN_MODE_LAST_CALL
;
661 } else if(optarg
== "std") {
662 return theory::quantifiers::QCF_WHEN_MODE_STD
;
663 } else if(optarg
== "std-h") {
664 return theory::quantifiers::QCF_WHEN_MODE_STD_H
;
665 } else if(optarg
== "help") {
666 puts(s_qcfWhenModeHelp
.c_str());
669 throw OptionException(std::string("unknown option for --quant-cf-when: `") +
670 optarg
+ "'. Try --quant-cf-when help.");
674 theory::quantifiers::QcfMode
OptionsHandler::stringToQcfMode(std::string option
,
677 if(optarg
== "conflict") {
678 return theory::quantifiers::QCF_CONFLICT_ONLY
;
679 } else if(optarg
== "default" || optarg
== "prop-eq") {
680 return theory::quantifiers::QCF_PROP_EQ
;
681 } else if(optarg
== "help") {
682 puts(s_qcfModeHelp
.c_str());
685 throw OptionException(std::string("unknown option for --quant-cf-mode: `") +
686 optarg
+ "'. Try --quant-cf-mode help.");
690 theory::quantifiers::UserPatMode
OptionsHandler::stringToUserPatMode(
691 std::string option
, std::string optarg
)
693 if(optarg
== "use") {
694 return theory::quantifiers::USER_PAT_MODE_USE
;
695 } else if(optarg
== "default" || optarg
== "trust") {
696 return theory::quantifiers::USER_PAT_MODE_TRUST
;
697 } else if(optarg
== "resort") {
698 return theory::quantifiers::USER_PAT_MODE_RESORT
;
699 } else if(optarg
== "ignore") {
700 return theory::quantifiers::USER_PAT_MODE_IGNORE
;
701 } else if(optarg
== "interleave") {
702 return theory::quantifiers::USER_PAT_MODE_INTERLEAVE
;
703 } else if(optarg
== "help") {
704 puts(s_userPatModeHelp
.c_str());
707 throw OptionException(std::string("unknown option for --user-pat: `") +
708 optarg
+ "'. Try --user-pat help.");
712 theory::quantifiers::TriggerSelMode
OptionsHandler::stringToTriggerSelMode(
713 std::string option
, std::string optarg
)
715 if(optarg
== "default" || optarg
== "min") {
716 return theory::quantifiers::TRIGGER_SEL_MIN
;
717 } else if(optarg
== "max") {
718 return theory::quantifiers::TRIGGER_SEL_MAX
;
719 } else if(optarg
== "min-s-max") {
720 return theory::quantifiers::TRIGGER_SEL_MIN_SINGLE_MAX
;
721 } else if(optarg
== "min-s-all") {
722 return theory::quantifiers::TRIGGER_SEL_MIN_SINGLE_ALL
;
723 } else if(optarg
== "all") {
724 return theory::quantifiers::TRIGGER_SEL_ALL
;
725 } else if(optarg
== "help") {
726 puts(s_triggerSelModeHelp
.c_str());
729 throw OptionException(std::string("unknown option for --trigger-sel: `") +
730 optarg
+ "'. Try --trigger-sel help.");
734 theory::quantifiers::TriggerActiveSelMode
735 OptionsHandler::stringToTriggerActiveSelMode(std::string option
,
738 if(optarg
== "default" || optarg
== "all") {
739 return theory::quantifiers::TRIGGER_ACTIVE_SEL_ALL
;
740 } else if(optarg
== "min") {
741 return theory::quantifiers::TRIGGER_ACTIVE_SEL_MIN
;
742 } else if(optarg
== "max") {
743 return theory::quantifiers::TRIGGER_ACTIVE_SEL_MAX
;
744 } else if(optarg
== "help") {
745 puts(s_triggerActiveSelModeHelp
.c_str());
748 throw OptionException(std::string("unknown option for --trigger-active-sel: `") +
749 optarg
+ "'. Try --trigger-active-sel help.");
753 theory::quantifiers::PrenexQuantMode
OptionsHandler::stringToPrenexQuantMode(
754 std::string option
, std::string optarg
)
756 if(optarg
== "default" || optarg
== "simple" ) {
757 return theory::quantifiers::PRENEX_QUANT_SIMPLE
;
758 } else if(optarg
== "none") {
759 return theory::quantifiers::PRENEX_QUANT_NONE
;
760 } else if(optarg
== "dnorm") {
761 return theory::quantifiers::PRENEX_QUANT_DISJ_NORMAL
;
762 } else if(optarg
== "norm") {
763 return theory::quantifiers::PRENEX_QUANT_NORMAL
;
764 } else if(optarg
== "help") {
765 puts(s_prenexQuantModeHelp
.c_str());
768 throw OptionException(std::string("unknown option for --prenex-quant: `") +
769 optarg
+ "'. Try --prenex-quant help.");
773 theory::SygusFairMode
OptionsHandler::stringToSygusFairMode(std::string option
,
776 if(optarg
== "direct") {
777 return theory::SYGUS_FAIR_DIRECT
;
778 } else if(optarg
== "default" || optarg
== "dt-size") {
779 return theory::SYGUS_FAIR_DT_SIZE
;
780 } else if(optarg
== "dt-height-bound" ){
781 return theory::SYGUS_FAIR_DT_HEIGHT_PRED
;
782 } else if(optarg
== "dt-size-bound" ){
783 return theory::SYGUS_FAIR_DT_SIZE_PRED
;
784 } else if(optarg
== "none") {
785 return theory::SYGUS_FAIR_NONE
;
786 } else if(optarg
== "help") {
787 puts(s_cegqiFairModeHelp
.c_str());
790 throw OptionException(std::string("unknown option for --cegqi-fair: `") +
791 optarg
+ "'. Try --cegqi-fair help.");
795 theory::quantifiers::TermDbMode
OptionsHandler::stringToTermDbMode(
796 std::string option
, std::string optarg
)
798 if(optarg
== "all" ) {
799 return theory::quantifiers::TERM_DB_ALL
;
800 } else if(optarg
== "relevant") {
801 return theory::quantifiers::TERM_DB_RELEVANT
;
802 } else if(optarg
== "help") {
803 puts(s_termDbModeHelp
.c_str());
806 throw OptionException(std::string("unknown option for --term-db-mode: `") +
807 optarg
+ "'. Try --term-db-mode help.");
811 theory::quantifiers::IteLiftQuantMode
OptionsHandler::stringToIteLiftQuantMode(
812 std::string option
, std::string optarg
)
814 if(optarg
== "all" ) {
815 return theory::quantifiers::ITE_LIFT_QUANT_MODE_ALL
;
816 } else if(optarg
== "simple") {
817 return theory::quantifiers::ITE_LIFT_QUANT_MODE_SIMPLE
;
818 } else if(optarg
== "none") {
819 return theory::quantifiers::ITE_LIFT_QUANT_MODE_NONE
;
820 } else if(optarg
== "help") {
821 puts(s_iteLiftQuantHelp
.c_str());
824 throw OptionException(std::string("unknown option for --ite-lift-quant: `") +
825 optarg
+ "'. Try --ite-lift-quant help.");
829 theory::quantifiers::CbqiBvIneqMode
OptionsHandler::stringToCbqiBvIneqMode(
830 std::string option
, std::string optarg
)
832 if (optarg
== "eq-slack")
834 return theory::quantifiers::CBQI_BV_INEQ_EQ_SLACK
;
836 else if (optarg
== "eq-boundary")
838 return theory::quantifiers::CBQI_BV_INEQ_EQ_BOUNDARY
;
840 else if (optarg
== "keep")
842 return theory::quantifiers::CBQI_BV_INEQ_KEEP
;
844 else if (optarg
== "help")
846 puts(s_cbqiBvIneqModeHelp
.c_str());
851 throw OptionException(std::string("unknown option for --cbqi-bv-ineq: `")
853 + "'. Try --cbqi-bv-ineq help.");
857 theory::quantifiers::CegqiSingleInvMode
858 OptionsHandler::stringToCegqiSingleInvMode(std::string option
,
861 if(optarg
== "none" ) {
862 return theory::quantifiers::CEGQI_SI_MODE_NONE
;
863 } else if(optarg
== "use" || optarg
== "default") {
864 return theory::quantifiers::CEGQI_SI_MODE_USE
;
865 } else if(optarg
== "all") {
866 return theory::quantifiers::CEGQI_SI_MODE_ALL
;
867 } else if(optarg
== "help") {
868 puts(s_cegqiSingleInvHelp
.c_str());
871 throw OptionException(std::string("unknown option for --cegqi-si: `") +
872 optarg
+ "'. Try --cegqi-si help.");
876 theory::quantifiers::CegqiSingleInvRconsMode
877 OptionsHandler::stringToCegqiSingleInvRconsMode(std::string option
,
880 if (optarg
== "none")
882 return theory::quantifiers::CEGQI_SI_RCONS_MODE_NONE
;
884 else if (optarg
== "try")
886 return theory::quantifiers::CEGQI_SI_RCONS_MODE_TRY
;
888 else if (optarg
== "all")
890 return theory::quantifiers::CEGQI_SI_RCONS_MODE_ALL
;
892 else if (optarg
== "all-limit")
894 return theory::quantifiers::CEGQI_SI_RCONS_MODE_ALL_LIMIT
;
896 else if (optarg
== "help")
898 puts(s_cegqiSingleInvRconsHelp
.c_str());
903 throw OptionException(std::string("unknown option for --cegqi-si-rcons: `")
904 + optarg
+ "'. Try --cegqi-si-rcons help.");
908 theory::quantifiers::CegisSampleMode
OptionsHandler::stringToCegisSampleMode(
909 std::string option
, std::string optarg
)
911 if (optarg
== "none")
913 return theory::quantifiers::CEGIS_SAMPLE_NONE
;
915 else if (optarg
== "use")
917 return theory::quantifiers::CEGIS_SAMPLE_USE
;
919 else if (optarg
== "trust")
921 return theory::quantifiers::CEGIS_SAMPLE_TRUST
;
923 else if (optarg
== "help")
925 puts(s_cegisSampleHelp
.c_str());
930 throw OptionException(std::string("unknown option for --cegis-sample: `")
932 + "'. Try --cegis-sample help.");
936 theory::quantifiers::SygusInvTemplMode
937 OptionsHandler::stringToSygusInvTemplMode(std::string option
,
940 if(optarg
== "none" ) {
941 return theory::quantifiers::SYGUS_INV_TEMPL_MODE_NONE
;
942 } else if(optarg
== "pre") {
943 return theory::quantifiers::SYGUS_INV_TEMPL_MODE_PRE
;
944 } else if(optarg
== "post") {
945 return theory::quantifiers::SYGUS_INV_TEMPL_MODE_POST
;
946 } else if(optarg
== "help") {
947 puts(s_sygusInvTemplHelp
.c_str());
950 throw OptionException(std::string("unknown option for --sygus-inv-templ: `") +
951 optarg
+ "'. Try --sygus-inv-templ help.");
955 theory::quantifiers::MacrosQuantMode
OptionsHandler::stringToMacrosQuantMode(
956 std::string option
, std::string optarg
)
958 if(optarg
== "all" ) {
959 return theory::quantifiers::MACROS_QUANT_MODE_ALL
;
960 } else if(optarg
== "ground") {
961 return theory::quantifiers::MACROS_QUANT_MODE_GROUND
;
962 } else if(optarg
== "ground-uf") {
963 return theory::quantifiers::MACROS_QUANT_MODE_GROUND_UF
;
964 } else if(optarg
== "help") {
965 puts(s_macrosQuantHelp
.c_str());
968 throw OptionException(std::string("unknown option for --macros-quant-mode: `") +
969 optarg
+ "'. Try --macros-quant-mode help.");
973 theory::quantifiers::QuantDSplitMode
OptionsHandler::stringToQuantDSplitMode(
974 std::string option
, std::string optarg
)
976 if(optarg
== "none" ) {
977 return theory::quantifiers::QUANT_DSPLIT_MODE_NONE
;
978 } else if(optarg
== "default") {
979 return theory::quantifiers::QUANT_DSPLIT_MODE_DEFAULT
;
980 } else if(optarg
== "agg") {
981 return theory::quantifiers::QUANT_DSPLIT_MODE_AGG
;
982 } else if(optarg
== "help") {
983 puts(s_quantDSplitHelp
.c_str());
986 throw OptionException(std::string("unknown option for --quant-dsplit-mode: `") +
987 optarg
+ "'. Try --quant-dsplit-mode help.");
991 theory::quantifiers::QuantRepMode
OptionsHandler::stringToQuantRepMode(
992 std::string option
, std::string optarg
)
994 if(optarg
== "none" ) {
995 return theory::quantifiers::QUANT_REP_MODE_EE
;
996 } else if(optarg
== "first" || optarg
== "default") {
997 return theory::quantifiers::QUANT_REP_MODE_FIRST
;
998 } else if(optarg
== "depth") {
999 return theory::quantifiers::QUANT_REP_MODE_DEPTH
;
1000 } else if(optarg
== "help") {
1001 puts(s_quantRepHelp
.c_str());
1004 throw OptionException(std::string("unknown option for --quant-rep-mode: `") +
1005 optarg
+ "'. Try --quant-rep-mode help.");
1009 // theory/bv/options_handlers.h
1010 void OptionsHandler::abcEnabledBuild(std::string option
, bool value
)
1012 #ifndef CVC4_USE_ABC
1014 std::stringstream ss
;
1015 ss
<< "option `" << option
<< "' requires an abc-enabled build of CVC4; this binary was not built with abc support";
1016 throw OptionException(ss
.str());
1018 #endif /* CVC4_USE_ABC */
1021 void OptionsHandler::abcEnabledBuild(std::string option
, std::string value
)
1023 #ifndef CVC4_USE_ABC
1024 if(!value
.empty()) {
1025 std::stringstream ss
;
1026 ss
<< "option `" << option
<< "' requires an abc-enabled build of CVC4; this binary was not built with abc support";
1027 throw OptionException(ss
.str());
1029 #endif /* CVC4_USE_ABC */
1032 void OptionsHandler::satSolverEnabledBuild(std::string option
, bool value
)
1034 #if !defined(CVC4_USE_CRYPTOMINISAT) && !defined(CVC4_USE_CADICAL)
1037 std::stringstream ss
;
1038 ss
<< "option `" << option
1039 << "' requires a CVC4 to be built with CryptoMiniSat or CaDiCaL";
1040 throw OptionException(ss
.str());
1045 void OptionsHandler::satSolverEnabledBuild(std::string option
,
1048 #if !defined(CVC4_USE_CRYPTOMINISAT) && !defined(CVC4_USE_CADICAL)
1051 std::stringstream ss
;
1052 ss
<< "option `" << option
1053 << "' requires a CVC4 to be built with CryptoMiniSat or CaDiCaL";
1054 throw OptionException(ss
.str());
1059 const std::string
OptionsHandler::s_bvSatSolverHelp
= "\
1060 Sat solvers currently supported by the --bv-sat-solver option:\n\
1062 minisat (default)\n\
1069 theory::bv::SatSolverMode
OptionsHandler::stringToSatSolver(std::string option
,
1072 if(optarg
== "minisat") {
1073 return theory::bv::SAT_SOLVER_MINISAT
;
1074 } else if(optarg
== "cryptominisat") {
1075 if (options::bitblastMode() == theory::bv::BITBLAST_MODE_LAZY
&&
1076 options::bitblastMode
.wasSetByUser()) {
1077 throwLazyBBUnsupported(theory::bv::SAT_SOLVER_CRYPTOMINISAT
);
1079 if (!options::bitvectorToBool
.wasSetByUser()) {
1080 options::bitvectorToBool
.set(true);
1082 return theory::bv::SAT_SOLVER_CRYPTOMINISAT
;
1084 else if (optarg
== "cadical")
1086 if (options::incrementalSolving()
1087 && options::incrementalSolving
.wasSetByUser())
1089 throw OptionException(
1090 std::string("CaDiCaL does not support incremental mode. \n\
1091 Try --bv-sat-solver=cryptominisat or "
1092 "--bv-sat-solver=minisat"));
1095 if (options::bitblastMode() == theory::bv::BITBLAST_MODE_LAZY
1096 && options::bitblastMode
.wasSetByUser())
1098 throwLazyBBUnsupported(theory::bv::SAT_SOLVER_CADICAL
);
1100 if (!options::bitvectorToBool
.wasSetByUser())
1102 options::bitvectorToBool
.set(true);
1104 return theory::bv::SAT_SOLVER_CADICAL
;
1105 } else if(optarg
== "help") {
1106 puts(s_bvSatSolverHelp
.c_str());
1109 throw OptionException(std::string("unknown option for --bv-sat-solver: `") +
1110 optarg
+ "'. Try --bv-sat-solver=help.");
1114 const std::string
OptionsHandler::s_bitblastingModeHelp
= "\
1115 Bit-blasting modes currently supported by the --bitblast option:\n\
1118 + Separate boolean structure and term reasoning between the core\n\
1119 SAT solver and the bv SAT solver\n\
1122 + Bitblast eagerly to bv SAT solver\n\
1125 theory::bv::BitblastMode
OptionsHandler::stringToBitblastMode(
1126 std::string option
, std::string optarg
)
1128 if(optarg
== "lazy") {
1129 if (!options::bitvectorPropagate
.wasSetByUser()) {
1130 options::bitvectorPropagate
.set(true);
1132 if (!options::bitvectorEqualitySolver
.wasSetByUser()) {
1133 options::bitvectorEqualitySolver
.set(true);
1135 if (!options::bitvectorEqualitySlicer
.wasSetByUser()) {
1136 if (options::incrementalSolving() ||
1137 options::produceModels()) {
1138 options::bitvectorEqualitySlicer
.set(theory::bv::BITVECTOR_SLICER_OFF
);
1140 options::bitvectorEqualitySlicer
.set(theory::bv::BITVECTOR_SLICER_AUTO
);
1144 if (!options::bitvectorInequalitySolver
.wasSetByUser()) {
1145 options::bitvectorInequalitySolver
.set(true);
1147 if (!options::bitvectorAlgebraicSolver
.wasSetByUser()) {
1148 options::bitvectorAlgebraicSolver
.set(true);
1150 if (options::bvSatSolver() != theory::bv::SAT_SOLVER_MINISAT
)
1152 throwLazyBBUnsupported(options::bvSatSolver());
1154 return theory::bv::BITBLAST_MODE_LAZY
;
1155 } else if(optarg
== "eager") {
1156 if (!options::bitvectorToBool
.wasSetByUser()) {
1157 options::bitvectorToBool
.set(true);
1160 if (!options::bvAbstraction
.wasSetByUser() &&
1161 !options::skolemizeArguments
.wasSetByUser()) {
1162 options::bvAbstraction
.set(true);
1163 options::skolemizeArguments
.set(true);
1165 return theory::bv::BITBLAST_MODE_EAGER
;
1166 } else if(optarg
== "help") {
1167 puts(s_bitblastingModeHelp
.c_str());
1170 throw OptionException(std::string("unknown option for --bitblast: `") +
1171 optarg
+ "'. Try --bitblast=help.");
1175 const std::string
OptionsHandler::s_bvSlicerModeHelp
= "\
1176 Bit-vector equality slicer modes supported by the --bv-eq-slicer option:\n\
1179 + Turn slicer on if input has only equalities over core symbols\n\
1185 + Turn slicer off\n\
1188 theory::bv::BvSlicerMode
OptionsHandler::stringToBvSlicerMode(
1189 std::string option
, std::string optarg
)
1191 if(optarg
== "auto") {
1192 return theory::bv::BITVECTOR_SLICER_AUTO
;
1193 } else if(optarg
== "on") {
1194 return theory::bv::BITVECTOR_SLICER_ON
;
1195 } else if(optarg
== "off") {
1196 return theory::bv::BITVECTOR_SLICER_OFF
;
1197 } else if(optarg
== "help") {
1198 puts(s_bvSlicerModeHelp
.c_str());
1201 throw OptionException(std::string("unknown option for --bv-eq-slicer: `") +
1202 optarg
+ "'. Try --bv-eq-slicer=help.");
1206 void OptionsHandler::setBitblastAig(std::string option
, bool arg
)
1209 if(options::bitblastMode
.wasSetByUser()) {
1210 if(options::bitblastMode() != theory::bv::BITBLAST_MODE_EAGER
) {
1211 throw OptionException("bitblast-aig must be used with eager bitblaster");
1214 theory::bv::BitblastMode mode
= stringToBitblastMode("", "eager");
1215 options::bitblastMode
.set(mode
);
1217 if(!options::bitvectorAigSimplifications
.wasSetByUser()) {
1218 options::bitvectorAigSimplifications
.set("balance;drw");
1223 // theory/uf/options_handlers.h
1224 const std::string
OptionsHandler::s_ufssModeHelp
= "\
1225 UF strong solver options currently supported by the --uf-ss option:\n\
1228 + Default, use uf strong solver to find minimal models for uninterpreted sorts.\n\
1231 + Use uf strong solver to shrink model sizes, but do no enforce minimality.\n\
1234 + Do not use uf strong solver to shrink model sizes. \n\
1238 theory::uf::UfssMode
OptionsHandler::stringToUfssMode(std::string option
,
1241 if(optarg
== "default" || optarg
== "full" ) {
1242 return theory::uf::UF_SS_FULL
;
1243 } else if(optarg
== "no-minimal") {
1244 return theory::uf::UF_SS_NO_MINIMAL
;
1245 } else if(optarg
== "none") {
1246 return theory::uf::UF_SS_NONE
;
1247 } else if(optarg
== "help") {
1248 puts(s_ufssModeHelp
.c_str());
1251 throw OptionException(std::string("unknown option for --uf-ss: `") +
1252 optarg
+ "'. Try --uf-ss help.");
1258 // theory/options_handlers.h
1259 const std::string
OptionsHandler::s_theoryOfModeHelp
= "\
1260 TheoryOf modes currently supported by the --theoryof-mode option:\n\
1263 + type variables, constants and equalities by type\n\
1266 + type variables as uninterpreted, equalities by the parametric theory\n\
1269 theory::TheoryOfMode
OptionsHandler::stringToTheoryOfMode(std::string option
, std::string optarg
) {
1270 if(optarg
== "type") {
1271 return theory::THEORY_OF_TYPE_BASED
;
1272 } else if(optarg
== "term") {
1273 return theory::THEORY_OF_TERM_BASED
;
1274 } else if(optarg
== "help") {
1275 puts(s_theoryOfModeHelp
.c_str());
1278 throw OptionException(std::string("unknown option for --theoryof-mode: `") +
1279 optarg
+ "'. Try --theoryof-mode help.");
1283 // theory/options_handlers.h
1284 std::string
OptionsHandler::handleUseTheoryList(std::string option
, std::string optarg
) {
1285 std::string currentList
= options::useTheoryList();
1286 if(currentList
.empty()){
1289 return currentList
+','+ optarg
;
1293 void OptionsHandler::notifyUseTheoryList(std::string option
) {
1294 d_options
->d_useTheoryListListeners
.notify();
1299 // printer/options_handlers.h
1300 const std::string
OptionsHandler::s_modelFormatHelp
= "\
1301 Model format modes currently supported by the --model-format option:\n\
1304 + Print model as expressions in the output language format.\n\
1307 + Print functional expressions over finite domains in a table format.\n\
1310 const std::string
OptionsHandler::s_instFormatHelp
= "\
1311 Inst format modes currently supported by the --model-format option:\n\
1314 + Print instantiations as a list in the output language format.\n\
1317 + Print instantiations as SZS compliant proof.\n\
1320 ModelFormatMode
OptionsHandler::stringToModelFormatMode(std::string option
,
1323 if(optarg
== "default") {
1324 return MODEL_FORMAT_MODE_DEFAULT
;
1325 } else if(optarg
== "table") {
1326 return MODEL_FORMAT_MODE_TABLE
;
1327 } else if(optarg
== "help") {
1328 puts(s_modelFormatHelp
.c_str());
1331 throw OptionException(std::string("unknown option for --model-format: `") +
1332 optarg
+ "'. Try --model-format help.");
1336 InstFormatMode
OptionsHandler::stringToInstFormatMode(std::string option
,
1339 if(optarg
== "default") {
1340 return INST_FORMAT_MODE_DEFAULT
;
1341 } else if(optarg
== "szs") {
1342 return INST_FORMAT_MODE_SZS
;
1343 } else if(optarg
== "help") {
1344 puts(s_instFormatHelp
.c_str());
1347 throw OptionException(std::string("unknown option for --inst-format: `") +
1348 optarg
+ "'. Try --inst-format help.");
1353 // decision/options_handlers.h
1354 const std::string
OptionsHandler::s_decisionModeHelp
= "\
1355 Decision modes currently supported by the --decision option:\n\
1357 internal (default)\n\
1358 + Use the internal decision heuristics of the SAT solver\n\
1361 + An ATGP-inspired justification heuristic\n\
1363 justification-stoponly\n\
1364 + Use the justification heuristic only to stop early, not for decisions\n\
1367 decision::DecisionMode
OptionsHandler::stringToDecisionMode(std::string option
,
1370 options::decisionStopOnly
.set(false);
1372 if(optarg
== "internal") {
1373 return decision::DECISION_STRATEGY_INTERNAL
;
1374 } else if(optarg
== "justification") {
1375 return decision::DECISION_STRATEGY_JUSTIFICATION
;
1376 } else if(optarg
== "justification-stoponly") {
1377 options::decisionStopOnly
.set(true);
1378 return decision::DECISION_STRATEGY_JUSTIFICATION
;
1379 } else if(optarg
== "help") {
1380 puts(s_decisionModeHelp
.c_str());
1383 throw OptionException(std::string("unknown option for --decision: `") +
1384 optarg
+ "'. Try --decision help.");
1388 decision::DecisionWeightInternal
OptionsHandler::stringToDecisionWeightInternal(
1389 std::string option
, std::string optarg
)
1392 return decision::DECISION_WEIGHT_INTERNAL_OFF
;
1393 else if(optarg
== "max")
1394 return decision::DECISION_WEIGHT_INTERNAL_MAX
;
1395 else if(optarg
== "sum")
1396 return decision::DECISION_WEIGHT_INTERNAL_SUM
;
1397 else if(optarg
== "usr1")
1398 return decision::DECISION_WEIGHT_INTERNAL_USR1
;
1400 throw OptionException(std::string("--decision-weight-internal must be off, max or sum."));
1404 // smt/options_handlers.h
1405 const std::string
OptionsHandler::s_simplificationHelp
= "\
1406 Simplification modes currently supported by the --simplification option:\n\
1409 + save up all ASSERTions; run nonclausal simplification and clausal\n\
1410 (MiniSat) propagation for all of them only after reaching a querying command\n\
1411 (CHECKSAT or QUERY or predicate SUBTYPE declaration)\n\
1414 + do not perform nonclausal simplification\n\
1417 SimplificationMode
OptionsHandler::stringToSimplificationMode(
1418 std::string option
, std::string optarg
)
1420 if(optarg
== "batch") {
1421 return SIMPLIFICATION_MODE_BATCH
;
1422 } else if(optarg
== "none") {
1423 return SIMPLIFICATION_MODE_NONE
;
1424 } else if(optarg
== "help") {
1425 puts(s_simplificationHelp
.c_str());
1428 throw OptionException(std::string("unknown option for --simplification: `") +
1429 optarg
+ "'. Try --simplification help.");
1433 const std::string
OptionsHandler::s_sygusSolutionOutModeHelp
=
1435 Modes for finite model finding bound minimization, supported by --sygus-out:\n\
1438 + Print only status for check-synth calls.\n\
1440 status-and-def (default) \n\
1441 + Print status followed by definition corresponding to solution.\n\
1444 + Print status if infeasible, or definition corresponding to\n\
1445 solution if feasible.\n\
1448 + Print based on SyGuS standard.\n\
1452 SygusSolutionOutMode
OptionsHandler::stringToSygusSolutionOutMode(
1453 std::string option
, std::string optarg
)
1455 if (optarg
== "status")
1457 return SYGUS_SOL_OUT_STATUS
;
1459 else if (optarg
== "status-and-def")
1461 return SYGUS_SOL_OUT_STATUS_AND_DEF
;
1463 else if (optarg
== "status-or-def")
1465 return SYGUS_SOL_OUT_STATUS_OR_DEF
;
1467 else if (optarg
== "sygus-standard")
1469 return SYGUS_SOL_OUT_STANDARD
;
1471 else if (optarg
== "help")
1473 puts(s_sygusSolutionOutModeHelp
.c_str());
1478 throw OptionException(std::string("unknown option for --sygus-out: `")
1480 + "'. Try --sygus-out help.");
1484 void OptionsHandler::setProduceAssertions(std::string option
, bool value
)
1486 options::produceAssertions
.set(value
);
1487 options::interactiveMode
.set(value
);
1490 void OptionsHandler::proofEnabledBuild(std::string option
, bool value
)
1494 std::stringstream ss
;
1495 ss
<< "option `" << option
<< "' requires a proofs-enabled build of CVC4; this binary was not built with proof support";
1496 throw OptionException(ss
.str());
1498 #endif /* CVC4_PROOF */
1501 void OptionsHandler::LFSCEnabledBuild(std::string option
, bool value
) {
1502 #ifndef CVC4_USE_LFSC
1504 std::stringstream ss
;
1505 ss
<< "option `" << option
<< "' requires a build of CVC4 with integrated "
1506 "LFSC; this binary was not built with LFSC";
1507 throw OptionException(ss
.str());
1509 #endif /* CVC4_USE_LFSC */
1512 void OptionsHandler::notifyDumpToFile(std::string option
) {
1513 d_options
->d_dumpToFileListeners
.notify();
1517 void OptionsHandler::notifySetRegularOutputChannel(std::string option
) {
1518 d_options
->d_setRegularChannelListeners
.notify();
1521 void OptionsHandler::notifySetDiagnosticOutputChannel(std::string option
) {
1522 d_options
->d_setDiagnosticChannelListeners
.notify();
1526 std::string
OptionsHandler::checkReplayFilename(std::string option
, std::string optarg
) {
1529 throw OptionException (std::string("Bad file name for --replay"));
1533 #else /* CVC4_REPLAY */
1534 throw OptionException("The replay feature was disabled in this build of CVC4.");
1535 #endif /* CVC4_REPLAY */
1538 void OptionsHandler::notifySetReplayLogFilename(std::string option
) {
1539 d_options
->d_setReplayFilenameListeners
.notify();
1542 void OptionsHandler::statsEnabledBuild(std::string option
, bool value
)
1544 #ifndef CVC4_STATISTICS_ON
1546 std::stringstream ss
;
1547 ss
<< "option `" << option
<< "' requires a statistics-enabled build of CVC4; this binary was not built with statistics support";
1548 throw OptionException(ss
.str());
1550 #endif /* CVC4_STATISTICS_ON */
1553 void OptionsHandler::threadN(std::string option
) {
1554 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\"");
1557 void OptionsHandler::notifyDumpMode(std::string option
)
1559 d_options
->d_setDumpModeListeners
.notify();
1563 // expr/options_handlers.h
1564 void OptionsHandler::setDefaultExprDepthPredicate(std::string option
, int depth
) {
1566 throw OptionException("--default-expr-depth requires a positive argument, or -1.");
1570 void OptionsHandler::setDefaultDagThreshPredicate(std::string option
, int dag
) {
1572 throw OptionException("--default-dag-thresh requires a nonnegative argument.");
1576 void OptionsHandler::notifySetDefaultExprDepth(std::string option
) {
1577 d_options
->d_setDefaultExprDepthListeners
.notify();
1580 void OptionsHandler::notifySetDefaultDagThresh(std::string option
) {
1581 d_options
->d_setDefaultDagThreshListeners
.notify();
1584 void OptionsHandler::notifySetPrintExprTypes(std::string option
) {
1585 d_options
->d_setPrintExprTypesListeners
.notify();
1589 // main/options_handlers.h
1591 static void print_config (const char * str
, std::string config
) {
1594 if (s
.size() < sz
) s
.resize(sz
, ' ');
1595 std::cout
<< s
<< ": " << config
<< std::endl
;
1598 static void print_config_cond (const char * str
, bool cond
= false) {
1599 print_config(str
, cond
? "yes" : "no");
1602 void OptionsHandler::copyright(std::string option
) {
1603 std::cout
<< Configuration::copyright() << std::endl
;
1607 void OptionsHandler::showConfiguration(std::string option
) {
1608 std::cout
<< Configuration::about() << std::endl
;
1610 print_config ("version", Configuration::getVersionString());
1612 if(Configuration::isGitBuild()) {
1613 const char* branchName
= Configuration::getGitBranchName();
1614 if(*branchName
== '\0') { branchName
= "-"; }
1615 std::stringstream ss
;
1617 << branchName
<< " "
1618 << std::string(Configuration::getGitCommit()).substr(0, 8)
1619 << (Configuration::hasGitModifications() ? " (with modifications)" : "")
1621 print_config("scm", ss
.str());
1623 print_config_cond("scm", false);
1626 std::cout
<< std::endl
;
1628 std::stringstream ss
;
1629 ss
<< Configuration::getVersionMajor() << "."
1630 << Configuration::getVersionMinor() << "."
1631 << Configuration::getVersionRelease();
1632 print_config("library", ss
.str());
1634 std::cout
<< std::endl
;
1636 print_config_cond("debug code", Configuration::isDebugBuild());
1637 print_config_cond("statistics", Configuration::isStatisticsBuild());
1638 print_config_cond("replay", Configuration::isReplayBuild());
1639 print_config_cond("tracing", Configuration::isTracingBuild());
1640 print_config_cond("dumping", Configuration::isDumpingBuild());
1641 print_config_cond("muzzled", Configuration::isMuzzledBuild());
1642 print_config_cond("assertions", Configuration::isAssertionBuild());
1643 print_config_cond("proof", Configuration::isProofBuild());
1644 print_config_cond("coverage", Configuration::isCoverageBuild());
1645 print_config_cond("profiling", Configuration::isProfilingBuild());
1646 print_config_cond("competition", Configuration::isCompetitionBuild());
1648 std::cout
<< std::endl
;
1650 print_config_cond("abc", Configuration::isBuiltWithAbc());
1651 print_config_cond("cln", Configuration::isBuiltWithCln());
1652 print_config_cond("glpk", Configuration::isBuiltWithGlpk());
1653 print_config_cond("cadical", Configuration::isBuiltWithCadical());
1654 print_config_cond("cryptominisat", Configuration::isBuiltWithCryptominisat());
1655 print_config_cond("gmp", Configuration::isBuiltWithGmp());
1656 print_config_cond("lfsc", Configuration::isBuiltWithLfsc());
1657 print_config_cond("readline", Configuration::isBuiltWithReadline());
1658 print_config_cond("symfpu", Configuration::isBuiltWithSymFPU());
1663 static void printTags(unsigned ntags
, char const* const* tags
)
1665 std::cout
<< "available tags:";
1666 for (unsigned i
= 0; i
< ntags
; ++ i
)
1668 std::cout
<< " " << tags
[i
] << std::endl
;
1670 std::cout
<< std::endl
;
1673 void OptionsHandler::showDebugTags(std::string option
)
1675 if (!Configuration::isDebugBuild())
1677 throw OptionException("debug tags not available in non-debug builds");
1679 else if (!Configuration::isTracingBuild())
1681 throw OptionException("debug tags not available in non-tracing builds");
1683 printTags(Configuration::getNumDebugTags(),Configuration::getDebugTags());
1687 void OptionsHandler::showTraceTags(std::string option
)
1689 if (!Configuration::isTracingBuild())
1691 throw OptionException("trace tags not available in non-tracing build");
1693 printTags(Configuration::getNumTraceTags(), Configuration::getTraceTags());
1697 static std::string
suggestTags(char const* const* validTags
,
1698 std::string inputTag
,
1699 char const* const* additionalTags
)
1701 DidYouMean didYouMean
;
1704 for (size_t i
= 0; (opt
= validTags
[i
]) != nullptr; ++i
)
1706 didYouMean
.addWord(validTags
[i
]);
1708 if (additionalTags
!= nullptr)
1710 for (size_t i
= 0; (opt
= additionalTags
[i
]) != nullptr; ++i
)
1712 didYouMean
.addWord(additionalTags
[i
]);
1716 return didYouMean
.getMatchAsString(inputTag
);
1719 void OptionsHandler::enableTraceTag(std::string option
, std::string optarg
)
1721 if(!Configuration::isTracingBuild())
1723 throw OptionException("trace tags not available in non-tracing builds");
1725 else if(!Configuration::isTraceTag(optarg
.c_str()))
1727 if (optarg
== "help")
1730 Configuration::getNumTraceTags(), Configuration::getTraceTags());
1734 throw OptionException(
1735 std::string("trace tag ") + optarg
+ std::string(" not available.")
1736 + suggestTags(Configuration::getTraceTags(), optarg
, nullptr));
1741 void OptionsHandler::enableDebugTag(std::string option
, std::string optarg
)
1743 if (!Configuration::isDebugBuild())
1745 throw OptionException("debug tags not available in non-debug builds");
1747 else if (!Configuration::isTracingBuild())
1749 throw OptionException("debug tags not available in non-tracing builds");
1752 if (!Configuration::isDebugTag(optarg
.c_str())
1753 && !Configuration::isTraceTag(optarg
.c_str()))
1755 if (optarg
== "help")
1758 Configuration::getNumDebugTags(), Configuration::getDebugTags());
1762 throw OptionException(std::string("debug tag ") + optarg
1763 + std::string(" not available.")
1764 + suggestTags(Configuration::getDebugTags(),
1766 Configuration::getTraceTags()));
1772 OutputLanguage
OptionsHandler::stringToOutputLanguage(std::string option
,
1775 if(optarg
== "help") {
1776 options::languageHelp
.set(true);
1777 return language::output::LANG_AUTO
;
1781 return language::toOutputLanguage(optarg
);
1782 } catch(OptionException
& oe
) {
1783 throw OptionException("Error in " + option
+ ": " + oe
.getMessage() +
1784 "\nTry --output-language help");
1790 InputLanguage
OptionsHandler::stringToInputLanguage(std::string option
,
1793 if(optarg
== "help") {
1794 options::languageHelp
.set(true);
1795 return language::input::LANG_AUTO
;
1799 return language::toInputLanguage(optarg
);
1800 } catch(OptionException
& oe
) {
1801 throw OptionException("Error in " + option
+ ": " + oe
.getMessage() + "\nTry --language help");
1807 /* options/base_options_handlers.h */
1808 void OptionsHandler::setVerbosity(std::string option
, int value
)
1810 if(Configuration::isMuzzledBuild()) {
1811 DebugChannel
.setStream(&CVC4::null_os
);
1812 TraceChannel
.setStream(&CVC4::null_os
);
1813 NoticeChannel
.setStream(&CVC4::null_os
);
1814 ChatChannel
.setStream(&CVC4::null_os
);
1815 MessageChannel
.setStream(&CVC4::null_os
);
1816 WarningChannel
.setStream(&CVC4::null_os
);
1819 ChatChannel
.setStream(&CVC4::null_os
);
1821 ChatChannel
.setStream(&std::cout
);
1824 NoticeChannel
.setStream(&CVC4::null_os
);
1826 NoticeChannel
.setStream(&std::cout
);
1829 MessageChannel
.setStream(&CVC4::null_os
);
1830 WarningChannel
.setStream(&CVC4::null_os
);
1832 MessageChannel
.setStream(&std::cout
);
1833 WarningChannel
.setStream(&std::cerr
);
1838 void OptionsHandler::increaseVerbosity(std::string option
) {
1839 options::verbosity
.set(options::verbosity() + 1);
1840 setVerbosity(option
, options::verbosity());
1843 void OptionsHandler::decreaseVerbosity(std::string option
) {
1844 options::verbosity
.set(options::verbosity() - 1);
1845 setVerbosity(option
, options::verbosity());
1849 }/* CVC4::options namespace */
1850 }/* CVC4 namespace */