GCC Code Coverage Report
Directory: . Exec Total Coverage
File: build-coverage/src/options/quantifiers_options.cpp Lines: 46 447 10.3 %
Date: 2021-11-07 Branches: 44 715 6.2 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Mathias Preiner, Aina Niemetz
4
 *
5
 * This file is part of the cvc5 project.
6
 *
7
 * Copyright (c) 2009-2021 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.
11
 * ****************************************************************************
12
 *
13
 * Option template for option modules.
14
 *
15
 * For each <module>_options.toml configuration file, mkoptions.py
16
 * expands this template and generates a <module>_options.cpp file.
17
 */
18
#include "options/quantifiers_options.h"
19
20
#include <iostream>
21
22
#include "base/check.h"
23
#include "options/option_exception.h"
24
25
namespace cvc5::options {
26
27
// clang-format off
28
std::ostream& operator<<(std::ostream& os, CegisSampleMode mode)
29
{
30
  switch(mode)
31
  {
32
    case CegisSampleMode::USE: return os << "use";
33
    case CegisSampleMode::NONE: return os << "none";
34
    case CegisSampleMode::TRUST: return os << "trust";
35
    default: Unreachable();
36
  }
37
  return os;
38
}
39
5
CegisSampleMode stringToCegisSampleMode(const std::string& optarg)
40
{
41
5
  if (optarg == "use") return CegisSampleMode::USE;
42
1
  else if (optarg == "none") return CegisSampleMode::NONE;
43
1
  else if (optarg == "trust") return CegisSampleMode::TRUST;
44
  else if (optarg == "help")
45
  {
46
    std::cerr << R"FOOBAR(
47
  Modes for sampling with counterexample-guided inductive synthesis (CEGIS).
48
Available modes for --cegis-sample are:
49
+ use
50
  Use sampling to accelerate CEGIS. This will rule out solutions for a
51
  conjecture when they are not satisfied by a sample point.
52
+ none (default)
53
  Do not use sampling with CEGIS.
54
+ trust
55
  Trust that when a solution for a conjecture is always true under sampling,
56
  then it is indeed a solution. Note this option may print out spurious
57
  solutions for synthesis conjectures.
58
)FOOBAR";
59
    std::exit(1);
60
  }
61
  throw OptionException(std::string("unknown option for --cegis-sample: `") +
62
                        optarg + "'.  Try --cegis-sample=help.");
63
}
64
std::ostream& operator<<(std::ostream& os, CegqiBvIneqMode mode)
65
{
66
  switch(mode)
67
  {
68
    case CegqiBvIneqMode::KEEP: return os << "keep";
69
    case CegqiBvIneqMode::EQ_BOUNDARY: return os << "eq-boundary";
70
    case CegqiBvIneqMode::EQ_SLACK: return os << "eq-slack";
71
    default: Unreachable();
72
  }
73
  return os;
74
}
75
82
CegqiBvIneqMode stringToCegqiBvIneqMode(const std::string& optarg)
76
{
77
82
  if (optarg == "keep") return CegqiBvIneqMode::KEEP;
78
3
  else if (optarg == "eq-boundary") return CegqiBvIneqMode::EQ_BOUNDARY;
79
  else if (optarg == "eq-slack") return CegqiBvIneqMode::EQ_SLACK;
80
  else if (optarg == "help")
81
  {
82
    std::cerr << R"FOOBAR(
83
  Modes for handling bit-vector inequalities in counterexample-guided
84
  instantiation.
85
Available modes for --cegqi-bv-ineq are:
86
+ keep
87
  Solve for the inequality directly using side conditions for invertibility.
88
+ eq-boundary (default)
89
  Solve for the boundary point of the inequality, e.g., t > s becomes t = s+1.
90
+ eq-slack
91
  Solve for the inequality using the slack value in the model, e.g., t > s
92
  becomes t = s + ( t-s )^M.
93
)FOOBAR";
94
    std::exit(1);
95
  }
96
  throw OptionException(std::string("unknown option for --cegqi-bv-ineq: `") +
97
                        optarg + "'.  Try --cegqi-bv-ineq=help.");
98
}
99
std::ostream& operator<<(std::ostream& os, InstWhenMode mode)
100
{
101
  switch(mode)
102
  {
103
    case InstWhenMode::LAST_CALL: return os << "last-call";
104
    case InstWhenMode::FULL_LAST_CALL: return os << "full-last-call";
105
    case InstWhenMode::FULL_DELAY: return os << "full-delay";
106
    case InstWhenMode::FULL: return os << "full";
107
    case InstWhenMode::FULL_DELAY_LAST_CALL: return os << "full-delay-last-call";
108
    default: Unreachable();
109
  }
110
  return os;
111
}
112
3
InstWhenMode stringToInstWhenMode(const std::string& optarg)
113
{
114
3
  if (optarg == "last-call") return InstWhenMode::LAST_CALL;
115
3
  else if (optarg == "full-last-call") return InstWhenMode::FULL_LAST_CALL;
116
3
  else if (optarg == "full-delay") return InstWhenMode::FULL_DELAY;
117
3
  else if (optarg == "full") return InstWhenMode::FULL;
118
  else if (optarg == "full-delay-last-call") return InstWhenMode::FULL_DELAY_LAST_CALL;
119
  else if (optarg == "help")
120
  {
121
    std::cerr << R"FOOBAR(
122
  Instantiation modes.
123
Available modes for --inst-when are:
124
+ last-call
125
  Run instantiation at last call effort, after theory combination and and
126
  theories report sat.
127
+ full-last-call (default)
128
  Alternate running instantiation rounds at full effort and last call.  In other
129
  words, interleave instantiation and theory combination.
130
+ full-delay
131
  Run instantiation round at full effort, before theory combination, after all
132
  other theories have finished.
133
+ full
134
  Run instantiation round at full effort, before theory combination.
135
+ full-delay-last-call
136
  Alternate running instantiation rounds at full effort after all other theories
137
  have finished, and last call.
138
)FOOBAR";
139
    std::exit(1);
140
  }
