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/smt_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, BlockModelsMode mode) |
29 |
|
{ |
30 |
|
switch(mode) |
31 |
|
{ |
32 |
|
case BlockModelsMode::VALUES: return os << "values"; |
33 |
|
case BlockModelsMode::LITERALS: return os << "literals"; |
34 |
|
case BlockModelsMode::NONE: return os << "none"; |
35 |
|
default: Unreachable(); |
36 |
|
} |
37 |
|
return os; |
38 |
|
} |
39 |
21 |
BlockModelsMode stringToBlockModelsMode(const std::string& optarg) |
40 |
|
{ |
41 |
21 |
if (optarg == "values") return BlockModelsMode::VALUES; |
42 |
18 |
else if (optarg == "literals") return BlockModelsMode::LITERALS; |
43 |
|
else if (optarg == "none") return BlockModelsMode::NONE; |
44 |
|
else if (optarg == "help") |
45 |
|
{ |
46 |
|
std::cerr << R"FOOBAR( |
47 |
|
Blocking models modes. |
48 |
|
Available modes for --block-models are: |
49 |
|
+ values |
50 |
|
Block models based on the concrete model values for the free variables. |
51 |
|
+ literals |
52 |
|
Block models based on the SAT skeleton. |
53 |
|
+ none (default) |
54 |
|
Do not block models. |
55 |
|
)FOOBAR"; |
56 |
|
std::exit(1); |
57 |
|
} |
58 |
|
throw OptionException(std::string("unknown option for --block-models: `") + |
59 |
|
optarg + "'. Try --block-models=help."); |
60 |
|
} |
61 |
|
std::ostream& operator<<(std::ostream& os, DifficultyMode mode) |
62 |
|
{ |
63 |
|
switch(mode) |
64 |
|
{ |
65 |
|
case DifficultyMode::LEMMA_LITERAL: return os << "lemma-literal"; |
66 |
|
case DifficultyMode::MODEL_CHECK: return os << "model-check"; |
67 |
|
default: Unreachable(); |
68 |
|
} |
69 |
|
return os; |
70 |
|
} |
71 |
|
DifficultyMode stringToDifficultyMode(const std::string& optarg) |
72 |
|
{ |
73 |
|
if (optarg == "lemma-literal") return DifficultyMode::LEMMA_LITERAL; |
74 |
|
else if (optarg == "model-check") return DifficultyMode::MODEL_CHECK; |
75 |
|
else if (optarg == "help") |
76 |
|
{ |
77 |
|
std::cerr << R"FOOBAR( |
78 |
|
difficulty output modes. |
79 |
|
Available modes for --difficulty-mode are: |
80 |
|
+ lemma-literal (default) |
81 |
|
Difficulty of an assertion is how many lemmas use a literal that the assertion |
82 |
|
depends on to be satisfied. |
83 |
|
+ model-check |
84 |
|
Difficulty of an assertion is how many times it was not satisfied in a |
85 |
|
candidate model. |
86 |
|
)FOOBAR"; |
87 |
|
std::exit(1); |
88 |
|
} |
89 |
|
throw OptionException(std::string("unknown option for --difficulty-mode: `") + |
90 |
|
optarg + "'. Try --difficulty-mode=help."); |
91 |
|
} |
92 |
|
std::ostream& operator<<(std::ostream& os, IandMode mode) |
93 |
|
{ |
94 |
|
switch(mode) |
95 |
|
{ |
96 |
|
case IandMode::SUM: return os << "sum"; |
97 |
|
case IandMode::VALUE: return os << "value"; |
98 |
|
case IandMode::BITWISE: return os << "bitwise"; |
99 |
|
default: Unreachable(); |
100 |
|
} |
101 |
|
return os; |
102 |
|
} |
103 |
62 |
IandMode stringToIandMode(const std::string& optarg) |
104 |
|
{ |
105 |
62 |
if (optarg == "sum") return IandMode::SUM; |
106 |
46 |
else if (optarg == "value") return IandMode::VALUE; |
107 |
30 |
else if (optarg == "bitwise") return IandMode::BITWISE; |
108 |
|
else if (optarg == "help") |
109 |
|
{ |
110 |
|
std::cerr << R"FOOBAR( |
111 |
|
Refinement modes for integer AND |
112 |
|
Available modes for --iand-mode are: |
113 |
|
+ sum |
114 |
|
use sum to represent integer AND in refinement |
115 |
|
+ value (default) |
116 |
|
value-based refinement |
117 |
|
+ bitwise |
118 |
|
use bitwise comparisons on binary representation of integer for refinement |
119 |
|
(experimental) |
120 |
|
)FOOBAR"; |
121 |
|
std::exit(1); |
122 |
|
} |
123 |
|
throw OptionException(std::string("unknown option for --iand-mode: `") + |
124 |
|
optarg + "'. Try --iand-mode=help."); |
125 |
|
} |
126 |
|
std::ostream& operator<<(std::ostream& os, ModelCoresMode mode) |
127 |
|
{ |
128 |
|
switch(mode) |
129 |
|
{ |
130 |
|
case ModelCoresMode::SIMPLE: return os << "simple"; |
131 |
|
case ModelCoresMode::NONE: return os << "none"; |
132 |
|
case ModelCoresMode::NON_IMPLIED: return os << "non-implied"; |
133 |
|
default: Unreachable(); |
134 |
|
} |
135 |
|
return os; |
136 |
|
} |
137 |
8 |
ModelCoresMode stringToModelCoresMode(const std::string& optarg) |
138 |
|
{ |
139 |
8 |
if (optarg == "simple") return ModelCoresMode::SIMPLE; |
140 |
4 |
else if (optarg == "none") return ModelCoresMode::NONE; |
141 |
4 |
else if (optarg == "non-implied") return ModelCoresMode::NON_IMPLIED; |
142 |
|
else if (optarg == "help") |
143 |
|
{ |
144 |
|
std::cerr << R"FOOBAR( |
145 |
|
Model cores modes. |
146 |
|
Available modes for --model-cores are: |
147 |
|
+ simple |
148 |
|
Only include a subset of variables whose values are sufficient to show the |
149 |
|
input formula is satisfied by the given model. |
150 |
|
+ none (default) |
151 |
|
Do not compute model cores. |
152 |
|
+ non-implied |
153 |
|
Only include a subset of variables whose values, in addition to the values of |
154 |
|
variables whose values are implied, are sufficient to show the input formula |
155 |
|
is satisfied by the given model. |
156 |
|
)FOOBAR"; |
157 |
|
std::exit(1); |
158 |
|
} |
159 |
|
throw OptionException(std::string("unknown option for --model-cores: `") + |
160 |
|
optarg + "'. Try --model-cores=help."); |
161 |
|
} |
162 |
|
std::ostream& operator<<(std::ostream& os, ModelUninterpPrintMode mode) |
163 |
|
{ |
164 |
|
switch(mode) |
165 |
|
{ |
166 |
|
case ModelUninterpPrintMode::None: return os << "none"; |
167 |
|
case ModelUninterpPrintMode::DeclSortAndFun: return os << "decl-sort-and-fun"; |
168 |
|
case ModelUninterpPrintMode::DeclFun: return os << "decl-fun"; |
169 |
|
default: Unreachable(); |
170 |
|
} |
171 |
|
return os; |
172 |
|
} |
173 |
1 |
ModelUninterpPrintMode stringToModelUninterpPrintMode(const std::string& optarg) |
174 |
|
{ |
175 |
1 |
if (optarg == "none") return ModelUninterpPrintMode::None; |
176 |
1 |
else if (optarg == "decl-sort-and-fun") return ModelUninterpPrintMode::DeclSortAndFun; |
177 |
1 |
else if (optarg == "decl-fun") return ModelUninterpPrintMode::DeclFun; |
178 |
|
else if (optarg == "help") |
179 |
|
{ |
180 |
|
std::cerr << R"FOOBAR( |
181 |
|
uninterpreted elements in models printing modes. |
182 |
|
Available modes for --model-u-print are: |
183 |
|
+ none (default) |
184 |
|
(default) do not print declarations of uninterpreted elements in models. |
185 |
|
+ decl-sort-and-fun |
186 |
|
print uninterpreted elements declare-fun, and also include a declare-sort for |
187 |
|
the sort |
188 |
|
+ decl-fun |
189 |
|
print uninterpreted elements declare-fun, but don't include a declare-sort for |
190 |
|
the sort |
191 |
|
)FOOBAR"; |
192 |
|
std::exit(1); |
193 |
|
} |
194 |
|
throw OptionException(std::string("unknown option for --model-u-print: `") + |
195 |
|
optarg + "'. Try --model-u-print=help."); |
196 |
|
} |
197 |
|
std::ostream& operator<<(std::ostream& os, ProduceInterpols mode) |
198 |
|
{ |
199 |
|
switch(mode) |
200 |
|
{ |
201 |
|
case ProduceInterpols::CONJECTURE: return os << "conjecture"; |
202 |
|
case ProduceInterpols::ASSUMPTIONS: return os << "assumptions"; |
203 |
|
case ProduceInterpols::DEFAULT: return os << "default"; |
204 |
|
case ProduceInterpols::SHARED: return os << "shared"; |
205 |
|
case ProduceInterpols::NONE: return os << "none"; |
206 |
|
case ProduceInterpols::ALL: return os << "all"; |
207 |
|
default: Unreachable(); |
208 |
|
} |
209 |
|
return os; |
210 |
|
} |
211 |
11 |
ProduceInterpols stringToProduceInterpols(const std::string& optarg) |
212 |
|
{ |
213 |
11 |
if (optarg == "conjecture") return ProduceInterpols::CONJECTURE; |
214 |
9 |
else if (optarg == "assumptions") return ProduceInterpols::ASSUMPTIONS; |
215 |
9 |
else if (optarg == "default") return ProduceInterpols::DEFAULT; |
216 |
|
else if (optarg == "shared") return ProduceInterpols::SHARED; |
217 |
|
else if (optarg == "none") return ProduceInterpols::NONE; |
218 |
|
else if (optarg == "all") return ProduceInterpols::ALL; |
219 |
|
else if (optarg == "help") |
220 |
|
{ |
221 |
|
std::cerr << R"FOOBAR( |
222 |
|
Interpolants grammar mode |
223 |
|
Available modes for --produce-interpols are: |
224 |
|
+ conjecture |
225 |
|
use only operators that occur in the conjecture |
226 |
|
+ assumptions |
227 |
|
use only operators that occur in the assumptions |
228 |
|
+ default |
229 |
|
use the default grammar for the theory or the user-defined grammar if given |
230 |
|
+ shared |
231 |
|
use only operators that occur both in the assumptions and the conjecture |
232 |
|
+ none (default) |
233 |
|
don't compute interpolants |
234 |
|
+ all |
235 |
|
use only operators that occur either in the assumptions or the conjecture |
236 |
|
)FOOBAR"; |
237 |
|
std::exit(1); |
238 |
|
} |
239 |
|
throw OptionException(std::string("unknown option for --produce-interpols: `") + |
240 |
|
optarg + "'. Try --produce-interpols=help."); |
241 |
|
} |
242 |
1 |
std::ostream& operator<<(std::ostream& os, SimplificationMode mode) |
243 |
|
{ |
244 |
1 |
switch(mode) |
245 |
|
{ |
246 |
1 |
case SimplificationMode::NONE: return os << "none"; |
247 |
|
case SimplificationMode::BATCH: return os << "batch"; |
248 |
|
default: Unreachable(); |
249 |
|
} |
250 |
|
return os; |
251 |
|
} |
252 |
34 |
SimplificationMode stringToSimplificationMode(const std::string& optarg) |
253 |
|
{ |
254 |
34 |
if (optarg == "none") return SimplificationMode::NONE; |
255 |
|
else if (optarg == "batch") return SimplificationMode::BATCH; |
256 |
|
else if (optarg == "help") |
257 |
|
{ |
258 |
|
std::cerr << R"FOOBAR( |
259 |
|
Simplification modes. |
260 |
|
Available modes for --simplification are: |
261 |
|
+ none |
262 |
|
Do not perform nonclausal simplification. |
263 |
|
+ batch (default) |
264 |
|
Save up all ASSERTions; run nonclausal simplification and clausal (MiniSat) |
265 |
|
propagation for all of them only after reaching a querying command (CHECKSAT |
266 |
|
or QUERY or predicate SUBTYPE declaration). |
267 |
|
)FOOBAR"; |
268 |
|
std::exit(1); |
269 |
|
} |
270 |
|
throw OptionException(std::string("unknown option for --simplification: `") + |
271 |
|
optarg + "'. Try --simplification=help."); |
272 |
|
} |
273 |
|
std::ostream& operator<<(std::ostream& os, SolveBVAsIntMode mode) |
274 |
|
{ |
275 |
|
switch(mode) |
276 |
|
{ |
277 |
|
case SolveBVAsIntMode::SUM: return os << "sum"; |
278 |
|
case SolveBVAsIntMode::OFF: return os << "off"; |
279 |
|
case SolveBVAsIntMode::IAND: return os << "iand"; |
280 |
|
case SolveBVAsIntMode::BV: return os << "bv"; |
281 |
|
default: Unreachable(); |
282 |
|
} |
283 |
|
return os; |
284 |
|
} |
285 |
139 |
SolveBVAsIntMode stringToSolveBVAsIntMode(const std::string& optarg) |
286 |
|
{ |
287 |
139 |
if (optarg == "sum") return SolveBVAsIntMode::SUM; |
288 |
46 |
else if (optarg == "off") return SolveBVAsIntMode::OFF; |
289 |
46 |
else if (optarg == "iand") return SolveBVAsIntMode::IAND; |
290 |
19 |
else if (optarg == "bv") return SolveBVAsIntMode::BV; |
291 |
|
else if (optarg == "help") |
292 |
|
{ |
293 |
|
std::cerr << R"FOOBAR( |
294 |
|
solve-bv-as-int modes. |
295 |
|
Available modes for --solve-bv-as-int are: |
296 |
|
+ sum |
297 |
|
Generate a sum expression for each bvand instance, based on the value in |
298 |
|
--solbv-bv-as-int-granularity |
299 |
|
+ off (default) |
300 |
|
Do not translate bit-vectors to integers |
301 |
|
+ iand |
302 |
|
Translate bvand to the iand operator (experimental) |
303 |
|
+ bv |
304 |
|
Translate bvand back to bit-vectors |
305 |
|
)FOOBAR"; |
306 |
|
std::exit(1); |
307 |
|
} |
308 |
|
throw OptionException(std::string("unknown option for --solve-bv-as-int: `") + |
309 |
|
optarg + "'. Try --solve-bv-as-int=help."); |
310 |
|
} |
311 |
|
std::ostream& operator<<(std::ostream& os, SygusSolutionOutMode mode) |
312 |
|
{ |
313 |
|
switch(mode) |
314 |
|
{ |
315 |
|
case SygusSolutionOutMode::STANDARD: return os << "sygus-standard"; |
316 |
|
case SygusSolutionOutMode::STATUS_AND_DEF: return os << "status-and-def"; |
317 |
|
case SygusSolutionOutMode::STATUS: return os << "status"; |
318 |
|
case SygusSolutionOutMode::STATUS_OR_DEF: return os << "status-or-def"; |
319 |
|
default: Unreachable(); |
320 |
|
} |
321 |
|
return os; |
322 |
|
} |
323 |
360 |
SygusSolutionOutMode stringToSygusSolutionOutMode(const std::string& optarg) |
324 |
|
{ |
325 |
360 |
if (optarg == "sygus-standard") return SygusSolutionOutMode::STANDARD; |
326 |
360 |
else if (optarg == "status-and-def") return SygusSolutionOutMode::STATUS_AND_DEF; |
327 |
360 |
else if (optarg == "status") return SygusSolutionOutMode::STATUS; |
328 |
|
else if (optarg == "status-or-def") return SygusSolutionOutMode::STATUS_OR_DEF; |
329 |
|
else if (optarg == "help") |
330 |
|
{ |
331 |
|
std::cerr << R"FOOBAR( |
332 |
|
Modes for sygus solution output. |
333 |
|
Available modes for --sygus-out are: |
334 |
|
+ sygus-standard (default) |
335 |
|
Print based on SyGuS standard. |
336 |
|
+ status-and-def |
337 |
|
Print status followed by definition corresponding to solution. |
338 |
|
+ status |
339 |
|
Print only status for check-synth calls. |
340 |
|
+ status-or-def |
341 |
|
Print status if infeasible, or definition corresponding to solution if |
342 |
|
feasible. |
343 |
|
)FOOBAR"; |
344 |
|
std::exit(1); |
345 |
|
} |
346 |
|
throw OptionException(std::string("unknown option for --sygus-out: `") + |
347 |
|
optarg + "'. Try --sygus-out=help."); |
348 |
|
} |
349 |
|
std::ostream& operator<<(std::ostream& os, UnsatCoresMode mode) |
350 |
|
{ |
351 |
|
switch(mode) |
352 |
|
{ |
353 |
|
case UnsatCoresMode::PP_ONLY: return os << "pp-only"; |
354 |
|
case UnsatCoresMode::FULL_PROOF: return os << "full-proof"; |
355 |
|
case UnsatCoresMode::OFF: return os << "off"; |
356 |
|
case UnsatCoresMode::ASSUMPTIONS: return os << "assumptions"; |
357 |
|
case UnsatCoresMode::SAT_PROOF: return os << "sat-proof"; |
358 |
|
default: Unreachable(); |
359 |
|
} |
360 |
|
return os; |
361 |
|
} |
362 |
2 |
UnsatCoresMode stringToUnsatCoresMode(const std::string& optarg) |
363 |
|
{ |
364 |
2 |
if (optarg == "pp-only") return UnsatCoresMode::PP_ONLY; |
365 |
2 |
else if (optarg == "full-proof") return UnsatCoresMode::FULL_PROOF; |
366 |
2 |
else if (optarg == "off") return UnsatCoresMode::OFF; |
367 |
2 |
else if (optarg == "assumptions") return UnsatCoresMode::ASSUMPTIONS; |
368 |
2 |
else if (optarg == "sat-proof") return UnsatCoresMode::SAT_PROOF; |
369 |
|
else if (optarg == "help") |
370 |
|
{ |
371 |
|
std::cerr << R"FOOBAR( |
372 |
|
unsat cores modes. |
373 |
|
Available modes for --unsat-cores-mode are: |
374 |
|
+ pp-only |
375 |
|
Not producing unsat cores, but tracking proofs of preprocessing (internal |
376 |
|
only). |
377 |
|
+ full-proof |
378 |
|
Produce unsat cores from full proofs. |
379 |
|
+ off (default) |
380 |
|
Do not produce unsat cores. |
381 |
|
+ assumptions |
382 |
|
Produce unsat cores using solving under assumptions and preprocessing proofs. |
383 |
|
+ sat-proof |
384 |
|
Produce unsat cores from SAT and preprocessing proofs. |
385 |
|
)FOOBAR"; |
386 |
|
std::exit(1); |
387 |
|
} |
388 |
|
throw OptionException(std::string("unknown option for --unsat-cores-mode: `") + |
389 |
|
optarg + "'. Try --unsat-cores-mode=help."); |
390 |
|
} |
391 |
|
// clang-format on |
392 |
|
|
393 |
31137 |
} // namespace cvc5::options |