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/datatypes_options.h" |
19 |
|
|
20 |
|
#include <iostream> |
21 |
|
|
22 |
|
#include "base/check.h" |
23 |
|
#include "options/option_exception.h" |
24 |
|
|
25 |
|
// clang-format off |
26 |
|
namespace cvc5::options { |
27 |
|
|
28 |
|
std::ostream& operator<<(std::ostream& os, SygusFairMode mode) |
29 |
|
{ |
30 |
|
switch(mode) { |
31 |
|
case SygusFairMode::DIRECT: |
32 |
|
return os << "SygusFairMode::DIRECT"; |
33 |
|
case SygusFairMode::DT_SIZE: |
34 |
|
return os << "SygusFairMode::DT_SIZE"; |
35 |
|
case SygusFairMode::DT_HEIGHT_PRED: |
36 |
|
return os << "SygusFairMode::DT_HEIGHT_PRED"; |
37 |
|
case SygusFairMode::NONE: |
38 |
|
return os << "SygusFairMode::NONE"; |
39 |
|
case SygusFairMode::DT_SIZE_PRED: |
40 |
|
return os << "SygusFairMode::DT_SIZE_PRED"; |
41 |
|
default: |
42 |
|
Unreachable(); |
43 |
|
} |
44 |
|
return os; |
45 |
|
} |
46 |
2 |
SygusFairMode stringToSygusFairMode(const std::string& optarg) |
47 |
|
{ |
48 |
2 |
if (optarg == "direct") |
49 |
|
{ |
50 |
2 |
return SygusFairMode::DIRECT; |
51 |
|
} |
52 |
|
else if (optarg == "dt-size") |
53 |
|
{ |
54 |
|
return SygusFairMode::DT_SIZE; |
55 |
|
} |
56 |
|
else if (optarg == "dt-height-bound") |
57 |
|
{ |
58 |
|
return SygusFairMode::DT_HEIGHT_PRED; |
59 |
|
} |
60 |
|
else if (optarg == "none") |
61 |
|
{ |
62 |
|
return SygusFairMode::NONE; |
63 |
|
} |
64 |
|
else if (optarg == "dt-size-bound") |
65 |
|
{ |
66 |
|
return SygusFairMode::DT_SIZE_PRED; |
67 |
|
} |
68 |
|
else if (optarg == "help") |
69 |
|
{ |
70 |
|
std::cerr << "Modes for enforcing fairness for counterexample guided quantifier instantion.\n" |
71 |
|
"Available modes for --sygus-fair are:\n" |
72 |
|
"+ direct\n" |
73 |
|
" Enforce fairness using direct conflict lemmas.\n" |
74 |
|
"+ dt-size (default)\n" |
75 |
|
" Enforce fairness using size operator.\n" |
76 |
|
"+ dt-height-bound\n" |
77 |
|
" Enforce fairness by height bound predicate.\n" |
78 |
|
"+ none\n" |
79 |
|
" Do not enforce fairness.\n" |
80 |
|
"+ dt-size-bound\n" |
81 |
|
" Enforce fairness by size bound predicate.\n"; |
82 |
|
std::exit(1); |
83 |
|
} |
84 |
|
throw OptionException(std::string("unknown option for --sygus-fair: `") + |
85 |
|
optarg + "'. Try --sygus-fair=help."); |
86 |
|
} |
87 |
|
|
88 |
|
namespace datatypes |
89 |
|
{ |
90 |
|
// clang-format off |
91 |
|
void setDefaultCdtBisimilar(Options& opts, bool value) |
92 |
|
{ |
93 |
|
if (!opts.datatypes.cdtBisimilarWasSetByUser) { |
94 |
|
opts.datatypes.cdtBisimilar = value; |
95 |
|
} |
96 |
|
} |
97 |
|
void setDefaultDtBinarySplit(Options& opts, bool value) |
98 |
|
{ |
99 |
|
if (!opts.datatypes.dtBinarySplitWasSetByUser) { |
100 |
|
opts.datatypes.dtBinarySplit = value; |
101 |
|
} |
102 |
|
} |
103 |
|
void setDefaultDtBlastSplits(Options& opts, bool value) |
104 |
|
{ |
105 |
|
if (!opts.datatypes.dtBlastSplitsWasSetByUser) { |
106 |
|
opts.datatypes.dtBlastSplits = value; |
107 |
|
} |
108 |
|
} |
109 |
|
void setDefaultDtCyclic(Options& opts, bool value) |
110 |
|
{ |
111 |
|
if (!opts.datatypes.dtCyclicWasSetByUser) { |
112 |
|
opts.datatypes.dtCyclic = value; |
113 |
|
} |
114 |
|
} |
115 |
|
void setDefaultDtForceAssignment(Options& opts, bool value) |
116 |
|
{ |
117 |
|
if (!opts.datatypes.dtForceAssignmentWasSetByUser) { |
118 |
|
opts.datatypes.dtForceAssignment = value; |
119 |
|
} |
120 |
|
} |
121 |
|
void setDefaultDtInferAsLemmas(Options& opts, bool value) |
122 |
|
{ |
123 |
|
if (!opts.datatypes.dtInferAsLemmasWasSetByUser) { |
124 |
|
opts.datatypes.dtInferAsLemmas = value; |
125 |
|
} |
126 |
|
} |
127 |
|
void setDefaultDtNestedRec(Options& opts, bool value) |
128 |
|
{ |
129 |
|
if (!opts.datatypes.dtNestedRecWasSetByUser) { |
130 |
|
opts.datatypes.dtNestedRec = value; |
131 |
|
} |
132 |
|
} |
133 |
|
void setDefaultDtPoliteOptimize(Options& opts, bool value) |
134 |
|
{ |
135 |
|
if (!opts.datatypes.dtPoliteOptimizeWasSetByUser) { |
136 |
|
opts.datatypes.dtPoliteOptimize = value; |
137 |
|
} |
138 |
|
} |
139 |
|
void setDefaultDtRewriteErrorSel(Options& opts, bool value) |
140 |
|
{ |
141 |
|
if (!opts.datatypes.dtRewriteErrorSelWasSetByUser) { |
142 |
|
opts.datatypes.dtRewriteErrorSel = value; |
143 |
|
} |
144 |
|
} |
145 |
|
void setDefaultDtSharedSelectors(Options& opts, bool value) |
146 |
|
{ |
147 |
|
if (!opts.datatypes.dtSharedSelectorsWasSetByUser) { |
148 |
|
opts.datatypes.dtSharedSelectors = value; |
149 |
|
} |
150 |
|
} |
151 |
|
void setDefaultSygusAbortSize(Options& opts, int64_t value) |
152 |
|
{ |
153 |
|
if (!opts.datatypes.sygusAbortSizeWasSetByUser) { |
154 |
|
opts.datatypes.sygusAbortSize = value; |
155 |
|
} |
156 |
|
} |
157 |
|
void setDefaultSygusFairMax(Options& opts, bool value) |
158 |
|
{ |
159 |
|
if (!opts.datatypes.sygusFairMaxWasSetByUser) { |
160 |
|
opts.datatypes.sygusFairMax = value; |
161 |
|
} |
162 |
|
} |
163 |
|
void setDefaultSygusFair(Options& opts, SygusFairMode value) |
164 |
|
{ |
165 |
|
if (!opts.datatypes.sygusFairWasSetByUser) { |
166 |
|
opts.datatypes.sygusFair = value; |
167 |
|
} |
168 |
|
} |
169 |
|
void setDefaultSygusSymBreak(Options& opts, bool value) |
170 |
|
{ |
171 |
|
if (!opts.datatypes.sygusSymBreakWasSetByUser) { |
172 |
|
opts.datatypes.sygusSymBreak = value; |
173 |
|
} |
174 |
|
} |
175 |
|
void setDefaultSygusSymBreakAgg(Options& opts, bool value) |
176 |
|
{ |
177 |
|
if (!opts.datatypes.sygusSymBreakAggWasSetByUser) { |
178 |
|
opts.datatypes.sygusSymBreakAgg = value; |
179 |
|
} |
180 |
|
} |
181 |
|
void setDefaultSygusSymBreakDynamic(Options& opts, bool value) |
182 |
|
{ |
183 |
|
if (!opts.datatypes.sygusSymBreakDynamicWasSetByUser) { |
184 |
|
opts.datatypes.sygusSymBreakDynamic = value; |
185 |
|
} |
186 |
|
} |
187 |
|
void setDefaultSygusSymBreakLazy(Options& opts, bool value) |
188 |
|
{ |
189 |
|
if (!opts.datatypes.sygusSymBreakLazyWasSetByUser) { |
190 |
|
opts.datatypes.sygusSymBreakLazy = value; |
191 |
|
} |
192 |
|
} |
193 |
|
void setDefaultSygusSymBreakPbe(Options& opts, bool value) |
194 |
|
{ |
195 |
|
if (!opts.datatypes.sygusSymBreakPbeWasSetByUser) { |
196 |
|
opts.datatypes.sygusSymBreakPbe = value; |
197 |
|
} |
198 |
|
} |
199 |
|
void setDefaultSygusSymBreakRlv(Options& opts, bool value) |
200 |
|
{ |
201 |
|
if (!opts.datatypes.sygusSymBreakRlvWasSetByUser) { |
202 |
|
opts.datatypes.sygusSymBreakRlv = value; |
203 |
|
} |
204 |
|
} |
205 |
|
// clang-format on |
206 |
|
} |
207 |
|
|
208 |
29349 |
} // namespace cvc5::options |
209 |
|
// clang-format on |