141
  throw OptionException(std::string("unknown option for --inst-when: `") +
142
                        optarg + "'.  Try --inst-when=help.");
143
}
144
std::ostream& operator<<(std::ostream& os, IteLiftQuantMode mode)
145
{
146
  switch(mode)
147
  {
148
    case IteLiftQuantMode::SIMPLE: return os << "simple";
149
    case IteLiftQuantMode::ALL: return os << "all";
150
    case IteLiftQuantMode::NONE: return os << "none";
151
    default: Unreachable();
152
  }
153
  return os;
154
}
155
IteLiftQuantMode stringToIteLiftQuantMode(const std::string& optarg)
156
{
157
  if (optarg == "simple") return IteLiftQuantMode::SIMPLE;
158
  else if (optarg == "all") return IteLiftQuantMode::ALL;
159
  else if (optarg == "none") return IteLiftQuantMode::NONE;
160
  else if (optarg == "help")
161
  {
162
    std::cerr << R"FOOBAR(
163
  ITE lifting modes for quantified formulas.
164
Available modes for --ite-lift-quant are:
165
+ simple (default)
166
  Lift if-then-else in quantified formulas if results in smaller term size.
167
+ all
168
  Lift if-then-else in quantified formulas.
169
+ none
170
  Do not lift if-then-else in quantified formulas.
171
)FOOBAR";
172
    std::exit(1);
173
  }
174
  throw OptionException(std::string("unknown option for --ite-lift-quant: `") +
175
                        optarg + "'.  Try --ite-lift-quant=help.");
176
}
177
std::ostream& operator<<(std::ostream& os, LiteralMatchMode mode)
178
{
179
  switch(mode)
180
  {
181
    case LiteralMatchMode::AGG_PREDICATE: return os << "agg-predicate";
182
    case LiteralMatchMode::USE: return os << "use";
183
    case LiteralMatchMode::NONE: return os << "none";
184
    case LiteralMatchMode::AGG: return os << "agg";
185
    default: Unreachable();
186
  }
187
  return os;
188
}
189
LiteralMatchMode stringToLiteralMatchMode(const std::string& optarg)
190
{
191
  if (optarg == "agg-predicate") return LiteralMatchMode::AGG_PREDICATE;
192
  else if (optarg == "use") return LiteralMatchMode::USE;
193
  else if (optarg == "none") return LiteralMatchMode::NONE;
194
  else if (optarg == "agg") return LiteralMatchMode::AGG;
195
  else if (optarg == "help")
196
  {
197
    std::cerr << R"FOOBAR(
198
  Literal match modes.
199
Available modes for --literal-matching are:
200
+ agg-predicate
201
  Consider phase requirements aggressively for predicates. In the above example,
202
  only match P( x ) with terms that are in the equivalence class of false.
203
+ use (default)
204
  Consider phase requirements of triggers conservatively. For example, the
205
  trigger P( x ) in forall( x ). ( P( x ) V ~Q( x ) ) will not be matched with
206
  terms in the equivalence class of true, and likewise Q( x ) will not be
207
  matched terms in the equivalence class of false. Extends to equality.
208
+ none
209
  Do not use literal matching.
210
+ agg
211
  Consider the phase requirements aggressively for all triggers.
212
)FOOBAR";
213
    std::exit(1);
214
  }
215
  throw OptionException(std::string("unknown option for --literal-matching: `") +
216
                        optarg + "'.  Try --literal-matching=help.");
217
}
218
std::ostream& operator<<(std::ostream& os, MacrosQuantMode mode)
219
{
220
  switch(mode)
221
  {
222
    case MacrosQuantMode::GROUND_UF: return os << "ground-uf";
223
    case MacrosQuantMode::ALL: return os << "all";
224
    case MacrosQuantMode::GROUND: return os << "ground";
225
    default: Unreachable();
226
  }
227
  return os;
228
}
229
2
MacrosQuantMode stringToMacrosQuantMode(const std::string& optarg)
230
{
231
2
  if (optarg == "ground-uf") return MacrosQuantMode::GROUND_UF;
232
2
  else if (optarg == "all") return MacrosQuantMode::ALL;
233
2
  else if (optarg == "ground") return MacrosQuantMode::GROUND;
234
  else if (optarg == "help")
235
  {
236
    std::cerr << R"FOOBAR(
237
  Modes for quantifiers macro expansion.
238
Available modes for --macros-quant-mode are:
239
+ ground-uf (default)
240
  Only infer ground definitions for functions that result in triggers for all
241
  free variables.
242
+ all
243
  Infer definitions for functions, including those containing quantified
244
  formulas.
245
+ ground
246
  Only infer ground definitions for functions.
247
)FOOBAR";
248
    std::exit(1);
249
  }
250
  throw OptionException(std::string("unknown option for --macros-quant-mode: `") +
251
                        optarg + "'.  Try --macros-quant-mode=help.");
