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 |
|
namespace cvc5::options { |
26 |
|
|
27 |
|
// clang-format off |
28 |
|
std::ostream& operator<<(std::ostream& os, SygusFairMode mode) |
29 |
|
{ |
30 |
|
switch(mode) |
31 |
|
{ |
32 |
|
case SygusFairMode::DT_SIZE_PRED: return os << "SygusFairMode::DT_SIZE_PRED"; |
33 |
|
case SygusFairMode::DT_SIZE: return os << "SygusFairMode::DT_SIZE"; |
34 |
|
case SygusFairMode::NONE: return os << "SygusFairMode::NONE"; |
35 |
|
case SygusFairMode::DT_HEIGHT_PRED: return os << "SygusFairMode::DT_HEIGHT_PRED"; |
36 |
|
case SygusFairMode::DIRECT: return os << "SygusFairMode::DIRECT"; |
37 |
|
default: Unreachable(); |
38 |
|
} |
39 |
|
return os; |
40 |
|
} |
41 |
2 |
SygusFairMode stringToSygusFairMode(const std::string& optarg) |
42 |
|
{ |
43 |
2 |
if (optarg == "dt-size-bound") return SygusFairMode::DT_SIZE_PRED; |
44 |
2 |
else if (optarg == "dt-size") return SygusFairMode::DT_SIZE; |
45 |
2 |
else if (optarg == "none") return SygusFairMode::NONE; |
46 |
2 |
else if (optarg == "dt-height-bound") return SygusFairMode::DT_HEIGHT_PRED; |
47 |
2 |
else if (optarg == "direct") return SygusFairMode::DIRECT; |
48 |
|
else if (optarg == "help") |
49 |
|
{ |
50 |
|
std::cerr << R"FOOBAR( |
51 |
|
Modes for enforcing fairness for counterexample guided quantifier instantion. |
52 |
|
Available modes for --sygus-fair are: |
53 |
|
+ dt-size-bound |
54 |
|
Enforce fairness by size bound predicate. |
55 |
|
+ dt-size (default) |
56 |
|
Enforce fairness using size operator. |
57 |
|
+ none |
58 |
|
Do not enforce fairness. |
59 |
|
+ dt-height-bound |
60 |
|
Enforce fairness by height bound predicate. |
61 |
|
+ direct |
62 |
|
Enforce fairness using direct conflict lemmas. |
63 |
|
)FOOBAR"; |
64 |
|
std::exit(1); |
65 |
|
} |
66 |
|
throw OptionException(std::string("unknown option for --sygus-fair: `") + |
67 |
|
optarg + "'. Try --sygus-fair=help."); |
68 |
|
} |
69 |
|
// clang-format on |
70 |
|
|
71 |
|
namespace datatypes |
72 |
|
{ |
73 |
|
// clang-format off |
74 |
|
void setDefaultCdtBisimilar(Options& opts, bool value) |
75 |
|
{ |
76 |
|
if (!opts.datatypes.cdtBisimilarWasSetByUser) opts.datatypes.cdtBisimilar = value; |
77 |
|
} |
78 |
|
void setDefaultDtBinarySplit(Options& opts, bool value) |
79 |
|
{ |
80 |
|
if (!opts.datatypes.dtBinarySplitWasSetByUser) opts.datatypes.dtBinarySplit = value; |
81 |
|
} |
82 |
|
void setDefaultDtBlastSplits(Options& opts, bool value) |
83 |
|
{ |
84 |
|
if (!opts.datatypes.dtBlastSplitsWasSetByUser) opts.datatypes.dtBlastSplits = value; |
85 |
|
} |
86 |
|
void setDefaultDtCyclic(Options& opts, bool value) |
87 |
|
{ |
88 |
|
if (!opts.datatypes.dtCyclicWasSetByUser) opts.datatypes.dtCyclic = value; |
89 |
|
} |
90 |
|
void setDefaultDtForceAssignment(Options& opts, bool value) |
91 |
|
{ |
92 |
|
if (!opts.datatypes.dtForceAssignmentWasSetByUser) opts.datatypes.dtForceAssignment = value; |
93 |
|
} |
94 |
|
void setDefaultDtInferAsLemmas(Options& opts, bool value) |
95 |
|
{ |
96 |
|
if (!opts.datatypes.dtInferAsLemmasWasSetByUser) opts.datatypes.dtInferAsLemmas = value; |
97 |
|
} |
98 |
|
void setDefaultDtNestedRec(Options& opts, bool value) |
99 |
|
{ |
100 |
|
if (!opts.datatypes.dtNestedRecWasSetByUser) opts.datatypes.dtNestedRec = value; |
101 |
|
} |
102 |
|
void setDefaultDtPoliteOptimize(Options& opts, bool value) |
103 |
|
{ |
104 |
|
if (!opts.datatypes.dtPoliteOptimizeWasSetByUser) opts.datatypes.dtPoliteOptimize = value; |
105 |
|
} |
106 |
|
void setDefaultDtRewriteErrorSel(Options& opts, bool value) |
107 |
|
{ |
108 |
|
if (!opts.datatypes.dtRewriteErrorSelWasSetByUser) opts.datatypes.dtRewriteErrorSel = value; |
109 |
|
} |
110 |
|
void setDefaultDtSharedSelectors(Options& opts, bool value) |
111 |
|
{ |
112 |
|
if (!opts.datatypes.dtSharedSelectorsWasSetByUser) opts.datatypes.dtSharedSelectors = value; |
113 |
|
} |
114 |
|
void setDefaultSygusAbortSize(Options& opts, int64_t value) |
115 |
|
{ |
116 |
|
if (!opts.datatypes.sygusAbortSizeWasSetByUser) opts.datatypes.sygusAbortSize = value; |
117 |
|
} |
118 |
|
void setDefaultSygusFair(Options& opts, SygusFairMode value) |
119 |
|
{ |
120 |
|
if (!opts.datatypes.sygusFairWasSetByUser) opts.datatypes.sygusFair = value; |
121 |
|
} |
122 |
|
void setDefaultSygusFairMax(Options& opts, bool value) |
123 |
|
{ |
124 |
|
if (!opts.datatypes.sygusFairMaxWasSetByUser) opts.datatypes.sygusFairMax = value; |
125 |
|
} |
126 |
|
void setDefaultSygusSymBreak(Options& opts, bool value) |
127 |
|
{ |
128 |
|
if (!opts.datatypes.sygusSymBreakWasSetByUser) opts.datatypes.sygusSymBreak = value; |
129 |
|
} |
130 |
|
void setDefaultSygusSymBreakAgg(Options& opts, bool value) |
131 |
|
{ |
132 |
|
if (!opts.datatypes.sygusSymBreakAggWasSetByUser) opts.datatypes.sygusSymBreakAgg = value; |
133 |
|
} |
134 |
|
void setDefaultSygusSymBreakDynamic(Options& opts, bool value) |
135 |
|
{ |
136 |
|
if (!opts.datatypes.sygusSymBreakDynamicWasSetByUser) opts.datatypes.sygusSymBreakDynamic = value; |
137 |
|
} |
138 |
|
void setDefaultSygusSymBreakLazy(Options& opts, bool value) |
139 |
|
{ |
140 |
|
if (!opts.datatypes.sygusSymBreakLazyWasSetByUser) opts.datatypes.sygusSymBreakLazy = value; |
141 |
|
} |
142 |
|
void setDefaultSygusSymBreakPbe(Options& opts, bool value) |
143 |
|
{ |
144 |
|
if (!opts.datatypes.sygusSymBreakPbeWasSetByUser) opts.datatypes.sygusSymBreakPbe = value; |
145 |
|
} |
146 |
|
void setDefaultSygusSymBreakRlv(Options& opts, bool value) |
147 |
|
{ |
148 |
|
if (!opts.datatypes.sygusSymBreakRlvWasSetByUser) opts.datatypes.sygusSymBreakRlv = value; |
149 |
|
} |
150 |
|
// clang-format on |
151 |
|
} |
152 |
|
|
153 |
22755 |
} // namespace cvc5::options |