1 /********************* */
4 ** Original author: mdeters
5 ** Major contributors: cconway, taking
6 ** Minor contributors (to current version): barrett, dejan
7 ** This file is part of the CVC4 prototype.
8 ** Copyright (c) 2009, 2010, 2011 The Analysis of Computer Systems Group (ACSys)
9 ** Courant Institute of Mathematical Sciences
10 ** New York University
11 ** See the file COPYING in the top-level source directory for licensing
12 ** information.\endverbatim
14 ** \brief Contains code for handling command-line options.
16 ** Contains code for handling command-line options
30 #include "expr/expr.h"
31 #include "expr/command.h"
32 #include "util/configuration.h"
33 #include "util/exception.h"
34 #include "util/language.h"
35 #include "util/options.h"
36 #include "util/output.h"
37 #include "util/dump.h"
38 #include "prop/sat_solver_factory.h"
40 #include "cvc4autoconfig.h"
47 CVC4_THREADLOCAL(const Options
*) Options::s_current
= NULL
;
50 # define USE_EARLY_TYPE_CHECKING_BY_DEFAULT true
51 #else /* CVC4_DEBUG */
52 # define USE_EARLY_TYPE_CHECKING_BY_DEFAULT false
53 #endif /* CVC4_DEBUG */
55 #if defined(CVC4_MUZZLED) || defined(CVC4_COMPETITION_MODE)
56 # define DO_SEMANTIC_CHECKS_BY_DEFAULT false
57 #else /* CVC4_MUZZLED || CVC4_COMPETITION_MODE */
58 # define DO_SEMANTIC_CHECKS_BY_DEFAULT true
59 #endif /* CVC4_MUZZLED || CVC4_COMPETITION_MODE */
61 /** default decision options */
62 const Options::DecisionOptions defaultDecOpt
= {
63 false, // relevancyLeaves
64 1000, // maxRelTimeAsPermille
65 true, // computeRelevancy
66 false, // mustRelevancy
76 inputLanguage(language::input::LANG_AUTO
),
77 outputLanguage(language::output::LANG_AUTO
),
82 preprocessOnly(false),
83 semanticChecks(DO_SEMANTIC_CHECKS_BY_DEFAULT
),
84 theoryRegistration(true),
87 lazyDefinitionExpansion(false),
89 simplificationMode(SIMPLIFICATION_MODE_BATCH
),
90 simplificationModeSetByUser(false),
91 decisionMode(DECISION_STRATEGY_INTERNAL
),
92 decisionModeSetByUser(false),
93 decisionOptions(DecisionOptions(defaultDecOpt
)),
94 doStaticLearning(true),
96 doITESimpSetByUser(false),
97 unconstrainedSimp(false),
98 unconstrainedSimpSetByUser(false),
100 repeatSimpSetByUser(false),
102 interactiveSetByUser(false),
103 perCallResourceLimit(0),
104 cumulativeResourceLimit(0),
105 perCallMillisecondLimit(0),
106 cumulativeMillisecondLimit(0),
108 produceModels(false),
110 produceAssignments(false),
111 typeChecking(DO_SEMANTIC_CHECKS_BY_DEFAULT
),
112 earlyTypeChecking(USE_EARLY_TYPE_CHECKING_BY_DEFAULT
),
113 incrementalSolving(false),
118 satRandomSeed(91648253),// Minisat's default value
120 satClauseDecay(0.999),
123 arithUnateLemmaMode(ALL_PRESOLVE_LEMMAS
),
124 arithPropagationMode(BOTH_PROP
),
125 arithHeuristicPivots(0),
126 arithHeuristicPivotsSetByUser(false),
127 arithStandardCheckVarOrderPivots(-1),
128 arithStandardCheckVarOrderPivotsSetByUser(false),
129 arithHeuristicPivotRule(MINIMUM
),
130 arithSimplexCheckPeriod(200),
131 arithPivotThreshold(2),
132 arithPivotThresholdSetByUser(false),
133 arithPropagateMaxLength(16),
134 arithDioSolver(true),
135 arithRewriteEq(false),
136 arithRewriteEqSetByUser(false),
137 ufSymmetryBreaker(false),
138 ufSymmetryBreakerSetByUser(false),
139 miniscopeQuant(true),
140 miniscopeQuantFreeVar(true),
144 preSkolemQuant(false),
146 registerQuantBodyTerms(false),
147 instWhenMode(INST_WHEN_FULL_LAST_CALL
),
148 eagerInstQuant(false),
149 finiteModelFind(false),
151 fmfModelBasedInst(true),
152 efficientEMatching(false),
153 literalMatchMode(LITERAL_MATCH_NONE
),
155 cbqiSetByUser(false),
156 userPatternsQuant(true),
158 lemmaOutputChannel(NULL
),
159 lemmaInputChannel(NULL
),
160 threads(2),// default should be 1 probably, but say 2 for now
163 separateOutput(false),
164 sharingFilterByLength(-1),
165 bitvectorEagerBitblast(false),
166 bitvectorEagerFullcheck(false),
167 bitvectorShareLemmas(false),
168 sat_refine_conflicts(false),
169 theoryOfModeSetByUser(false),
170 theoryOfMode(theory::THEORY_OF_TYPE_BASED
)
175 static const string mostCommonOptionsDescription
= "\
176 Most commonly-used CVC4 options:\n\
177 --version | -V identify this CVC4 binary\n\
178 --help | -h full command line reference\n\
179 --lang | -L force input language\n\
180 (default is `auto'; see --lang help)\n\
181 --output-lang force output language\n\
182 (default is `auto'; see --lang help)\n\
183 --verbose | -v increase verbosity (may be repeated)\n\
184 --quiet | -q decrease verbosity (may be repeated)\n\
185 --stats give statistics on exit\n\
186 --parse-only exit after parsing input\n\
187 --preprocess-only exit after preproc (useful with --stats or --dump)\n\
188 --dump=MODE dump preprocessed assertions, etc., see --dump=help\n\
189 --dump-to=FILE all dumping goes to FILE (instead of stdout)\n\
190 --show-config show CVC4 static configuration\n\
191 --strict-parsing be less tolerant of non-conforming inputs\n\
192 --interactive force interactive mode\n\
193 --no-interactive force non-interactive mode\n\
194 --produce-models | -m support the get-value command\n\
195 --produce-assignments support the get-assignment command\n\
196 --print-success print the \"success\" output required of SMT-LIBv2\n\
197 --smtlib2 SMT-LIBv2 conformance mode (implies other options)\n\
198 --proof turn on proof generation\n\
199 --incremental | -i enable incremental solving\n\
200 --tlimit=MS enable time limiting (give milliseconds)\n\
201 --tlimit-per=MS enable time limiting per query (give milliseconds)\n\
202 --rlimit=N enable resource limiting\n\
203 --rlimit-per=N enable resource limiting per query\n\
206 static const string optionsDescription
= mostCommonOptionsDescription
+ "\
208 Additional CVC4 options:\n\
209 --mmap memory map file input\n\
210 --segv-nospin don't spin on segfault waiting for gdb\n\
211 --lazy-type-checking type check expressions only when necessary (default)\n\
212 --eager-type-checking type check expressions immediately on creation\n\
213 (debug builds only)\n\
214 --no-type-checking never type check expressions\n\
215 --no-checking disable ALL semantic checks, including type checks\n\
216 --no-theory-registration disable theory reg (not safe for some theories)\n\
217 --print-winner enable printing the winning thread (pcvc4 only)\n\
218 --trace | -t trace something (e.g. -t pushpop), can repeat\n\
219 --debug | -d debug something (e.g. -d arith), can repeat\n\
220 --show-debug-tags show all avalable tags for debugging\n\
221 --show-trace-tags show all avalable tags for tracing\n\
222 --show-sat-solvers show all available SAT solvers\n\
223 --default-expr-depth=N print exprs to depth N (0 == default, -1 == no limit)\n\
224 --default-dag-thresh=N dagify common subexprs appearing > N times\n\
225 (1 == default, 0 == don't dagify)\n\
226 --print-expr-types print types with variables when printing exprs\n\
227 --lazy-definition-expansion expand define-funs/LAMBDAs lazily\n\
228 --simplification=MODE choose simplification mode, see --simplification=help\n\
229 --decision=MODE choose decision mode, see --decision=help\n\
230 --decision-budget=N impose a budget for relevancy hueristic which increases linearly with\n\
231 each decision. N between 0 and 1000. (default: 1000, no budget)\n\
232 --no-static-learning turn off static learning (e.g. diamond-breaking)\n\
233 --ite-simp turn on ite simplification (Kim (and Somenzi) et al., SAT 2009)\n\
234 --no-ite-simp turn off ite simplification (Kim (and Somenzi) et al., SAT 2009)\n\
235 --unconstrained-simp turn on unconstrained simplification (see Bruttomesso/Brummayer PhD thesis)\n\
236 --no-unconstrained-simp turn off unconstrained simplification (see Bruttomesso/Brummayer PhD thesis)\n\
237 --repeat-simp make multiple passes with nonclausal simplifier\n\
238 --no-repeat-simp do not make multiple passes with nonclausal simplifier\n\
239 --replay=file replay decisions from file\n\
240 --replay-log=file log decisions and propagations to file\n\
241 --theoryof-mode=mode mode for theoryof\n\
243 --random-freq=P frequency of random decisions in the sat solver\n\
244 (P=0.0 by default)\n\
245 --random-seed=S sets the random seed for the sat solver\n\
246 --restart-int-base=I sets the base restart interval for the sat solver\n\
248 --restart-int-inc=F restart interval increase factor for the sat solver\n\
249 (F=3.0 by default)\n\
251 --unate-lemmas=MODE determines which lemmas to add before solving\n\
252 (default is 'all', see --unate-lemmas=help)\n\
253 --arith-prop=MODE turns on arithmetic propagation\n\
254 (default is 'old', see --arith-prop=help)\n\
255 --heuristic-pivot-rule=RULE change the pivot rule for the basic variable\n\
256 (default is 'min', see --heuristic-pivot-rule help)\n\
257 --heuristic-pivots=N the number of times to apply the heuristic pivot rule.\n\
258 If N < 0, this defaults to the number of variables\n\
259 If this is unset, this is tuned by the logic selection.\n\
260 --simplex-check-period=N The number of pivots to do in simplex before rechecking for\n\
261 a conflict on all variables.\n\
262 --pivot-threshold=N sets the number of pivots using --pivot-rule\n\
263 per basic variable per simplex instance before\n\
264 using variable order\n\
265 --prop-row-length=N sets the maximum row length to be used in propagation\n\
266 --disable-dio-solver turns off Linear Diophantine Equation solver \n\
267 (Griggio, JSAT 2012)\n\
268 --enable-arith-rewrite-equalities turns on the preprocessing rewrite\n\
269 turning equalities into a conjunction of inequalities.\n \
270 --disable-arith-rewrite-equalities turns off the preprocessing rewrite\n\
271 turning equalities into a conjunction of inequalities.\n \
273 --enable-symmetry-breaker turns on UF symmetry breaker (Deharbe et al.,\n\
274 CADE 2011) [on by default only for QF_UF]\n\
275 --disable-symmetry-breaker turns off UF symmetry breaker\n\
276 --disable-miniscope-quant disable miniscope quantifiers\n\
277 --disable-miniscope-quant-fv disable miniscope quantifiers for ground subformulas\n\
278 --disable-prenex-quant disable prenexing of quantified formulas\n\
279 --var-elim-quant enable variable elimination of quantified formulas\n\
280 --cnf-quant apply CNF conversion to quantified formulas\n\
281 --pre-skolem-quant apply skolemization eagerly to bodies of quantified formulas\n\
282 --disable-smart-triggers disable smart triggers\n\
283 --register-quant-body-terms consider terms within bodies of quantified formulas for matching\n\
284 --inst-when=MODE when to apply instantiation\n\
285 --eager-inst-quant apply quantifier instantiation eagerly\n\
286 --finite-model-find use finite model finding heuristic for quantifier instantiation\n\
287 --use-fmf-region-sat use region-based SAT heuristic for finite model finding\n\
288 --disable-fmf-model-inst disable model-based instantiation for finite model finding\n\
289 --efficient-e-matching use efficient E-matching\n\
290 --literal-matching=MODE choose literal matching mode\n\
291 --enable-cbqi turns on counterexample-based quantifier instantiation [off by default]\n\
292 --disable-cbqi turns off counterexample-based quantifier instantiation\n\
293 --ignore-user-patterns ignore user-provided patterns for quantifier instantiation\n\
294 --enable-flip-decision turns on flip decision heuristic\n\
295 --disable-dio-solver turns off Linear Diophantine Equation solver (Griggio, JSAT 2012)\n\
296 --disable-arith-rewrite-equalities turns off the preprocessing rewrite turning equalities into a conjunction of inequalities.\n\
297 --threads=N sets the number of solver threads\n\
298 --threadN=string configures thread N (0..#threads-1)\n\
299 --filter-lemma-length=N don't share lemmas strictly longer than N\n\
300 --bitblast-eager eagerly bitblast the bitvectors to the main SAT solver\n\
301 --bitblast-share-lemmas share lemmas from the bitblsting solver with the main solver\n\
302 --bitblast-eager-fullcheck check the bitblasting eagerly\n\
303 --refine-conflicts refine theory conflict clauses\n\
308 static const string languageDescription
= "\
309 Languages currently supported as arguments to the -L / --lang option:\n\
310 auto attempt to automatically determine the input language\n\
311 pl | cvc4 CVC4 presentation language\n\
312 smt | smtlib SMT-LIB format 1.2\n\
313 smt2 | smtlib2 SMT-LIB format 2.0\n\
315 Languages currently supported as arguments to the --output-lang option:\n\
316 auto match the output language to the input language\n\
317 pl | cvc4 CVC4 presentation language\n\
318 smt | smtlib SMT-LIB format 1.2\n\
319 smt2 | smtlib2 SMT-LIB format 2.0\n\
320 ast internal format (simple syntax-tree language)\n\
323 static const string simplificationHelp
= "\
324 Simplification modes currently supported by the --simplification option:\n\
327 + save up all ASSERTions; run nonclausal simplification and clausal\n\
328 (MiniSat) propagation for all of them only after reaching a querying command\n\
329 (CHECKSAT or QUERY or predicate SUBTYPE declaration)\n\
332 + run nonclausal simplification and clausal propagation at each ASSERT\n\
333 (and at CHECKSAT/QUERY/SUBTYPE)\n\
336 + do not perform nonclausal simplification\n\
339 static const string theoryofHelp
= "\
340 TheoryOf modes currently supported by the --theoryof-mode option:\n\
343 + type variables, constants and equalities by type\n\
346 + type variables as uninterpreted, equalities by the parametric theory\n\
349 static const string decisionHelp
= "\
350 Decision modes currently supported by the --decision option:\n\
352 internal (default)\n\
353 + Use the internal decision hueristics of the SAT solver\n\
356 + An ATGP-inspired justification heuristic\n\
359 + Under development may-relevancy\n\
362 + May-relevancy, but decide only on leaves\n\
367 + Use the relevancy code to do the justification stuff\n\
368 + (This should do exact same thing as justification)\n\
370 justification-must\n\
371 + Start deciding on literals close to root instead of those\n\
372 + near leaves (don't expect it to work well) [Unimplemented]\n\
375 static const string dumpHelp
= "\
376 Dump modes currently supported by the --dump option:\n\
379 + Dump the benchmark structure (set-logic, push/pop, queries, etc.), but\n\
380 does not include any declarations or assertions. Implied by all following\n\
384 + Dump declarations. Implied by all following modes.\n\
387 + Output the assertions after non-clausal simplification and static\n\
388 learning phases, but before presolve-time T-lemmas arrive. If\n\
389 non-clausal simplification and static learning are off\n\
390 (--simplification=none --no-static-learning), the output\n\
391 will closely resemble the input (with term-level ITEs removed).\n\
394 + Output the assertions after non-clausal simplification, static\n\
395 learning, and presolve-time T-lemmas. This should include all eager\n\
396 T-lemmas (in the form provided by the theory, which my or may not be\n\
397 clausal). Also includes level-0 BCP done by Minisat.\n\
400 + Do all the preprocessing outlined above, and dump the CNF-converted\n\
404 + Dump all contextual assertions (e.g., SAT decisions, propagations..).\n\
405 Implied by all \"stateful\" modes below and conflicts with all\n\
406 non-stateful modes below.\n\
408 t-conflicts [non-stateful]\n\
409 + Output correctness queries for all theory conflicts\n\
411 missed-t-conflicts [stateful]\n\
412 + Output completeness queries for theory conflicts\n\
414 t-propagations [stateful]\n\
415 + Output correctness queries for all theory propagations\n\
417 missed-t-propagations [stateful]\n\
418 + Output completeness queries for theory propagations (LARGE and EXPENSIVE)\n\
420 t-lemmas [non-stateful]\n\
421 + Output correctness queries for all theory lemmas\n\
423 t-explanations [non-stateful]\n\
424 + Output correctness queries for all theory explanations\n\
426 Dump modes can be combined with multiple uses of --dump. Generally you want\n\
427 one from the assertions category (either asertions, learned, or clauses), and\n\
428 perhaps one or more stateful or non-stateful modes for checking correctness\n\
429 and completeness of decision procedure implementations. Stateful modes dump\n\
430 the contextual assertions made by the core solver (all decisions and\n\
431 propagations as assertions; that affects the validity of the resulting\n\
432 correctness and completeness queries, so of course stateful and non-stateful\n\
433 modes cannot be mixed in the same run.\n\
435 The --output-language option controls the language used for dumping, and\n\
436 this allows you to connect CVC4 to another solver implementation via a UNIX\n\
437 pipe to perform on-line checking. The --dump-to option can be used to dump\n\
441 static const string arithUnateLemmasHelp
= "\
442 Presolve lemmas are generated before SAT search begins using the relationship\n\
443 of constant terms and polynomials.\n\
444 Modes currently supported by the --unate-lemmas option:\n\
447 Outputs lemmas of the general form (<= p c) implies (<= p d) for c < d.\n\
449 Outputs lemmas of the general forms\n\
450 (= p c) implies (<= p d) for c < d, or\n\
451 (= p c) implies (not (= p d)) for c != d.\n\
453 A combination of inequalities and equalities.\n\
456 static const string propagationModeHelp
= "\
457 This decides on kind of propagation arithmetic attempts to do during the search.\n\
460 use constraints to do unate propagation\n\
461 + bi (Bounds Inference)\n\
462 infers bounds on basic variables using the upper and lower bounds of the\n\
463 non-basic variables in the tableau.\n\
467 static const string pivotRulesHelp
= "\
468 This decides on the rule used by simplex during hueristic rounds\n\
469 for deciding the next basic variable to select.\n\
470 Pivot rules available:\n\
472 The minimum abs() value of the variable's violation of its bound. (default)\n\
474 The minimum violation with ties broken by variable order (total)\n\
476 The maximum violation the bound\n\
479 string
Options::getDescription() const {
480 return optionsDescription
;
483 void Options::printUsage(const std::string msg
, std::ostream
& out
) {
484 out
<< msg
<< optionsDescription
<< endl
<< flush
;
487 void Options::printShortUsage(const std::string msg
, std::ostream
& out
) {
488 out
<< msg
<< mostCommonOptionsDescription
<< endl
489 << "For full usage, please use --help." << endl
<< flush
;
492 void Options::printLanguageHelp(std::ostream
& out
) {
493 out
<< languageDescription
<< flush
;
497 * For the main getopt() routine, we need ways to switch on long
498 * options without clashing with short option characters. This is an
499 * enum of those long options. For long options (e.g. "--verbose")
500 * with a short option equivalent ("-v"), we use the single-letter
501 * short option; therefore, this enumeration starts at 256 to avoid
505 OPTION_VALUE_BEGIN
= 256, /* avoid clashing with char options */
515 NO_THEORY_REGISTRATION
,
526 LAZY_DEFINITION_EXPANSION
,
534 NO_UNCONSTRAINED_SIMP
,
553 ARITHMETIC_UNATE_LEMMA_MODE
,
554 ARITHMETIC_PROPAGATION_MODE
,
555 ARITHMETIC_HEURISTIC_PIVOTS
,
556 ARITHMETIC_VAR_ORDER_PIVOTS
,
557 ARITHMETIC_PIVOT_RULE
,
558 ARITHMETIC_CHECK_PERIOD
,
559 ARITHMETIC_PIVOT_THRESHOLD
,
560 ARITHMETIC_PROP_MAX_LENGTH
,
561 ARITHMETIC_DIO_SOLVER
,
562 ENABLE_ARITHMETIC_REWRITE_EQUALITIES
,
563 DISABLE_ARITHMETIC_REWRITE_EQUALITIES
,
564 ENABLE_SYMMETRY_BREAKER
,
565 DISABLE_SYMMETRY_BREAKER
,
566 DISABLE_MINISCOPE_QUANT
,
567 DISABLE_MINISCOPE_QUANT_FV
,
568 DISABLE_PRENEX_QUANT
,
572 DISABLE_SMART_TRIGGERS
,
573 REGISTER_QUANT_BODY_TERMS
,
578 DISABLE_FMF_MODEL_BASED_INST
,
579 EFFICIENT_E_MATCHING
,
583 IGNORE_USER_PATTERNS
,
584 ENABLE_FLIP_DECISION
,
586 PARALLEL_SEPARATE_OUTPUT
,
587 PORTFOLIO_FILTER_LENGTH
,
592 BITVECTOR_EAGER_BITBLAST
,
593 BITVECTOR_SHARE_LEMMAS
,
594 BITVECTOR_EAGER_FULLCHECK
,
595 SAT_REFINE_CONFLICTS
,
598 };/* enum OptionValue */
601 * This is a table of long options. By policy, each short option
602 * should have an equivalent long option (but the reverse isn't the
603 * case), so this table should thus contain all command-line options.
605 * Each option in this array has four elements:
607 * 1. the long option string
608 * 2. argument behavior for the option:
609 * no_argument - no argument permitted
610 * required_argument - an argument is expected
611 * optional_argument - an argument is permitted but not required
612 * 3. this is a pointer to an int which is set to the 4th entry of the
613 * array if the option is present; or NULL, in which case
614 * getopt_long() returns the 4th entry
615 * 4. the return value for getopt_long() when this long option (or the
616 * value to set the 3rd entry to; see #3)
618 * If you add something here, you should add it in src/main/usage.h
619 * also, to document it.
621 * If you add something that has a short option equivalent, you should
622 * add it to the getopt_long() call in parseOptions().
624 static struct option cmdlineOptions
[] = {
625 // name, has_arg, *flag, val
626 { "verbose" , no_argument
, NULL
, 'v' },
627 { "quiet" , no_argument
, NULL
, 'q' },
628 { "debug" , required_argument
, NULL
, 'd' },
629 { "trace" , required_argument
, NULL
, 't' },
630 { "stats" , no_argument
, NULL
, STATS
},
631 { "no-checking", no_argument
, NULL
, NO_CHECKING
},
632 { "no-theory-registration", no_argument
, NULL
, NO_THEORY_REGISTRATION
},
633 { "show-debug-tags", no_argument
, NULL
, SHOW_DEBUG_TAGS
},
634 { "show-trace-tags", no_argument
, NULL
, SHOW_TRACE_TAGS
},
635 { "show-sat-solvers", no_argument
, NULL
, SHOW_SAT_SOLVERS
},
636 { "show-config", no_argument
, NULL
, SHOW_CONFIG
},
637 { "segv-nospin", no_argument
, NULL
, SEGV_NOSPIN
},
638 { "help" , no_argument
, NULL
, 'h' },
639 { "version" , no_argument
, NULL
, 'V' },
640 { "about" , no_argument
, NULL
, 'V' },
641 { "lang" , required_argument
, NULL
, 'L' },
642 { "output-lang", required_argument
, NULL
, OUTPUT_LANGUAGE
},
643 { "parse-only" , no_argument
, NULL
, PARSE_ONLY
},
644 { "preprocess-only", no_argument
, NULL
, PREPROCESS_ONLY
},
645 { "dump" , required_argument
, NULL
, DUMP
},
646 { "dump-to" , required_argument
, NULL
, DUMP_TO
},
647 { "mmap" , no_argument
, NULL
, USE_MMAP
},
648 { "strict-parsing", no_argument
, NULL
, STRICT_PARSING
},
649 { "default-expr-depth", required_argument
, NULL
, DEFAULT_EXPR_DEPTH
},
650 { "default-dag-thresh", required_argument
, NULL
, DEFAULT_DAG_THRESH
},
651 { "print-expr-types", no_argument
, NULL
, PRINT_EXPR_TYPES
},
652 { "uf" , required_argument
, NULL
, UF_THEORY
},
653 { "lazy-definition-expansion", no_argument
, NULL
, LAZY_DEFINITION_EXPANSION
},
654 { "simplification", required_argument
, NULL
, SIMPLIFICATION_MODE
},
655 { "decision", required_argument
, NULL
, DECISION_MODE
},
656 { "decision-budget", required_argument
, NULL
, DECISION_BUDGET
},
657 { "no-static-learning", no_argument
, NULL
, NO_STATIC_LEARNING
},
658 { "ite-simp", no_argument
, NULL
, ITE_SIMP
},
659 { "no-ite-simp", no_argument
, NULL
, NO_ITE_SIMP
},
660 { "unconstrained-simp", no_argument
, NULL
, UNCONSTRAINED_SIMP
},
661 { "no-unconstrained-simp", no_argument
, NULL
, NO_UNCONSTRAINED_SIMP
},
662 { "repeat-simp", no_argument
, NULL
, REPEAT_SIMP
},
663 { "no-repeat-simp", no_argument
, NULL
, NO_REPEAT_SIMP
},
664 { "interactive", no_argument
, NULL
, INTERACTIVE
},
665 { "no-interactive", no_argument
, NULL
, NO_INTERACTIVE
},
666 { "produce-models", no_argument
, NULL
, 'm' },
667 { "produce-assignments", no_argument
, NULL
, PRODUCE_ASSIGNMENTS
},
668 { "print-success", no_argument
, NULL
, PRINT_SUCCESS
},
669 { "smtlib2", no_argument
, NULL
, SMTLIB2
},
670 { "proof", no_argument
, NULL
, PROOF
},
671 { "no-type-checking", no_argument
, NULL
, NO_TYPE_CHECKING
},
672 { "lazy-type-checking", no_argument
, NULL
, LAZY_TYPE_CHECKING
},
673 { "eager-type-checking", no_argument
, NULL
, EAGER_TYPE_CHECKING
},
674 { "incremental", no_argument
, NULL
, 'i' },
675 { "replay" , required_argument
, NULL
, REPLAY
},
676 { "replay-log" , required_argument
, NULL
, REPLAY_LOG
},
677 { "random-freq" , required_argument
, NULL
, RANDOM_FREQUENCY
},
678 { "random-seed" , required_argument
, NULL
, RANDOM_SEED
},
679 { "restart-int-base", required_argument
, NULL
, SAT_RESTART_FIRST
},
680 { "restart-int-inc", required_argument
, NULL
, SAT_RESTART_INC
},
681 { "print-winner", no_argument
, NULL
, PRINT_WINNER
},
682 { "unate-lemmas", required_argument
, NULL
, ARITHMETIC_UNATE_LEMMA_MODE
},
683 { "arith-prop", required_argument
, NULL
, ARITHMETIC_PROPAGATION_MODE
},
684 { "heuristic-pivots", required_argument
, NULL
, ARITHMETIC_HEURISTIC_PIVOTS
},
685 { "heuristic-pivot-rule" , required_argument
, NULL
, ARITHMETIC_PIVOT_RULE
},
686 { "standard-effort-variable-order-pivots", required_argument
, NULL
, ARITHMETIC_VAR_ORDER_PIVOTS
},
687 { "simplex-check-period" , required_argument
, NULL
, ARITHMETIC_CHECK_PERIOD
},
688 { "pivot-threshold" , required_argument
, NULL
, ARITHMETIC_PIVOT_THRESHOLD
},
689 { "prop-row-length" , required_argument
, NULL
, ARITHMETIC_PROP_MAX_LENGTH
},
690 { "disable-dio-solver", no_argument
, NULL
, ARITHMETIC_DIO_SOLVER
},
691 { "enable-arith-rewrite-equalities", no_argument
, NULL
, ENABLE_ARITHMETIC_REWRITE_EQUALITIES
},
692 { "disable-arith-rewrite-equalities", no_argument
, NULL
, DISABLE_ARITHMETIC_REWRITE_EQUALITIES
},
693 { "enable-symmetry-breaker", no_argument
, NULL
, ENABLE_SYMMETRY_BREAKER
},
694 { "disable-symmetry-breaker", no_argument
, NULL
, DISABLE_SYMMETRY_BREAKER
},
695 { "disable-miniscope-quant", no_argument
, NULL
, DISABLE_MINISCOPE_QUANT
},
696 { "disable-miniscope-quant-fv", no_argument
, NULL
, DISABLE_MINISCOPE_QUANT_FV
},
697 { "disable-prenex-quant", no_argument
, NULL
, DISABLE_PRENEX_QUANT
},
698 { "var-elim-quant", no_argument
, NULL
, VAR_ELIM_QUANT
},
699 { "cnf-quant", no_argument
, NULL
, CNF_QUANT
},
700 { "pre-skolem-quant", no_argument
, NULL
, PRE_SKOLEM_QUANT
},
701 { "disable-smart-triggers", no_argument
, NULL
, DISABLE_SMART_TRIGGERS
},
702 { "register-quant-body-terms", no_argument
, NULL
, REGISTER_QUANT_BODY_TERMS
},
703 { "inst-when", required_argument
, NULL
, INST_WHEN
},
704 { "eager-inst-quant", no_argument
, NULL
, EAGER_INST_QUANT
},
705 { "finite-model-find", no_argument
, NULL
, FINITE_MODEL_FIND
},
706 { "use-fmf-region-sat", no_argument
, NULL
, FMF_REGION_SAT
},
707 { "disable-fmf-model-inst", no_argument
, NULL
, DISABLE_FMF_MODEL_BASED_INST
},
708 { "efficient-e-matching", no_argument
, NULL
, EFFICIENT_E_MATCHING
},
709 { "literal-matching", required_argument
, NULL
, LITERAL_MATCHING
},
710 { "enable-cbqi", no_argument
, NULL
, ENABLE_CBQI
},
711 { "disable-cbqi", no_argument
, NULL
, DISABLE_CBQI
},
712 { "ignore-user-patterns", no_argument
, NULL
, IGNORE_USER_PATTERNS
},
713 { "enable-flip-decision", no_argument
, NULL
, ENABLE_FLIP_DECISION
},
714 { "threads", required_argument
, NULL
, PARALLEL_THREADS
},
715 { "separate-output", no_argument
, NULL
, PARALLEL_SEPARATE_OUTPUT
},
716 { "filter-lemma-length", required_argument
, NULL
, PORTFOLIO_FILTER_LENGTH
},
717 { "tlimit" , required_argument
, NULL
, TIME_LIMIT
},
718 { "tlimit-per" , required_argument
, NULL
, TIME_LIMIT_PER
},
719 { "rlimit" , required_argument
, NULL
, RESOURCE_LIMIT
},
720 { "rlimit-per" , required_argument
, NULL
, RESOURCE_LIMIT_PER
},
721 { "bitblast-eager", no_argument
, NULL
, BITVECTOR_EAGER_BITBLAST
},
722 { "bitblast-share-lemmas", no_argument
, NULL
, BITVECTOR_SHARE_LEMMAS
},
723 { "bitblast-eager-fullcheck", no_argument
, NULL
, BITVECTOR_EAGER_FULLCHECK
},
724 { "refine-conflicts", no_argument
, NULL
, SAT_REFINE_CONFLICTS
},
725 { "theoryof-mode", required_argument
, NULL
, THEORYOF_MODE
},
726 { NULL
, no_argument
, NULL
, '\0' }
727 };/* if you add things to the above, please remember to update usage.h! */
730 /** Parse argc/argv and put the result into a CVC4::Options struct. */
731 int Options::parseOptions(int argc
, char* argv
[])
732 throw(OptionException
) {
733 const char *progName
= argv
[0];
736 // Reset getopt(), in the case of multiple calls.
737 // This can be = 1 in newer GNU getopt, but older (< 2007) require = 0.
739 #if HAVE_DECL_OPTRESET
740 optreset
= 1; // on BSD getopt() (e.g. Mac OS), might also need this
741 #endif /* HAVE_DECL_OPTRESET */
743 // find the base name of the program
744 const char *x
= strrchr(progName
, '/');
748 binary_name
= string(progName
);
750 // The strange string in this call is the short option string. An
751 // initial '+' means that option processing stops as soon as a
752 // non-option argument is encountered (it is not present, by design).
753 // The initial ':' indicates that getopt_long() should return ':'
754 // instead of '?' for a missing option argument. Then, each letter
755 // is a valid short option for getopt_long(), and if it's encountered,
756 // getopt_long() returns that character. A ':' after an option
757 // character means an argument is required; two colons indicates an
758 // argument is optional; no colons indicate an argument is not
759 // permitted. cmdlineOptions specifies all the long-options and the
760 // return value for getopt_long() should they be encountered.
761 while((c
= getopt_long(argc
, argv
,
763 cmdlineOptions
, NULL
)) != -1) {
783 setInputLanguage(optarg
);
786 case OUTPUT_LANGUAGE
:
787 setOutputLanguage(optarg
);
791 if(Configuration::isTracingBuild()) {
792 if(!Configuration::isTraceTag(optarg
))
793 throw OptionException(string("trace tag ") + optarg
+
794 string(" not available"));
796 throw OptionException("trace tags not available in non-tracing builds");
802 if(Configuration::isDebugBuild() && Configuration::isTracingBuild()) {
803 if(!Configuration::isDebugTag(optarg
) && !Configuration::isTraceTag(optarg
)) {
804 throw OptionException(string("debug tag ") + optarg
+
805 string(" not available"));
807 } else if(! Configuration::isDebugBuild()) {
808 throw OptionException("debug tags not available in non-debug builds");
810 throw OptionException("debug tags not available in non-tracing builds");
828 case PREPROCESS_ONLY
:
829 preprocessOnly
= true;
834 char* tokstr
= optarg
;
836 while((optarg
= strtok_r(tokstr
, ",", &toksave
)) != NULL
) {
838 if(!strcmp(optarg
, "benchmark")) {
839 } else if(!strcmp(optarg
, "declarations")) {
840 } else if(!strcmp(optarg
, "assertions")) {
841 } else if(!strcmp(optarg
, "learned")) {
842 } else if(!strcmp(optarg
, "clauses")) {
843 } else if(!strcmp(optarg
, "t-conflicts") ||
844 !strcmp(optarg
, "t-lemmas") ||
845 !strcmp(optarg
, "t-explanations") ||
846 !strcmp(optarg
, "bv-rewrites") ||
847 !strcmp(optarg
, "theory::fullcheck")) {
848 // These are "non-state-dumping" modes. If state (SAT decisions,
849 // propagations, etc.) is dumped, it will interfere with the validity
850 // of these generated queries.
851 if(Dump
.isOn("state")) {
852 throw OptionException(string("dump option `") + optarg
+
853 "' conflicts with a previous, "
854 "state-dumping dump option. You cannot "
855 "mix stateful and non-stateful dumping modes; "
858 Dump
.on("no-permit-state");
860 } else if(!strcmp(optarg
, "state") ||
861 !strcmp(optarg
, "missed-t-conflicts") ||
862 !strcmp(optarg
, "t-propagations") ||
863 !strcmp(optarg
, "missed-t-propagations")) {
864 // These are "state-dumping" modes. If state (SAT decisions,
865 // propagations, etc.) is not dumped, it will interfere with the
866 // validity of these generated queries.
867 if(Dump
.isOn("no-permit-state")) {
868 throw OptionException(string("dump option `") + optarg
+
869 "' conflicts with a previous, "
870 "non-state-dumping dump option. You cannot "
871 "mix stateful and non-stateful dumping modes; "
876 } else if(!strcmp(optarg
, "help")) {
877 puts(dumpHelp
.c_str());
880 throw OptionException(string("unknown option for --dump: `") +
881 optarg
+ "'. Try --dump help.");
885 Dump
.on("benchmark");
886 if(strcmp(optarg
, "benchmark")) {
887 Dump
.on("declarations");
890 #else /* CVC4_DUMPING */
891 throw OptionException("The dumping feature was disabled in this build of CVC4.");
892 #endif /* CVC4_DUMPING */
898 size_t dagSetting
= expr::ExprDag::getDag(Dump
.getStream());
899 if(optarg
== NULL
|| *optarg
== '\0') {
900 throw OptionException(string("Bad file name for --dump-to"));
901 } else if(!strcmp(optarg
, "-")) {
902 Dump
.setStream(DumpOutC::dump_cout
);
904 ostream
* dumpTo
= new ofstream(optarg
, ofstream::out
| ofstream::trunc
);
906 throw OptionException(string("Cannot open dump-to file (maybe it exists): `") + optarg
+ "'");
908 Dump
.setStream(*dumpTo
);
910 expr::ExprDag::setDag(Dump
.getStream(), dagSetting
);
911 #else /* CVC4_DUMPING */
912 throw OptionException("The dumping feature was disabled in this build of CVC4.");
913 #endif /* CVC4_DUMPING */
917 case NO_THEORY_REGISTRATION
:
918 theoryRegistration
= false;
922 semanticChecks
= false;
923 typeChecking
= false;
924 earlyTypeChecking
= false;
936 strictParsing
= true;
939 case DEFAULT_EXPR_DEPTH
:
941 int depth
= atoi(optarg
);
942 Debug
.getStream() << Expr::setdepth(depth
);
943 Trace
.getStream() << Expr::setdepth(depth
);
944 Notice
.getStream() << Expr::setdepth(depth
);
945 Chat
.getStream() << Expr::setdepth(depth
);
946 Message
.getStream() << Expr::setdepth(depth
);
947 Warning
.getStream() << Expr::setdepth(depth
);
951 case DEFAULT_DAG_THRESH
:
953 int dag
= atoi(optarg
);
955 throw OptionException("--default-dag-thresh requires a nonnegative argument.");
957 Debug
.getStream() << Expr::dag(dag
);
958 Trace
.getStream() << Expr::dag(dag
);
959 Notice
.getStream() << Expr::dag(dag
);
960 Chat
.getStream() << Expr::dag(dag
);
961 Message
.getStream() << Expr::dag(dag
);
962 Warning
.getStream() << Expr::dag(dag
);
963 Dump
.getStream() << Expr::dag(dag
);
967 case PRINT_EXPR_TYPES
:
968 Debug
.getStream() << Expr::printtypes(true);
969 Trace
.getStream() << Expr::printtypes(true);
970 Notice
.getStream() << Expr::printtypes(true);
971 Chat
.getStream() << Expr::printtypes(true);
972 Message
.getStream() << Expr::printtypes(true);
973 Warning
.getStream() << Expr::printtypes(true);
976 case LAZY_DEFINITION_EXPANSION
:
977 lazyDefinitionExpansion
= true;
980 case SIMPLIFICATION_MODE
:
981 if(!strcmp(optarg
, "batch")) {
982 simplificationMode
= SIMPLIFICATION_MODE_BATCH
;
983 simplificationModeSetByUser
= true;
984 } else if(!strcmp(optarg
, "incremental")) {
985 simplificationMode
= SIMPLIFICATION_MODE_INCREMENTAL
;
986 simplificationModeSetByUser
= true;
987 } else if(!strcmp(optarg
, "none")) {
988 simplificationMode
= SIMPLIFICATION_MODE_NONE
;
989 simplificationModeSetByUser
= true;
990 } else if(!strcmp(optarg
, "help")) {
991 puts(simplificationHelp
.c_str());
994 throw OptionException(string("unknown option for --simplification: `") +
995 optarg
+ "'. Try --simplification help.");
1000 if (!strcmp(optarg
, "type")) {
1001 theoryOfModeSetByUser
= true;
1002 theoryOfMode
= theory::THEORY_OF_TYPE_BASED
;
1003 } else if (!strcmp(optarg
, "term")) {
1004 theoryOfModeSetByUser
= true;
1005 theoryOfMode
= theory::THEORY_OF_TERM_BASED
;
1006 } else if (!strcmp(optarg
, "help")) {
1007 puts(theoryofHelp
.c_str());
1010 throw OptionException(string("unknown option for --theoryof-mode: `") +
1011 optarg
+ "'. Try --theoryof-mode help.");
1015 if(!strcmp(optarg
, "internal")) {
1016 decisionMode
= DECISION_STRATEGY_INTERNAL
;
1017 decisionModeSetByUser
= true;
1018 } else if(!strcmp(optarg
, "justification")) {
1019 decisionMode
= DECISION_STRATEGY_JUSTIFICATION
;
1020 decisionModeSetByUser
= true;
1021 } else if(!strcmp(optarg
, "relevancy")) {
1022 decisionMode
= DECISION_STRATEGY_RELEVANCY
;
1023 decisionModeSetByUser
= true;
1024 decisionOptions
.relevancyLeaves
= false;
1025 } else if(!strcmp(optarg
, "relevancy-leaves")) {
1026 decisionMode
= DECISION_STRATEGY_RELEVANCY
;
1027 decisionModeSetByUser
= true;
1028 decisionOptions
.relevancyLeaves
= true;
1029 } else if(!strcmp(optarg
, "justification-rel")) {
1030 decisionMode
= DECISION_STRATEGY_RELEVANCY
;
1031 decisionModeSetByUser
= true;
1032 // relevancyLeaves : irrelevant
1033 // maxRelTimeAsPermille : irrelevant
1034 decisionOptions
.computeRelevancy
= false;
1035 decisionOptions
.mustRelevancy
= false;
1036 } else if(!strcmp(optarg
, "justification-must")) {
1037 decisionMode
= DECISION_STRATEGY_RELEVANCY
;
1038 decisionModeSetByUser
= true;
1039 // relevancyLeaves : irrelevant
1040 // maxRelTimeAsPermille : irrelevant
1041 decisionOptions
.computeRelevancy
= false;
1042 decisionOptions
.mustRelevancy
= true;
1043 } else if(!strcmp(optarg
, "help")) {
1044 puts(decisionHelp
.c_str());
1047 throw OptionException(string("unknown option for --decision: `") +
1048 optarg
+ "'. Try --decision help.");
1052 case DECISION_BUDGET
: {
1053 int i
= atoi(optarg
);
1054 if(i
< 0 || i
> 1000) {
1055 throw OptionException(string("invalid value for --decision-budget: `") +
1056 optarg
+ "'. Must be between 0 and 1000.");
1059 Warning() << "Decision budget is 0. Consider using internal decision hueristic and "
1060 << std::endl
<< " removing this option." << std::endl
;
1063 decisionOptions
.maxRelTimeAsPermille
= (unsigned short)i
;
1067 case NO_STATIC_LEARNING
:
1068 doStaticLearning
= false;
1073 doITESimpSetByUser
= true;
1078 doITESimpSetByUser
= true;
1081 case UNCONSTRAINED_SIMP
:
1082 unconstrainedSimp
= true;
1083 unconstrainedSimpSetByUser
= true;
1086 case NO_UNCONSTRAINED_SIMP
:
1087 unconstrainedSimp
= false;
1088 unconstrainedSimpSetByUser
= true;
1093 repeatSimpSetByUser
= true;
1096 case NO_REPEAT_SIMP
:
1098 repeatSimpSetByUser
= true;
1103 interactiveSetByUser
= true;
1106 case NO_INTERACTIVE
:
1107 interactive
= false;
1108 interactiveSetByUser
= true;
1112 produceModels
= true;
1115 case PRODUCE_ASSIGNMENTS
:
1116 produceAssignments
= true;
1119 case SMTLIB2
: // smtlib v2 compliance mode
1120 inputLanguage
= language::input::LANG_SMTLIB_V2
;
1121 outputLanguage
= language::output::LANG_SMTLIB_V2
;
1122 strictParsing
= true;
1123 // make sure entire expressions are printed on all the non-debug, non-trace streams
1124 Notice
.getStream() << Expr::setdepth(-1);
1125 Chat
.getStream() << Expr::setdepth(-1);
1126 Message
.getStream() << Expr::setdepth(-1);
1127 Warning
.getStream() << Expr::setdepth(-1);
1128 /* intentionally fall through */
1131 Debug
.getStream() << Command::printsuccess(true);
1132 Trace
.getStream() << Command::printsuccess(true);
1133 Notice
.getStream() << Command::printsuccess(true);
1134 Chat
.getStream() << Command::printsuccess(true);
1135 Message
.getStream() << Command::printsuccess(true);
1136 Warning
.getStream() << Command::printsuccess(true);
1142 #else /* CVC4_PROOF */
1143 throw OptionException("This is not a proof-enabled build of CVC4; --proof cannot be used");
1144 #endif /* CVC4_PROOF */
1147 case NO_TYPE_CHECKING
:
1148 typeChecking
= false;
1149 earlyTypeChecking
= false;
1152 case LAZY_TYPE_CHECKING
:
1153 typeChecking
= true;
1154 earlyTypeChecking
= false;
1157 case EAGER_TYPE_CHECKING
:
1158 typeChecking
= true;
1159 earlyTypeChecking
= true;
1163 incrementalSolving
= true;
1168 if(optarg
== NULL
|| *optarg
== '\0') {
1169 throw OptionException(string("Bad file name for --replay"));
1171 replayFilename
= optarg
;
1173 #else /* CVC4_REPLAY */
1174 throw OptionException("The replay feature was disabled in this build of CVC4.");
1175 #endif /* CVC4_REPLAY */
1180 if(optarg
== NULL
|| *optarg
== '\0') {
1181 throw OptionException(string("Bad file name for --replay-log"));
1182 } else if(!strcmp(optarg
, "-")) {
1185 replayLog
= new ofstream(optarg
, ofstream::out
| ofstream::trunc
);
1187 throw OptionException(string("Cannot open replay-log file: `") + optarg
+ "'");
1190 #else /* CVC4_REPLAY */
1191 throw OptionException("The replay feature was disabled in this build of CVC4.");
1192 #endif /* CVC4_REPLAY */
1195 case ENABLE_SYMMETRY_BREAKER
:
1196 ufSymmetryBreaker
= true;
1197 ufSymmetryBreakerSetByUser
= true;
1199 case DISABLE_SYMMETRY_BREAKER
:
1200 ufSymmetryBreaker
= false;
1201 ufSymmetryBreakerSetByUser
= true;
1203 case DISABLE_MINISCOPE_QUANT
:
1204 miniscopeQuant
= false;
1206 case DISABLE_MINISCOPE_QUANT_FV
:
1207 miniscopeQuantFreeVar
= false;
1209 case DISABLE_PRENEX_QUANT
:
1210 prenexQuant
= false;
1212 case VAR_ELIM_QUANT
:
1213 varElimQuant
= true;
1218 case PRE_SKOLEM_QUANT
:
1219 preSkolemQuant
= true;
1221 case DISABLE_SMART_TRIGGERS
:
1222 smartTriggers
= false;
1224 case REGISTER_QUANT_BODY_TERMS
:
1225 registerQuantBodyTerms
= true;
1228 if(!strcmp(optarg
, "pre-full")) {
1229 instWhenMode
= INST_WHEN_PRE_FULL
;
1230 } else if(!strcmp(optarg
, "full")) {
1231 instWhenMode
= INST_WHEN_FULL
;
1232 } else if(!strcmp(optarg
, "full-last-call")) {
1233 instWhenMode
= INST_WHEN_FULL_LAST_CALL
;
1234 } else if(!strcmp(optarg
, "last-call")) {
1235 instWhenMode
= INST_WHEN_LAST_CALL
;
1236 } else if(!strcmp(optarg
, "help")) {
1237 //puts(instWhenHelp.c_str());
1240 throw OptionException(string("unknown option for --inst-when: `") +
1241 optarg
+ "'. Try --inst-when help.");
1244 case EAGER_INST_QUANT
:
1245 eagerInstQuant
= true;
1247 case FINITE_MODEL_FIND
:
1248 finiteModelFind
= true;
1250 case FMF_REGION_SAT
:
1251 fmfRegionSat
= true;
1253 case DISABLE_FMF_MODEL_BASED_INST
:
1254 fmfModelBasedInst
= false;
1256 case EFFICIENT_E_MATCHING
:
1257 efficientEMatching
= true;
1259 case LITERAL_MATCHING
:
1260 if(!strcmp(optarg
, "none")) {
1261 literalMatchMode
= LITERAL_MATCH_NONE
;
1262 } else if(!strcmp(optarg
, "predicate")) {
1263 literalMatchMode
= LITERAL_MATCH_PREDICATE
;
1264 } else if(!strcmp(optarg
, "equality")) {
1265 literalMatchMode
= LITERAL_MATCH_EQUALITY
;
1266 } else if(!strcmp(optarg
, "help")) {
1267 //puts(literalMatchHelp.c_str());
1270 throw OptionException(string("unknown option for --literal-matching: `") +
1271 optarg
+ "'. Try --literal-matching help.");
1276 cbqiSetByUser
= true;
1280 cbqiSetByUser
= true;
1282 case IGNORE_USER_PATTERNS
:
1283 userPatternsQuant
= false;
1285 case ENABLE_FLIP_DECISION
:
1286 flipDecision
= true;
1290 int i
= atoi(optarg
);
1292 throw OptionException("--time-limit requires a nonnegative argument.");
1294 cumulativeMillisecondLimit
= (unsigned long) i
;
1297 case TIME_LIMIT_PER
:
1299 int i
= atoi(optarg
);
1301 throw OptionException("--time-limit-per requires a nonnegative argument.");
1303 perCallMillisecondLimit
= (unsigned long) i
;
1306 case RESOURCE_LIMIT
:
1308 int i
= atoi(optarg
);
1310 throw OptionException("--limit requires a nonnegative argument.");
1312 cumulativeResourceLimit
= (unsigned long) i
;
1315 case RESOURCE_LIMIT_PER
:
1317 int i
= atoi(optarg
);
1319 throw OptionException("--limit-per requires a nonnegative argument.");
1321 perCallResourceLimit
= (unsigned long) i
;
1324 case BITVECTOR_EAGER_BITBLAST
:
1326 bitvectorEagerBitblast
= true;
1329 case BITVECTOR_EAGER_FULLCHECK
:
1331 bitvectorEagerFullcheck
= true;
1334 case BITVECTOR_SHARE_LEMMAS
:
1336 bitvectorShareLemmas
= true;
1339 case SAT_REFINE_CONFLICTS
:
1341 sat_refine_conflicts
= true;
1345 satRandomSeed
= atof(optarg
);
1348 case RANDOM_FREQUENCY
:
1349 satRandomFreq
= atof(optarg
);
1350 if(! (0.0 <= satRandomFreq
&& satRandomFreq
<= 1.0)){
1351 throw OptionException(string("--random-freq: `") +
1352 optarg
+ "' is not between 0.0 and 1.0.");
1356 case SAT_RESTART_FIRST
:
1358 int i
= atoi(optarg
);
1360 throw OptionException("--restart-int-base requires a number bigger than 1");
1362 satRestartFirst
= i
;
1366 case SAT_RESTART_INC
:
1368 int i
= atoi(optarg
);
1370 throw OptionException("--restart-int-inc requires a number bigger than 1.0");
1376 case ARITHMETIC_UNATE_LEMMA_MODE
:
1377 if(!strcmp(optarg
, "all")) {
1378 arithUnateLemmaMode
= ALL_PRESOLVE_LEMMAS
;
1380 } else if(!strcmp(optarg
, "none")) {
1381 arithUnateLemmaMode
= NO_PRESOLVE_LEMMAS
;
1383 } else if(!strcmp(optarg
, "ineqs")) {
1384 arithUnateLemmaMode
= INEQUALITY_PRESOLVE_LEMMAS
;
1386 } else if(!strcmp(optarg
, "eqs")) {
1387 arithUnateLemmaMode
= EQUALITY_PRESOLVE_LEMMAS
;
1389 } else if(!strcmp(optarg
, "help")) {
1390 puts(arithUnateLemmasHelp
.c_str());
1393 throw OptionException(string("unknown option for --unate-lemmas: `") +
1394 optarg
+ "'. Try --unate-lemmas=help.");
1398 case ARITHMETIC_PROPAGATION_MODE
:
1399 if(!strcmp(optarg
, "none")) {
1400 arithPropagationMode
= NO_PROP
;
1402 } else if(!strcmp(optarg
, "unate")) {
1403 arithPropagationMode
= UNATE_PROP
;
1405 } else if(!strcmp(optarg
, "bi")) {
1406 arithPropagationMode
= BOUND_INFERENCE_PROP
;
1408 } else if(!strcmp(optarg
, "both")) {
1409 arithPropagationMode
= BOTH_PROP
;
1411 } else if(!strcmp(optarg
, "help")) {
1412 puts(propagationModeHelp
.c_str());
1415 throw OptionException(string("unknown option for --arith-prop: `") +
1416 optarg
+ "'. Try --arith-prop help.");
1420 case ARITHMETIC_HEURISTIC_PIVOTS
:
1421 arithHeuristicPivots
= atoi(optarg
);
1422 arithHeuristicPivotsSetByUser
= true;
1425 case ARITHMETIC_VAR_ORDER_PIVOTS
:
1426 arithStandardCheckVarOrderPivots
= atoi(optarg
);
1427 arithStandardCheckVarOrderPivotsSetByUser
= true;
1430 case ARITHMETIC_PIVOT_RULE
:
1431 if(!strcmp(optarg
, "min")) {
1432 arithHeuristicPivotRule
= MINIMUM
;
1434 } else if(!strcmp(optarg
, "min-break-ties")) {
1435 arithHeuristicPivotRule
= BREAK_TIES
;
1437 } else if(!strcmp(optarg
, "max")) {
1438 arithHeuristicPivotRule
= MAXIMUM
;
1440 } else if(!strcmp(optarg
, "help")) {
1441 puts(pivotRulesHelp
.c_str());
1444 throw OptionException(string("unknown option for --heuristic-pivot-rule: `") +
1445 optarg
+ "'. Try --heuristic-pivot-rule help.");
1449 case ARITHMETIC_CHECK_PERIOD
:
1450 arithSimplexCheckPeriod
= atoi(optarg
);
1453 case ARITHMETIC_PIVOT_THRESHOLD
:
1454 arithPivotThreshold
= atoi(optarg
);
1455 arithPivotThresholdSetByUser
= true;
1458 case ARITHMETIC_PROP_MAX_LENGTH
:
1459 arithPropagateMaxLength
= atoi(optarg
);
1462 case ARITHMETIC_DIO_SOLVER
:
1463 arithDioSolver
= false;
1466 case ENABLE_ARITHMETIC_REWRITE_EQUALITIES
:
1467 arithRewriteEq
= true;
1468 arithRewriteEqSetByUser
= true;
1471 case DISABLE_ARITHMETIC_REWRITE_EQUALITIES
:
1472 arithRewriteEq
= false;
1473 arithRewriteEqSetByUser
= true;
1476 case SHOW_DEBUG_TAGS
:
1477 if(Configuration::isDebugBuild() && Configuration::isTracingBuild()) {
1478 printf("available tags:");
1479 unsigned ntags
= Configuration::getNumDebugTags();
1480 char const* const* tags
= Configuration::getDebugTags();
1481 for(unsigned i
= 0; i
< ntags
; ++ i
) {
1482 printf(" %s", tags
[i
]);
1485 } else if(! Configuration::isDebugBuild()) {
1486 throw OptionException("debug tags not available in non-debug builds");
1488 throw OptionException("debug tags not available in non-tracing builds");
1493 case SHOW_TRACE_TAGS
:
1494 if(Configuration::isTracingBuild()) {
1495 printf("available tags:");
1496 unsigned ntags
= Configuration::getNumTraceTags();
1497 char const* const* tags
= Configuration::getTraceTags();
1498 for (unsigned i
= 0; i
< ntags
; ++ i
) {
1499 printf(" %s", tags
[i
]);
1503 throw OptionException("trace tags not available in non-tracing builds");
1508 case SHOW_SAT_SOLVERS
:
1510 vector
<string
> solvers
;
1511 prop::SatSolverFactory::getSolverIds(solvers
);
1512 printf("Available SAT solvers: ");
1513 for (unsigned i
= 0; i
< solvers
.size(); ++ i
) {
1517 printf("%s", solvers
[i
].c_str());
1524 fputs(Configuration::about().c_str(), stdout
);
1526 printf("version : %s\n", Configuration::getVersionString().c_str());
1527 if(Configuration::isSubversionBuild()) {
1528 printf("subversion : yes [%s r%u%s]\n",
1529 Configuration::getSubversionBranchName(),
1530 Configuration::getSubversionRevision(),
1531 Configuration::hasSubversionModifications() ?
1532 " (with modifications)" : "");
1534 printf("subversion : %s\n", Configuration::isSubversionBuild() ? "yes" : "no");
1537 printf("library : %u.%u.%u\n",
1538 Configuration::getVersionMajor(),
1539 Configuration::getVersionMinor(),
1540 Configuration::getVersionRelease());
1542 printf("debug code : %s\n", Configuration::isDebugBuild() ? "yes" : "no");
1543 printf("statistics : %s\n", Configuration::isStatisticsBuild() ? "yes" : "no");
1544 printf("replay : %s\n", Configuration::isReplayBuild() ? "yes" : "no");
1545 printf("tracing : %s\n", Configuration::isTracingBuild() ? "yes" : "no");
1546 printf("dumping : %s\n", Configuration::isDumpingBuild() ? "yes" : "no");
1547 printf("muzzled : %s\n", Configuration::isMuzzledBuild() ? "yes" : "no");
1548 printf("assertions : %s\n", Configuration::isAssertionBuild() ? "yes" : "no");
1549 printf("proof : %s\n", Configuration::isProofBuild() ? "yes" : "no");
1550 printf("coverage : %s\n", Configuration::isCoverageBuild() ? "yes" : "no");
1551 printf("profiling : %s\n", Configuration::isProfilingBuild() ? "yes" : "no");
1552 printf("competition: %s\n", Configuration::isCompetitionBuild() ? "yes" : "no");
1554 printf("cudd : %s\n", Configuration::isBuiltWithCudd() ? "yes" : "no");
1555 printf("cln : %s\n", Configuration::isBuiltWithCln() ? "yes" : "no");
1556 printf("gmp : %s\n", Configuration::isBuiltWithGmp() ? "yes" : "no");
1557 printf("tls : %s\n", Configuration::isBuiltWithTlsSupport() ? "yes" : "no");
1560 case PARALLEL_THREADS
:
1561 threads
= atoi(optarg
);
1564 case PARALLEL_SEPARATE_OUTPUT
:
1565 separateOutput
= true;
1568 case PORTFOLIO_FILTER_LENGTH
:
1569 sharingFilterByLength
= atoi(optarg
);
1573 // This can be a long or short option, and the way to get at the name of it is different.
1574 if(optopt
== 0 || // was a long option
1575 (optopt
>= OPTION_VALUE_BEGIN
&& optopt
<= OPTION_VALUE_END
)) { // OptionValue option
1576 throw OptionException(string("option `") + argv
[optind
- 1] + "' missing its required argument");
1577 } else { // was a short option
1578 throw OptionException(string("option `-") + char(optopt
) + "' missing its required argument");
1584 !strncmp(argv
[optind
- 1], "--thread", 8) &&
1585 strlen(argv
[optind
- 1]) > 8 &&
1586 isdigit(argv
[optind
- 1][8])) {
1587 int tnum
= atoi(argv
[optind
- 1] + 8);
1588 threadArgv
.resize(tnum
+ 1);
1589 if(threadArgv
[tnum
] != "") {
1590 threadArgv
[tnum
] += " ";
1592 const char* p
= strchr(argv
[optind
- 1] + 9, '=');
1593 if(p
== NULL
) { // e.g., we have --thread0 "foo"
1594 threadArgv
[tnum
] += argv
[optind
++];
1595 } else { // e.g., we have --thread0="foo"
1596 threadArgv
[tnum
] += p
+ 1;
1601 // This can be a long or short option, and the way to get at the name of it is different.
1602 if(optopt
== 0) { // was a long option
1603 throw OptionException(string("can't understand option `") + argv
[optind
- 1] + "'");
1604 } else { // was a short option
1605 throw OptionException(string("can't understand option `-") + char(optopt
) + "'");
1610 if(incrementalSolving
&& proof
) {
1611 throw OptionException(string("The use of --incremental with --proof is not yet supported"));
1617 void Options::setOutputLanguage(const char* str
) throw(OptionException
) {
1618 if(!strcmp(str
, "cvc4") || !strcmp(str
, "pl")) {
1619 outputLanguage
= language::output::LANG_CVC4
;
1621 } else if(!strcmp(str
, "smtlib") || !strcmp(str
, "smt")) {
1622 outputLanguage
= language::output::LANG_SMTLIB
;
1624 } else if(!strcmp(str
, "smtlib2") || !strcmp(str
, "smt2")) {
1625 outputLanguage
= language::output::LANG_SMTLIB_V2
;
1627 } else if(!strcmp(str
, "ast")) {
1628 outputLanguage
= language::output::LANG_AST
;
1630 } else if(!strcmp(str
, "auto")) {
1631 outputLanguage
= language::output::LANG_AUTO
;
1635 if(strcmp(str
, "help")) {
1636 throw OptionException(string("unknown language for --output-lang: `") +
1637 str
+ "'. Try --output-lang help.");
1640 languageHelp
= true;
1643 void Options::setInputLanguage(const char* str
) throw(OptionException
) {
1644 if(!strcmp(str
, "cvc4") || !strcmp(str
, "pl") || !strcmp(str
, "presentation")) {
1645 inputLanguage
= language::input::LANG_CVC4
;
1647 } else if(!strcmp(str
, "smtlib") || !strcmp(str
, "smt")) {
1648 inputLanguage
= language::input::LANG_SMTLIB
;
1650 } else if(!strcmp(str
, "smtlib2") || !strcmp(str
, "smt2")) {
1651 inputLanguage
= language::input::LANG_SMTLIB_V2
;
1653 } else if(!strcmp(str
, "auto")) {
1654 inputLanguage
= language::input::LANG_AUTO
;
1658 if(strcmp(str
, "help")) {
1659 throw OptionException(string("unknown language for --lang: `") +
1660 str
+ "'. Try --lang help.");
1663 languageHelp
= true;
1666 std::ostream
& operator<<(std::ostream
& out
, Options::ArithHeuristicPivotRule rule
) {
1668 case Options::MINIMUM
:
1671 case Options::BREAK_TIES
:
1672 out
<< "BREAK_TIES";
1674 case Options::MAXIMUM
:
1678 out
<< "ArithPivotRule!UNKNOWN";
1684 #undef USE_EARLY_TYPE_CHECKING_BY_DEFAULT
1685 #undef DO_SEMANTIC_CHECKS_BY_DEFAULT
1687 }/* CVC4 namespace */