252
}
253
std::ostream& operator<<(std::ostream& os, MbqiMode mode)
254
{
255
  switch(mode)
256
  {
257
    case MbqiMode::FMC: return os << "fmc";
258
    case MbqiMode::NONE: return os << "none";
259
    case MbqiMode::TRUST: return os << "trust";
260
    default: Unreachable();
261
  }
262
  return os;
263
}
264
MbqiMode stringToMbqiMode(const std::string& optarg)
265
{
266
  if (optarg == "fmc") return MbqiMode::FMC;
267
  else if (optarg == "none") return MbqiMode::NONE;
268
  else if (optarg == "trust") return MbqiMode::TRUST;
269
  else if (optarg == "help")
270
  {
271
    std::cerr << R"FOOBAR(
272
  Model-based quantifier instantiation modes.
273
Available modes for --mbqi are:
274
+ fmc (default)
275
  Use algorithm from Section 5.4.2 of thesis Finite Model Finding in
276
  Satisfiability Modulo Theories.
277
+ none
278
  Disable model-based quantifier instantiation.
279
+ trust
280
  Do not instantiate quantified formulas (incomplete technique).
281
)FOOBAR";
282
    std::exit(1);
283
  }
284
  throw OptionException(std::string("unknown option for --mbqi: `") +
285
                        optarg + "'.  Try --mbqi=help.");
286
}
287
std::ostream& operator<<(std::ostream& os, PrenexQuantMode mode)
288
{
289
  switch(mode)
290
  {
291
    case PrenexQuantMode::SIMPLE: return os << "simple";
292
    case PrenexQuantMode::NORMAL: return os << "norm";
293
    case PrenexQuantMode::NONE: return os << "none";
294
    default: Unreachable();
295
  }
296
  return os;
297
}
298
PrenexQuantMode stringToPrenexQuantMode(const std::string& optarg)
299
{
300
  if (optarg == "simple") return PrenexQuantMode::SIMPLE;
301
  else if (optarg == "norm") return PrenexQuantMode::NORMAL;
302
  else if (optarg == "none") return PrenexQuantMode::NONE;
303
  else if (optarg == "help")
304
  {
305
    std::cerr << R"FOOBAR(
306
  Prenex quantifiers modes.
307
Available modes for --prenex-quant are:
308
+ simple (default)
309
  Do simple prenexing of same sign quantifiers.
310
+ norm
311
  Prenex to prenex normal form.
312
+ none
313
  Do no prenex nested quantifiers.
314
)FOOBAR";
315
    std::exit(1);
316
  }
317
  throw OptionException(std::string("unknown option for --prenex-quant: `") +
318
                        optarg + "'.  Try --prenex-quant=help.");
319
}
320
std::ostream& operator<<(std::ostream& os, QcfMode mode)
321
{
322
  switch(mode)
323
  {
324
    case QcfMode::CONFLICT_ONLY: return os << "conflict";
325
    case QcfMode::PARTIAL: return os << "partial";
326
    case QcfMode::PROP_EQ: return os << "prop-eq";
327
    default: Unreachable();
328
  }
329
  return os;
330
}
331
QcfMode stringToQcfMode(const std::string& optarg)
332
{
333
  if (optarg == "conflict") return QcfMode::CONFLICT_ONLY;
334
  else if (optarg == "partial") return QcfMode::PARTIAL;
335
  else if (optarg == "prop-eq") return QcfMode::PROP_EQ;
336
  else if (optarg == "help")
337
  {
338
    std::cerr << R"FOOBAR(
339
  Quantifier conflict find modes.
340
Available modes for --quant-cf-mode are:
341
+ conflict
342
  Apply QCF algorithm to find conflicts only.
343
+ partial
344
  Use QCF for conflicts, propagations and heuristic instantiations.
345
+ prop-eq (default)
346
  Apply QCF algorithm to propagate equalities as well as conflicts.
347
)FOOBAR";
348
    std::exit(1);
349
  }
350
  throw OptionException(std::string("unknown option for --quant-cf-mode: `") +
351
                        optarg + "'.  Try --quant-cf-mode=help.");
352
}
353
std::ostream& operator<<(std::ostream& os, QcfWhenMode mode)
354
{
355
  switch(mode)
356
  {
357
    case QcfWhenMode::LAST_CALL: return os << "last-call";
358
    case QcfWhenMode::STD: return os << "std";
359
    case QcfWhenMode::STD_H: return os << "std-h";
360
    case QcfWhenMode::DEFAULT: return os << "default";
361
    default: Unreachable();
362
  }
363
  return os;
364
}
365
QcfWhenMode stringToQcfWhenMode(const std::string& optarg)
366
{
367
  if (optarg == "last-call") return QcfWhenMode::LAST_CALL;
368
  else if (optarg == "std") return QcfWhenMode::STD;
369
  else if (optarg == "std-h") return QcfWhenMode::STD_H;
370
  else if (optarg == "default") return QcfWhenMode::DEFAULT;
371
  else if (optarg == "help")
372
  {
373
    std::cerr << R"FOOBAR(
374
  Quantifier conflict find modes.
375
Available modes for --quant-cf-when are:
376
+ last-call
377
  Apply conflict finding at last call, after theory combination and and all
378
  theories report sat.
379
+ std
380
  Apply conflict finding at standard effort.
381
+ std-h
382
  Apply conflict finding at standard effort when heuristic says to.
383
+ default
384
  Default, apply conflict finding at full effort.
385
)FOOBAR";
386
    std::exit(1);
387
  }
388
  throw OptionException(std::string("unknown option for --quant-cf-when: `") +
389
                        optarg + "'.  Try --quant-cf-when=help.");
