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/theory_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, EqEngineMode mode) |
29 |
|
{ |
30 |
|
switch(mode) |
31 |
|
{ |
32 |
|
case EqEngineMode::CENTRAL: return os << "EqEngineMode::CENTRAL"; |
33 |
|
case EqEngineMode::DISTRIBUTED: return os << "EqEngineMode::DISTRIBUTED"; |
34 |
|
default: Unreachable(); |
35 |
|
} |
36 |
|
return os; |
37 |
|
} |
38 |
28 |
EqEngineMode stringToEqEngineMode(const std::string& optarg) |
39 |
|
{ |
40 |
28 |
if (optarg == "central") return EqEngineMode::CENTRAL; |
41 |
14 |
else if (optarg == "distributed") return EqEngineMode::DISTRIBUTED; |
42 |
|
else if (optarg == "help") |
43 |
|
{ |
44 |
|
std::cerr << R"FOOBAR( |
45 |
|
Defines mode for managing equalities across theory solvers. |
46 |
|
Available modes for --ee-mode are: |
47 |
|
+ central |
48 |
|
All applicable theories use the central equality engine. |
49 |
|
+ distributed (default) |
50 |
|
Each theory maintains its own equality engine. |
51 |
|
)FOOBAR"; |
52 |
|
std::exit(1); |
53 |
|
} |
54 |
|
throw OptionException(std::string("unknown option for --ee-mode: `") + |
55 |
|
optarg + "'. Try --ee-mode=help."); |
56 |
|
} |
57 |
|
std::ostream& operator<<(std::ostream& os, TcMode mode) |
58 |
|
{ |
59 |
|
switch(mode) |
60 |
|
{ |
61 |
|
case TcMode::CARE_GRAPH: return os << "TcMode::CARE_GRAPH"; |
62 |
|
default: Unreachable(); |
63 |
|
} |
64 |
|
return os; |
65 |
|
} |
66 |
|
TcMode stringToTcMode(const std::string& optarg) |
67 |
|
{ |
68 |
|
if (optarg == "care-graph") return TcMode::CARE_GRAPH; |
69 |
|
else if (optarg == "help") |
70 |
|
{ |
71 |
|
std::cerr << R"FOOBAR( |
72 |
|
Defines mode for theory combination. |
73 |
|
Available modes for --tc-mode are: |
74 |
|
+ care-graph (default) |
75 |
|
Use care graphs for theory combination. |
76 |
|
)FOOBAR"; |
77 |
|
std::exit(1); |
78 |
|
} |
79 |
|
throw OptionException(std::string("unknown option for --tc-mode: `") + |
80 |
|
optarg + "'. Try --tc-mode=help."); |
81 |
|
} |
82 |
|
std::ostream& operator<<(std::ostream& os, TheoryOfMode mode) |
83 |
|
{ |
84 |
|
switch(mode) |
85 |
|
{ |
86 |
|
case TheoryOfMode::THEORY_OF_TYPE_BASED: return os << "TheoryOfMode::THEORY_OF_TYPE_BASED"; |
87 |
|
case TheoryOfMode::THEORY_OF_TERM_BASED: return os << "TheoryOfMode::THEORY_OF_TERM_BASED"; |
88 |
|
default: Unreachable(); |
89 |
|
} |
90 |
|
return os; |
91 |
|
} |
92 |
3 |
TheoryOfMode stringToTheoryOfMode(const std::string& optarg) |
93 |
|
{ |
94 |
3 |
if (optarg == "type") return TheoryOfMode::THEORY_OF_TYPE_BASED; |
95 |
2 |
else if (optarg == "term") return TheoryOfMode::THEORY_OF_TERM_BASED; |
96 |
|
else if (optarg == "help") |
97 |
|
{ |
98 |
|
std::cerr << R"FOOBAR( |
99 |
|
Defines how we associate theories with terms. |
100 |
|
Available modes for --theoryof-mode are: |
101 |
|
+ type (default) |
102 |
|
Type variables, constants and equalities by type. |
103 |
|
+ term |
104 |
|
Type variables as uninterpreted, type constants by theory, equalities by the |
105 |
|
parametric theory. |
106 |
|
)FOOBAR"; |
107 |
|
std::exit(1); |
108 |
|
} |
109 |
|
throw OptionException(std::string("unknown option for --theoryof-mode: `") + |
110 |
|
optarg + "'. Try --theoryof-mode=help."); |
111 |
|
} |
112 |
|
// clang-format on |
113 |
|
|
114 |
|
namespace theory |
115 |
|
{ |
116 |
|
// clang-format off |
117 |
|
void setDefaultAssignFunctionValues(Options& opts, bool value) |
118 |
|
{ |
119 |
|
if (!opts.theory.assignFunctionValuesWasSetByUser) opts.theory.assignFunctionValues = value; |
120 |
|
} |
121 |
|
void setDefaultCondenseFunctionValues(Options& opts, bool value) |
122 |
|
{ |
123 |
|
if (!opts.theory.condenseFunctionValuesWasSetByUser) opts.theory.condenseFunctionValues = value; |
124 |
|
} |
125 |
|
void setDefaultEeMode(Options& opts, EqEngineMode value) |
126 |
|
{ |
127 |
|
if (!opts.theory.eeModeWasSetByUser) opts.theory.eeMode = value; |
128 |
|
} |
129 |
|
void setDefaultRelevanceFilter(Options& opts, bool value) |
130 |
|
{ |
131 |
|
if (!opts.theory.relevanceFilterWasSetByUser) opts.theory.relevanceFilter = value; |
132 |
|
} |
133 |
|
void setDefaultTcMode(Options& opts, TcMode value) |
134 |
|
{ |
135 |
|
if (!opts.theory.tcModeWasSetByUser) opts.theory.tcMode = value; |
136 |
|
} |
137 |
|
void setDefaultTheoryOfMode(Options& opts, TheoryOfMode value) |
138 |
|
{ |
139 |
|
if (!opts.theory.theoryOfModeWasSetByUser) opts.theory.theoryOfMode = value; |
140 |
|
} |
141 |
|
// clang-format on |
142 |
|
} |
143 |
|
|
144 |
22755 |
} // namespace cvc5::options |