21#ifndef __CVC4__LOGIC_INFO_H
22#define __CVC4__LOGIC_INFO_H
46 mutable std::string d_logicString;
47 std::vector<bool> d_theories;
48 size_t d_sharingTheories;
54 bool d_differenceLogic;
55 bool d_cardinalityConstraints;
65 case theory::THEORY_BUILTIN:
66 case theory::THEORY_BOOL:
67 case theory::THEORY_QUANTIFIERS:
107 CheckArgument(d_locked, *
this,
"This LogicInfo isn't locked yet, and cannot be queried");
108 return d_sharingTheories > 1;
113 CheckArgument(d_locked, *
this,
"This LogicInfo isn't locked yet, and cannot be queried");
114 return d_theories[theory];
119 CheckArgument(d_locked, *
this,
"This LogicInfo isn't locked yet, and cannot be queried");
120 return isTheoryEnabled(theory::THEORY_QUANTIFIERS);
125 CheckArgument(d_locked, *
this,
"This LogicInfo isn't locked yet, and cannot be queried");
128 return *
this == everything;
133 CheckArgument(d_locked, *
this,
"This LogicInfo isn't locked yet, and cannot be queried");
136 return *
this == nothing;
145 CheckArgument(d_locked, *
this,
"This LogicInfo isn't locked yet, and cannot be queried");
148 return isTheoryEnabled(theory) && !isSharingEnabled() &&
149 ( !isTrueTheory(theory) || d_sharingTheories == 1 ) &&
150 ( isTrueTheory(theory) || d_sharingTheories == 0 );
157 CheckArgument(d_locked, *
this,
"This LogicInfo isn't locked yet, and cannot be queried");
158 CheckArgument(isTheoryEnabled(theory::THEORY_ARITH), *
this,
"Arithmetic not used in this LogicInfo; cannot ask whether integers are used");
163 CheckArgument(d_locked, *
this,
"This LogicInfo isn't locked yet, and cannot be queried");
164 CheckArgument(isTheoryEnabled(theory::THEORY_ARITH), *
this,
"Arithmetic not used in this LogicInfo; cannot ask whether reals are used");
169 CheckArgument(d_locked, *
this,
"This LogicInfo isn't locked yet, and cannot be queried");
170 CheckArgument(isTheoryEnabled(theory::THEORY_ARITH), *
this,
"Arithmetic not used in this LogicInfo; cannot ask whether it's linear");
171 return d_linear || d_differenceLogic;
175 CheckArgument(d_locked, *
this,
"This LogicInfo isn't locked yet, and cannot be queried");
176 CheckArgument(isTheoryEnabled(theory::THEORY_ARITH), *
this,
"Arithmetic not used in this LogicInfo; cannot ask whether it's difference logic");
177 return d_differenceLogic;
181 CheckArgument(d_locked, *
this,
"This LogicInfo isn't locked yet, and cannot be queried");
182 return d_cardinalityConstraints;
221 enableTheory(theory::THEORY_QUANTIFIERS);
228 disableTheory(theory::THEORY_QUANTIFIERS);
251 void lock() { d_locked =
true; }
261 CheckArgument(isLocked() && other.
isLocked(), *
this,
"This LogicInfo isn't locked yet, and cannot be queried");
262 for(
theory::TheoryId id = theory::THEORY_FIRST;
id < theory::THEORY_LAST; ++id) {
263 if(d_theories[
id] != other.d_theories[
id]) {
267 CheckArgument(d_sharingTheories == other.d_sharingTheories, *
this,
"LogicInfo internal inconsistency");
268 if(isTheoryEnabled(theory::THEORY_ARITH)) {
270 d_integers == other.d_integers &&
271 d_reals == other.d_reals &&
272 d_linear == other.d_linear &&
273 d_differenceLogic == other.d_differenceLogic;
280 return !(*
this == other);
284 return *
this >= other && *
this != other;
288 return *
this <= other && *
this != other;
292 CheckArgument(isLocked() && other.
isLocked(), *
this,
"This LogicInfo isn't locked yet, and cannot be queried");
293 for(
theory::TheoryId id = theory::THEORY_FIRST;
id < theory::THEORY_LAST; ++id) {
294 if(d_theories[
id] && !other.d_theories[
id]) {
298 CheckArgument(d_sharingTheories <= other.d_sharingTheories, *
this,
"LogicInfo internal inconsistency");
299 if(isTheoryEnabled(theory::THEORY_ARITH) && other.
isTheoryEnabled(theory::THEORY_ARITH)) {
301 (!d_integers || other.d_integers) &&
302 (!d_reals || other.d_reals) &&
303 (d_linear || !other.d_linear) &&
304 (d_differenceLogic || !other.d_differenceLogic);
311 CheckArgument(isLocked() && other.
isLocked(), *
this,
"This LogicInfo isn't locked yet, and cannot be queried");
312 for(
theory::TheoryId id = theory::THEORY_FIRST;
id < theory::THEORY_LAST; ++id) {
313 if(!d_theories[
id] && other.d_theories[
id]) {
317 CheckArgument(d_sharingTheories >= other.d_sharingTheories, *
this,
"LogicInfo internal inconsistency");
318 if(isTheoryEnabled(theory::THEORY_ARITH) && other.
isTheoryEnabled(theory::THEORY_ARITH)) {
320 (d_integers || !other.d_integers) &&
321 (d_reals || !other.d_reals) &&
322 (!d_linear || other.d_linear) &&
323 (!d_differenceLogic || other.d_differenceLogic);
331 return *this <= other || *this >= other;
A LogicInfo instance describes a collection of theory modules and some basic configuration about them...
bool operator<(const LogicInfo &other) const
Is this LogicInfo "less than" (does it contain strictly less) the other?
void disableReals()
Disable the use of reals in this logic.
std::string getLogicString() const
Get an SMT-LIB-like logic string.
bool isSharingEnabled() const
Is sharing enabled for this logic?
void arithNonLinear()
Permit nonlinear arithmetic in this logic.
bool isDifferenceLogic() const
Does this logic only permit difference reasoning? (implies linear)
LogicInfo()
Constructs a LogicInfo for the most general logic (quantifiers, all background theory modules,...
bool isQuantified() const
Is this a quantified logic?
void arithOnlyDifference()
Only permit difference arithmetic in this logic.
bool hasEverything() const
Is this the all-inclusive logic?
bool hasCardinalityConstraints() const
Does this logic allow cardinality constraints?
bool isComparableTo(const LogicInfo &other) const
Are two LogicInfos comparable? That is, is one of <= or > true?
bool operator>(const LogicInfo &other) const
Is this LogicInfo "greater than" (does it contain everything and more) the other?
bool operator!=(const LogicInfo &other) const
Are these two LogicInfos disequal?
bool isPure(theory::TheoryId theory) const
Is this a pure logic (only one "true" background theory).
void arithOnlyLinear()
Only permit linear arithmetic in this logic.
bool operator<=(const LogicInfo &other) const
Is this LogicInfo "less than or equal" the other?
bool operator==(const LogicInfo &other) const
Are these two LogicInfos equal?
bool isLinear() const
Does this logic only linear arithmetic?
LogicInfo getUnlockedCopy() const
Get a copy of this LogicInfo that is identical, but unlocked.
LogicInfo(const char *logicString)
Construct a LogicInfo from an SMT-LIB-like logic string.
bool operator>=(const LogicInfo &other) const
Is this LogicInfo "greater than or equal" the other?
void enableQuantifiers()
Quantifiers are a special case, since two theory modules handle them.
bool areRealsUsed() const
Are reals in this logic?
void lock()
Lock this LogicInfo, disabling further mutation and allowing queries.
void setLogicString(std::string logicString)
Initialize the LogicInfo with an SMT-LIB-like logic string.
void enableEverything()
Enable all functionality.
bool isTheoryEnabled(theory::TheoryId theory) const
Is the given theory module active in this logic?
void enableTheory(theory::TheoryId theory)
Enable the given theory module.
void disableTheory(theory::TheoryId theory)
Disable the given theory module.
bool isLocked() const
Check whether this LogicInfo is locked, disallowing further mutation.
LogicInfo(std::string logicString)
Construct a LogicInfo from an SMT-LIB-like logic string.
void disableIntegers()
Disable the use of integers in this logic.
bool hasNothing() const
Is this the all-exclusive logic? (Here, that means propositional logic)
bool areIntegersUsed() const
Are integers in this logic?
void disableEverything()
Disable all functionality.
void enableReals()
Enable the use of reals in this logic.
void disableQuantifiers()
Quantifiers are a special case, since two theory modules handle them.
void enableIntegers()
Enable the use of integers in this logic.
Macros that should be defined everywhere during the building of the libraries and driver binary,...
std::ostream & operator<<(std::ostream &out, const TypeCheckingException &e)
void CheckArgument(bool cond, const T &arg, const char *fmt,...)