390
}
391
std::ostream& operator<<(std::ostream& os, QuantDSplitMode mode)
392
{
393
  switch(mode)
394
  {
395
    case QuantDSplitMode::AGG: return os << "agg";
396
    case QuantDSplitMode::NONE: return os << "none";
397
    case QuantDSplitMode::DEFAULT: return os << "default";
398
    default: Unreachable();
399
  }
400
  return os;
401
}
402
QuantDSplitMode stringToQuantDSplitMode(const std::string& optarg)
403
{
404
  if (optarg == "agg") return QuantDSplitMode::AGG;
405
  else if (optarg == "none") return QuantDSplitMode::NONE;
406
  else if (optarg == "default") return QuantDSplitMode::DEFAULT;
407
  else if (optarg == "help")
408
  {
409
    std::cerr << R"FOOBAR(
410
  Modes for quantifiers splitting.
411
Available modes for --quant-dsplit-mode are:
412
+ agg
413
  Aggressively split quantified formulas.
414
+ none
415
  Never split quantified formulas.
416
+ default
417
  Split quantified formulas over some finite datatypes when finite model finding
418
  is enabled.
419
)FOOBAR";
420
    std::exit(1);
421
  }
422
  throw OptionException(std::string("unknown option for --quant-dsplit-mode: `") +
423
                        optarg + "'.  Try --quant-dsplit-mode=help.");
424
}
425
std::ostream& operator<<(std::ostream& os, QuantRepMode mode)
426
{
427
  switch(mode)
428
  {
429
    case QuantRepMode::FIRST: return os << "first";
430
    case QuantRepMode::DEPTH: return os << "depth";
431
    case QuantRepMode::EE: return os << "ee";
432
    default: Unreachable();
433
  }
434
  return os;
435
}
436
QuantRepMode stringToQuantRepMode(const std::string& optarg)
437
{
438
  if (optarg == "first") return QuantRepMode::FIRST;
439
  else if (optarg == "depth") return QuantRepMode::DEPTH;
440
  else if (optarg == "ee") return QuantRepMode::EE;
441
  else if (optarg == "help")
442
  {
443
    std::cerr << R"FOOBAR(
444
  Modes for quantifiers representative selection.
445
Available modes for --quant-rep-mode are:
446
+ first (default)
447
  Choose terms that appear first.
448
+ depth
449
  Choose terms that are of minimal depth.
450
+ ee
451
  Let equality engine choose representatives.
452
)FOOBAR";
453
    std::exit(1);
454
  }
455
  throw OptionException(std::string("unknown option for --quant-rep-mode: `") +
456
                        optarg + "'.  Try --quant-rep-mode=help.");
457
}
458
std::ostream& operator<<(std::ostream& os, SygusActiveGenMode mode)
459
{
460
  switch(mode)
461
  {
462
    case SygusActiveGenMode::ENUM_BASIC: return os << "basic";
463
    case SygusActiveGenMode::VAR_AGNOSTIC: return os << "var-agnostic";
464
    case SygusActiveGenMode::AUTO: return os << "auto";
465
    case SygusActiveGenMode::NONE: return os << "none";
466
    case SygusActiveGenMode::ENUM: return os << "enum";
467
    default: Unreachable();
468
  }
469
  return os;
470
}
471
20
SygusActiveGenMode stringToSygusActiveGenMode(const std::string& optarg)
472
{
473
20
  if (optarg == "basic") return SygusActiveGenMode::ENUM_BASIC;
474
20
  else if (optarg == "var-agnostic") return SygusActiveGenMode::VAR_AGNOSTIC;
475
18
  else if (optarg == "auto") return SygusActiveGenMode::AUTO;
476
18
  else if (optarg == "none") return SygusActiveGenMode::NONE;
477
12
  else if (optarg == "enum") return SygusActiveGenMode::ENUM;
478
  else if (optarg == "help")
479
  {
480
    std::cerr << R"FOOBAR(
481
  Modes for actively-generated sygus enumerators.
482
Available modes for --sygus-active-gen are:
483
+ basic
484
  Use basic type enumerator for actively-generated sygus enumerators.
485
+ var-agnostic
486
  Use sygus solver to enumerate terms that are agnostic to variables.
487
+ auto (default)
488
  Internally decide the best policy for each enumerator.
489
+ none
490
  Do not use actively-generated sygus enumerators.
491
+ enum
492
  Use optimized enumerator for actively-generated sygus enumerators.
493
)FOOBAR";
494
    std::exit(1);
495
  }
496
  throw OptionException(std::string("unknown option for --sygus-active-gen: `") +
497
                        optarg + "'.  Try --sygus-active-gen=help.");
498
}
499
std::ostream& operator<<(std::ostream& os, SygusFilterSolMode mode)
500
{
501
  switch(mode)
502
  {
503
    case SygusFilterSolMode::STRONG: return os << "strong";
504
    case SygusFilterSolMode::NONE: return os << "none";
505
    case SygusFilterSolMode::WEAK: return os << "weak";
506
    default: Unreachable();
507
  }
508
  return os;
509
}
510
SygusFilterSolMode stringToSygusFilterSolMode(const std::string& optarg)
511
{
512
  if (optarg == "strong") return SygusFilterSolMode::STRONG;
513
  else if (optarg == "none") return SygusFilterSolMode::NONE;
514
  else if (optarg == "weak") return SygusFilterSolMode::WEAK;
515
  else if (optarg == "help")
516
  {
517
    std::cerr << R"FOOBAR(
518
  Modes for filtering sygus solutions.
519
Available modes for --sygus-filter-sol are:
520
+ strong
521
  Filter solutions that are logically stronger than others.
522
+ none (default)
523
  Do not filter sygus solutions.
524
+ weak
525
  Filter solutions that are logically weaker than others.
526
)FOOBAR";
527
    std::exit(1);
528
  }
529
  throw OptionException(std::string("unknown option for --sygus-filter-sol: `") +
530
                        optarg + "'.  Try --sygus-filter-sol=help.");
531
}
532
std::ostream& operator<<(std::ostream& os, SygusGrammarConsMode mode)
533
{
534
  switch(mode)
535
  {
536
    case SygusGrammarConsMode::ANY_TERM_CONCISE: return os << "any-term-concise";
537
    case SygusGrammarConsMode::SIMPLE: return os << "simple";
538
    case SygusGrammarConsMode::ANY_CONST: return os << "any-const";
539
    case SygusGrammarConsMode::ANY_TERM: return os << "any-term";
540
    default: Unreachable();
541
  }
542
  return os;
543
}
544
12
SygusGrammarConsMode stringToSygusGrammarConsMode(const std::string& optarg)
545
{
546
12
  if (optarg == "any-term-concise") return SygusGrammarConsMode::ANY_TERM_CONCISE;
547
8
  else if (optarg == "simple") return SygusGrammarConsMode::SIMPLE;
548
8
  else if (optarg == "any-const") return SygusGrammarConsMode::ANY_CONST;
549
4
  else if (optarg == "any-term") return SygusGrammarConsMode::ANY_TERM;
550
  else if (optarg == "help")
551
  {
552
    std::cerr << R"FOOBAR(
553
  Modes for default SyGuS grammars.
554
Available modes for --sygus-grammar-cons are:
555
+ any-term-concise
556
  When applicable, use constructors corresponding to any symbolic term, favoring
557
  conciseness over generality. This option is equivalent to any-term but enables
558
  a polynomial grammar for arithmetic when not in a combined theory.
559
+ simple (default)
560
  Use simple grammar construction (no symbolic terms or constants).
561
+ any-const
562
  Use symoblic constant constructors.
563
+ any-term
564
  When applicable, use constructors corresponding to any symbolic term. This
565
  option enables a sum-of-monomials grammar for arithmetic. For all other types,
566
  it enables symbolic constant constructors.
567
)FOOBAR";
568
    std::exit(1);
569
  }
570
  throw OptionException(std::string("unknown option for --sygus-grammar-cons: `") +
571
                        optarg + "'.  Try --sygus-grammar-cons=help.");
572
}
573
std::ostream& operator<<(std::ostream& os, SygusInstMode mode)
574
{
575
  switch(mode)
576
  {
577
    case SygusInstMode::INTERLEAVE: return os << "interleave";
578
    case SygusInstMode::PRIORITY_EVAL: return os << "priority-eval";
579
    case SygusInstMode::PRIORITY_INST: return os << "priority-inst";
580
    default: Unreachable();
581
  }
582
  return os;
583
}
584
SygusInstMode stringToSygusInstMode(const std::string& optarg)
585
{
586
  if (optarg == "interleave") return SygusInstMode::INTERLEAVE;
587
  else if (optarg == "priority-eval") return SygusInstMode::PRIORITY_EVAL;
588
  else if (optarg == "priority-inst") return SygusInstMode::PRIORITY_INST;
589
  else if (optarg == "help")
590
  {
591
    std::cerr << R"FOOBAR(
592
  SyGuS instantiation lemma modes.
593
Available modes for --sygus-inst-mode are:
594
+ interleave
595
  add instantiation and evaluation unfolding lemmas in the same step.
596
+ priority-eval
597
  add evaluation unfolding lemma first, add instantiation lemma if unfolding
598
  lemmas already added.
599
+ priority-inst (default)
600
  add instantiation lemmas first, add evaluation unfolding if instantiation
601
  fails.
602
)FOOBAR";
603
    std::exit(1);
604
  }
605
  throw OptionException(std::string("unknown option for --sygus-inst-mode: `") +
606
                        optarg + "'.  Try --sygus-inst-mode=help.");
607
}
608
std::ostream& operator<<(std::ostream& os, SygusInstScope mode)
609
{
610
  switch(mode)
611
  {
612
    case SygusInstScope::IN: return os << "in";
613
    case SygusInstScope::OUT: return os << "out";
614
    case SygusInstScope::BOTH: return os << "both";
615
    default: Unreachable();
616
  }
617
  return os;
618
}
619
SygusInstScope stringToSygusInstScope(const std::string& optarg)
620
{
621
  if (optarg == "in") return SygusInstScope::IN;
622
  else if (optarg == "out") return SygusInstScope::OUT;
623
  else if (optarg == "both") return SygusInstScope::BOTH;
624
  else if (optarg == "help")
625
  {
626
    std::cerr << R"FOOBAR(
627
  scope for collecting ground terms for the grammar.
628
Available modes for --sygus-inst-scope are:
629
+ in (default)
630
  use ground terms inside given quantified formula only.
631
+ out
632
  use ground terms outside of quantified formulas only.
633
+ both
634
  combines inside and outside.
635
)FOOBAR";
636
    std::exit(1);
637
  }
638
  throw OptionException(std::string("unknown option for --sygus-inst-scope: `") +
639
                        optarg + "'.  Try --sygus-inst-scope=help.");
640
}
641
std::ostream& operator<<(std::ostream& os, SygusInstTermSelMode mode)
642
{
643
  switch(mode)
644
  {
645
    case SygusInstTermSelMode::BOTH: return os << "both";
646
    case SygusInstTermSelMode::MIN: return os << "min";
647
    case SygusInstTermSelMode::MAX: return os << "max";
648
    default: Unreachable();
649
  }
650
  return os;
651
}
652
SygusInstTermSelMode stringToSygusInstTermSelMode(const std::string& optarg)
653
{
654
  if (optarg == "both") return SygusInstTermSelMode::BOTH;
655
  else if (optarg == "min") return SygusInstTermSelMode::MIN;
656
  else if (optarg == "max") return SygusInstTermSelMode::MAX;
657
  else if (optarg == "help")
658
  {
659
    std::cerr << R"FOOBAR(
660
  Ground term selection modes.
661
Available modes for --sygus-inst-term-sel are:
662
+ both
663
  combines minimal and maximal .
664
+ min (default)
665
  collect minimal ground terms only.
666
+ max
667
  collect maximal ground terms only.
668
)FOOBAR";
669
    std::exit(1);
670
  }
671
  throw OptionException(std::string("unknown option for --sygus-inst-term-sel: `") +
672
                        optarg + "'.  Try --sygus-inst-term-sel=help.");
673
}
674
std::ostream& operator<<(std::ostream& os, SygusInvTemplMode mode)
675
{
676
  switch(mode)
677
  {
678
    case SygusInvTemplMode::POST: return os << "post";
679
    case SygusInvTemplMode::PRE: return os << "pre";
680
    case SygusInvTemplMode::NONE: return os << "none";
681
    default: Unreachable();
682
  }
683
  return os;
684
}
685
6
SygusInvTemplMode stringToSygusInvTemplMode(const std::string& optarg)
686
{
687
6
  if (optarg == "post") return SygusInvTemplMode::POST;
688
2
  else if (optarg == "pre") return SygusInvTemplMode::PRE;
689
  else if (optarg == "none") return SygusInvTemplMode::NONE;
690
  else if (optarg == "help")
691
  {
692
    std::cerr << R"FOOBAR(
693
  Template modes for sygus invariant synthesis.
694
Available modes for --sygus-inv-templ are:
695
+ post (default)
696
  Synthesize invariant based on strengthening of postcondition.
697
+ pre
698
  Synthesize invariant based on weakening of precondition.
699
+ none
700
  Synthesize invariant directly.
701
)FOOBAR";
702
    std::exit(1);
703
  }
704
  throw OptionException(std::string("unknown option for --sygus-inv-templ: `") +
705
                        optarg + "'.  Try --sygus-inv-templ=help.");
706
}
707
std::ostream& operator<<(std::ostream& os, SygusQueryGenMode mode)
708
{
709
  switch(mode)
710
  {
711
    case SygusQueryGenMode::NONE: return os << "none";
712
    case SygusQueryGenMode::UNSAT: return os << "unsat";
713
    case SygusQueryGenMode::SAT: return os << "sat";
714
    default: Unreachable();
715
  }
716
  return os;
717
}
718
2
SygusQueryGenMode stringToSygusQueryGenMode(const std::string& optarg)
719
{
720
2
  if (optarg == "none") return SygusQueryGenMode::NONE;
721
2
  else if (optarg == "unsat") return SygusQueryGenMode::UNSAT;
722
  else if (optarg == "sat") return SygusQueryGenMode::SAT;
723
  else if (optarg == "help")
724
  {
725
    std::cerr << R"FOOBAR(
726
  Modes for generating interesting satisfiability queries using SyGuS.
727
Available modes for --sygus-query-gen are:
728
+ none (default)
729
  Do not generate queries with SyGuS.
730
+ unsat
731
  Generate interesting UNSAT queries, for e.g. proof testing.
732
+ sat
733
  Generate interesting SAT queries, for e.g. soundness testing.
734
)FOOBAR";
735
    std::exit(1);
736
  }
737
  throw OptionException(std::string("unknown option for --sygus-query-gen: `") +
738
                        optarg + "'.  Try --sygus-query-gen=help.");
739
}
740
std::ostream& operator<<(std::ostream& os, SygusQueryDumpFilesMode mode)
741
{
742
  switch(mode)
743
  {
744
    case SygusQueryDumpFilesMode::UNSOLVED: return os << "unsolved";
745
    case SygusQueryDumpFilesMode::ALL: return os << "all";
746
    case SygusQueryDumpFilesMode::NONE: return os << "none";
747
    default: Unreachable();
748
  }
749
  return os;
750
}
751
SygusQueryDumpFilesMode stringToSygusQueryDumpFilesMode(const std::string& optarg)
752
{
753
  if (optarg == "unsolved") return SygusQueryDumpFilesMode::UNSOLVED;
754
  else if (optarg == "all") return SygusQueryDumpFilesMode::ALL;
755
  else if (optarg == "none") return SygusQueryDumpFilesMode::NONE;
756
  else if (optarg == "help")
757
  {
758
    std::cerr << R"FOOBAR(
759
  Query file options.
760
Available modes for --sygus-query-gen-dump-files are:
761
+ unsolved
762
  Dump query files that the subsolver did not solve.
763
+ all
764
  Dump all query files.
765
+ none (default)
766
  Do not dump query files when using --sygus-query-gen.
767
)FOOBAR";
768
    std::exit(1);
769
  }
770
  throw OptionException(std::string("unknown option for --sygus-query-gen-dump-files: `") +
771
                        optarg + "'.  Try --sygus-query-gen-dump-files=help.");
772
}
773
std::ostream& operator<<(std::ostream& os, CegqiSingleInvMode mode)
774
{
775
  switch(mode)
776
  {
777
    case CegqiSingleInvMode::USE: return os << "use";
778
    case CegqiSingleInvMode::ALL: return os << "all";
779
    case CegqiSingleInvMode::NONE: return os << "none";
780
    default: Unreachable();
781
  }
782
  return os;
783
}
784
92
CegqiSingleInvMode stringToCegqiSingleInvMode(const std::string& optarg)
785
{
786
92
  if (optarg == "use") return CegqiSingleInvMode::USE;
787
92
  else if (optarg == "all") return CegqiSingleInvMode::ALL;
788
42
  else if (optarg == "none") return CegqiSingleInvMode::NONE;
789
  else if (optarg == "help")
790
  {
791
    std::cerr << R"FOOBAR(
792
  Modes for single invocation techniques.
793
Available modes for --sygus-si are:
794
+ use
795
  Use single invocation techniques only if grammar is not restrictive.
796
+ all
797
  Always use single invocation techniques.
798
+ none (default)
799
  Do not use single invocation techniques.
800
)FOOBAR";
801
    std::exit(1);
802
  }
803
  throw OptionException(std::string("unknown option for --sygus-si: `") +
804
                        optarg + "'.  Try --sygus-si=help.");
805
}
806
std::ostream& operator<<(std::ostream& os, CegqiSingleInvRconsMode mode)
807
{
808
  switch(mode)
809
  {
810
    case CegqiSingleInvRconsMode::ALL_LIMIT: return os << "all-limit";
811
    case CegqiSingleInvRconsMode::TRY: return os << "try";
812
    case CegqiSingleInvRconsMode::NONE: return os << "none";
813
    case CegqiSingleInvRconsMode::ALL: return os << "all";
814
    default: Unreachable();
815
  }
816
  return os;
817
}
818
CegqiSingleInvRconsMode stringToCegqiSingleInvRconsMode(const std::string& optarg)
819
{
820
  if (optarg == "all-limit") return CegqiSingleInvRconsMode::ALL_LIMIT;
821
  else if (optarg == "try") return CegqiSingleInvRconsMode::TRY;
822
  else if (optarg == "none") return CegqiSingleInvRconsMode::NONE;
823
  else if (optarg == "all") return CegqiSingleInvRconsMode::ALL;
824
  else if (optarg == "help")
825
  {
826
    std::cerr << R"FOOBAR(
827
  Modes for reconstruction solutions while using single invocation techniques.
828
Available modes for --sygus-si-rcons are:
829
+ all-limit (default)
830
  Try to reconstruct solutions in the original grammar, but termintate if a
831
  maximum number of rounds for reconstruction is exceeded.
832
+ try
833
  Try to reconstruct solutions in the original grammar when using single
834
  invocation techniques in an incomplete (fail-fast) manner.
835
+ none
836
  Do not try to reconstruct solutions in the original (user-provided) grammar
837
  when using single invocation techniques. In this mode, solutions produced by
838
  cvc5 may violate grammar restrictions.
839
+ all
840
  Try to reconstruct solutions in the original grammar. In this mode, we do not
841
  terminate until a solution is successfully reconstructed.
842
)FOOBAR";
843
    std::exit(1);
844
  }
845
  throw OptionException(std::string("unknown option for --sygus-si-rcons: `") +
846
                        optarg + "'.  Try --sygus-si-rcons=help.");
847
}
848
std::ostream& operator<<(std::ostream& os, SygusUnifPiMode mode)
849
{
850
  switch(mode)
851
  {
852
    case SygusUnifPiMode::CENUM_IGAIN: return os << "cond-enum-igain";
853
    case SygusUnifPiMode::CENUM: return os << "cond-enum";
854
    case SygusUnifPiMode::COMPLETE: return os << "complete";
855
    case SygusUnifPiMode::NONE: return os << "none";
856
    default: Unreachable();
857
  }
858
  return os;
859
}
860
16
SygusUnifPiMode stringToSygusUnifPiMode(const std::string& optarg)
861
{
862
16
  if (optarg == "cond-enum-igain") return SygusUnifPiMode::CENUM_IGAIN;
863
16
  else if (optarg == "cond-enum") return SygusUnifPiMode::CENUM;
864
16
  else if (optarg == "complete") return SygusUnifPiMode::COMPLETE;
865
  else if (optarg == "none") return SygusUnifPiMode::NONE;
866
  else if (optarg == "help")
867
  {
868
    std::cerr << R"FOOBAR(
869
  Modes for piecewise-independent unification.
870
Available modes for --sygus-unif-pi are:
871
+ cond-enum-igain
872
  Same as cond-enum, but additionally uses an information gain heuristic when
873
  doing decision tree learning.
874
+ cond-enum
875
  Use unconstrained condition enumeration for piecewise-independent unification
876
  (see Section 4 of Barbosa et al FMCAD 2019).
877
+ complete
878
  Use complete approach for piecewise-independent unification (see Section 3 of
879
  Barbosa et al FMCAD 2019)
880
+ none (default)
881
  Do not use piecewise-independent unification.
882
)FOOBAR";
883
    std::exit(1);
884
  }
885
  throw OptionException(std::string("unknown option for --sygus-unif-pi: `") +
886
                        optarg + "'.  Try --sygus-unif-pi=help.");
887
}
888
std::ostream& operator<<(std::ostream& os, TermDbMode mode)
889
{
890
  switch(mode)
891
  {
892
    case TermDbMode::ALL: return os << "all";
893
    case TermDbMode::RELEVANT: return os << "relevant";
894
    default: Unreachable();
895
  }
896
  return os;
897
}
898
TermDbMode stringToTermDbMode(const std::string& optarg)
899
{
900
  if (optarg == "all") return TermDbMode::ALL;
901
  else if (optarg == "relevant") return TermDbMode::RELEVANT;
902
  else if (optarg == "help")
903
  {
904
    std::cerr << R"FOOBAR(
905
  Modes for terms included in the quantifiers term database.
906
Available modes for --term-db-mode are:
907
+ all (default)
908
  Quantifiers module considers all ground terms.
909
+ relevant
910
  Quantifiers module considers only ground terms connected to current
911
  assertions.
912
)FOOBAR";
913
    std::exit(1);
914
  }
915
  throw OptionException(std::string("unknown option for --term-db-mode: `") +
916
                        optarg + "'.  Try --term-db-mode=help.");
917
}
918
std::ostream& operator<<(std::ostream& os, TriggerActiveSelMode mode)
919
{
920
  switch(mode)
921
  {
922
    case TriggerActiveSelMode::MIN: return os << "min";
923
    case TriggerActiveSelMode::ALL: return os << "all";
924
    case TriggerActiveSelMode::MAX: return os << "max";
925
    default: Unreachable();
926
  }
927
  return os;
928
}
929
TriggerActiveSelMode stringToTriggerActiveSelMode(const std::string& optarg)
930
{
931
  if (optarg == "min") return TriggerActiveSelMode::MIN;
932
  else if (optarg == "all") return TriggerActiveSelMode::ALL;
933
  else if (optarg == "max") return TriggerActiveSelMode::MAX;
934
  else if (optarg == "help")
935
  {
936
    std::cerr << R"FOOBAR(
937
  Trigger active selection modes.
938
Available modes for --trigger-active-sel are:
939
+ min
940
  Activate triggers with minimal ground terms.
941
+ all (default)
942
  Make all triggers active.
943
+ max
944
  Activate triggers with maximal ground terms.
945
)FOOBAR";
946
    std::exit(1);
947
  }
948
  throw OptionException(std::string("unknown option for --trigger-active-sel: `") +
949
                        optarg + "'.  Try --trigger-active-sel=help.");
950
}
951
std::ostream& operator<<(std::ostream& os, TriggerSelMode mode)
952
{
953
  switch(mode)
954
  {
955
    case TriggerSelMode::MIN_SINGLE_MAX: return os << "min-s-max";
956
    case TriggerSelMode::MIN: return os << "min";
957
    case TriggerSelMode::MAX: return os << "max";
958
    case TriggerSelMode::ALL: return os << "all";
959
    case TriggerSelMode::MIN_SINGLE_ALL: return os << "min-s-all";
960
    default: Unreachable();
961
  }
962
  return os;
963
}
964
TriggerSelMode stringToTriggerSelMode(const std::string& optarg)
965
{
966
  if (optarg == "min-s-max") return TriggerSelMode::MIN_SINGLE_MAX;
967
  else if (optarg == "min") return TriggerSelMode::MIN;
968
  else if (optarg == "max") return TriggerSelMode::MAX;
969
  else if (optarg == "all") return TriggerSelMode::ALL;
970
  else if (optarg == "min-s-all") return TriggerSelMode::MIN_SINGLE_ALL;
971
  else if (optarg == "help")
972
  {
973
    std::cerr << R"FOOBAR(
974
  Trigger selection modes.
975
Available modes for --trigger-sel are:
976
+ min-s-max
977
  Consider only minimal subterms that meet criteria for single triggers, maximal
978
  otherwise.
979
+ min (default)
980
  Consider only minimal subterms that meet criteria for triggers.
981
+ max
982
  Consider only maximal subterms that meet criteria for triggers.
983
+ all
984
  Consider all subterms that meet criteria for triggers.
985
+ min-s-all
986
  Consider only minimal subterms that meet criteria for single triggers, all
987
  otherwise.
988
)FOOBAR";
989
    std::exit(1);
990
  }
991
  throw OptionException(std::string("unknown option for --trigger-sel: `") +
992
                        optarg + "'.  Try --trigger-sel=help.");
993
}
994
std::ostream& operator<<(std::ostream& os, UserPatMode mode)
995
{
996
  switch(mode)
997
  {
998
    case UserPatMode::RESORT: return os << "resort";
999
    case UserPatMode::STRICT: return os << "strict";
1000
    case UserPatMode::USE: return os << "use";
1001
    case UserPatMode::INTERLEAVE: return os << "interleave";
1002
    case UserPatMode::IGNORE: return os << "ignore";
1003
    case UserPatMode::TRUST: return os << "trust";
1004
    default: Unreachable();
1005
  }
1006
  return os;
1007
}
1008
3
UserPatMode stringToUserPatMode(const std::string& optarg)
1009
{
1010
3
  if (optarg == "resort") return UserPatMode::RESORT;
1011
3
  else if (optarg == "strict") return UserPatMode::STRICT;
1012
3
  else if (optarg == "use") return UserPatMode::USE;
1013
  else if (optarg == "interleave") return UserPatMode::INTERLEAVE;
1014
  else if (optarg == "ignore") return UserPatMode::IGNORE;
1015
  else if (optarg == "trust") return UserPatMode::TRUST;
1016
  else if (optarg == "help")
1017
  {
1018
    std::cerr << R"FOOBAR(
1019
  These modes determine how user provided patterns (triggers) are used during
1020
  E-matching. The modes vary on when instantiation based on user-provided
1021
  triggers is combined with instantiation based on automatically selected
1022
  triggers.
1023
Available modes for --user-pat are:
1024
+ resort
1025
  Use user-provided patterns only after auto-generated patterns saturate.
1026
+ strict
1027
  When provided, use only user-provided patterns for a quantified formula, and
1028
  do not use any other instantiation techniques.
1029
+ use
1030
  Use both user-provided and auto-generated patterns when patterns are provided
1031
  for a quantified formula.
1032
+ interleave
1033
  Alternate between use/resort.
1034
+ ignore
1035
  Ignore user-provided patterns.
1036
+ trust (default)
1037
  When provided, use only user-provided patterns for a quantified formula.
1038
)FOOBAR";
1039
    std::exit(1);
1040
  }
1041
  throw OptionException(std::string("unknown option for --user-pat: `") +
1042
                        optarg + "'.  Try --user-pat=help.");
1043
}
1044
// clang-format on
1045
1046
31137
}  // namespace cvc5::options