Parser::addOperator(kind::LEQ);
Parser::addOperator(kind::GT);
Parser::addOperator(kind::GEQ);
-
+
+ // NOTE: this operator is non-standard
addOperator(kind::POW, "^");
+}
+
+void Smt2::addTranscendentalOperators()
+{
addOperator(kind::EXPONENTIAL, "exp");
addOperator(kind::SINE, "sin");
addOperator(kind::COSINE, "cos");
addOperator(kind::ARCCOSECANT, "arccsc");
addOperator(kind::ARCSECANT, "arcsec");
addOperator(kind::ARCCOTANGENT, "arccot");
-
addOperator(kind::SQRT, "sqrt");
}
Parser::addOperator(kind::DIVISION);
break;
+ case THEORY_TRANSCENDENTALS: addTranscendentalOperators(); break;
+
case THEORY_QUANTIFIERS:
break;
} else if(d_logic.areRealsUsed()) {
addTheory(THEORY_REALS);
}
+
+ if (d_logic.areTranscendentalsUsed())
+ {
+ addTheory(THEORY_TRANSCENDENTALS);
+ }
}
if(d_logic.isTheoryEnabled(theory::THEORY_ARRAYS)) {
friend class ParserBuilder;
public:
- enum Theory {
- THEORY_ARRAYS,
- THEORY_BITVECTORS,
- THEORY_CORE,
- THEORY_DATATYPES,
- THEORY_INTS,
- THEORY_REALS,
- THEORY_REALS_INTS,
- THEORY_QUANTIFIERS,
- THEORY_SETS,
- THEORY_STRINGS,
- THEORY_UF,
- THEORY_FP,
- THEORY_SEP
- };
+ enum Theory
+ {
+ THEORY_ARRAYS,
+ THEORY_BITVECTORS,
+ THEORY_CORE,
+ THEORY_DATATYPES,
+ THEORY_INTS,
+ THEORY_REALS,
+ THEORY_TRANSCENDENTALS,
+ THEORY_REALS_INTS,
+ THEORY_QUANTIFIERS,
+ THEORY_SETS,
+ THEORY_STRINGS,
+ THEORY_UF,
+ THEORY_FP,
+ THEORY_SEP
+ };
private:
bool d_logicSet;
ss << "cannot declare or define symbol `" << name << "'; symbols starting with . and @ are reserved in SMT-LIB";
parseError(ss.str());
}
+ else if (isOperatorEnabled(name))
+ {
+ std::stringstream ss;
+ ss << "Symbol `" << name << "' is shadowing a theory function symbol";
+ parseError(ss.str());
+ }
}
void includeFile(const std::string& filename);
void addArithmeticOperators();
+ void addTranscendentalOperators();
+
void addBitvectorOperators();
void addStringOperators();
d_sharingTheories(0),
d_integers(true),
d_reals(true),
+ d_transcendentals(true),
d_linear(false),
d_differenceLogic(false),
d_cardinalityConstraints(false),
d_sharingTheories(0),
d_integers(false),
d_reals(false),
+ d_transcendentals(false),
d_linear(false),
d_differenceLogic(false),
d_cardinalityConstraints(false),
d_sharingTheories(0),
d_integers(false),
d_reals(false),
+ d_transcendentals(false),
d_linear(false),
d_differenceLogic(false),
d_cardinalityConstraints(false),
return d_reals;
}
+bool LogicInfo::areTranscendentalsUsed() const
+{
+ PrettyCheckArgument(d_locked,
+ *this,
+ "This LogicInfo isn't locked yet, and cannot be queried");
+ PrettyCheckArgument(isTheoryEnabled(theory::THEORY_ARITH),
+ *this,
+ "Arithmetic not used in this LogicInfo; cannot ask "
+ "whether transcendentals are used");
+ return d_transcendentals;
+}
+
bool LogicInfo::isLinear() const {
PrettyCheckArgument(d_locked, *this,
"This LogicInfo isn't locked yet, and cannot be queried");
PrettyCheckArgument(d_sharingTheories == other.d_sharingTheories, *this,
"LogicInfo internal inconsistency");
if(isTheoryEnabled(theory::THEORY_ARITH)) {
- return
- d_integers == other.d_integers &&
- d_reals == other.d_reals &&
- d_linear == other.d_linear &&
- d_differenceLogic == other.d_differenceLogic;
+ return d_integers == other.d_integers && d_reals == other.d_reals
+ && d_transcendentals == other.d_transcendentals
+ && d_linear == other.d_linear
+ && d_differenceLogic == other.d_differenceLogic;
} else {
return true;
}
PrettyCheckArgument(d_sharingTheories <= other.d_sharingTheories, *this,
"LogicInfo internal inconsistency");
if(isTheoryEnabled(theory::THEORY_ARITH) && other.isTheoryEnabled(theory::THEORY_ARITH)) {
- return
- (!d_integers || other.d_integers) &&
- (!d_reals || other.d_reals) &&
- (d_linear || !other.d_linear) &&
- (d_differenceLogic || !other.d_differenceLogic);
+ return (!d_integers || other.d_integers) && (!d_reals || other.d_reals)
+ && (!d_transcendentals || other.d_transcendentals)
+ && (d_linear || !other.d_linear)
+ && (d_differenceLogic || !other.d_differenceLogic);
} else {
return true;
}
PrettyCheckArgument(d_sharingTheories >= other.d_sharingTheories, *this,
"LogicInfo internal inconsistency");
if(isTheoryEnabled(theory::THEORY_ARITH) && other.isTheoryEnabled(theory::THEORY_ARITH)) {
- return
- (d_integers || !other.d_integers) &&
- (d_reals || !other.d_reals) &&
- (!d_linear || other.d_linear) &&
- (!d_differenceLogic || other.d_differenceLogic);
+ return (d_integers || !other.d_integers) && (d_reals || !other.d_reals)
+ && (d_transcendentals || !other.d_transcendentals)
+ && (!d_linear || other.d_linear)
+ && (!d_differenceLogic || other.d_differenceLogic);
} else {
return true;
}
ss << (areIntegersUsed() ? "I" : "");
ss << (areRealsUsed() ? "R" : "");
ss << "A";
+ ss << (areTranscendentalsUsed() ? "T" : "");
}
++seen;
}
enableReals();
arithNonLinear();
p += 3;
+ if (*p == 'T')
+ {
+ arithTranscendentals();
+ p += 1;
+ }
} else if(!strncmp(p, "NIRA", 4)) {
enableIntegers();
enableReals();
arithNonLinear();
p += 4;
+ if (*p == 'T')
+ {
+ arithTranscendentals();
+ p += 1;
+ }
}
if(!strncmp(p, "FS", 2)) {
enableTheory(THEORY_SETS);
}
}
+void LogicInfo::arithTranscendentals()
+{
+ PrettyCheckArgument(
+ !d_locked, *this, "This LogicInfo is locked, and cannot be modified");
+ d_logicString = "";
+ d_transcendentals = true;
+ if (!d_reals)
+ {
+ enableReals();
+ }
+ if (d_linear)
+ {
+ arithNonLinear();
+ }
+}
+
void LogicInfo::arithOnlyDifference() {
PrettyCheckArgument(!d_locked, *this, "This LogicInfo is locked, and cannot be modified");
d_logicString = "";
d_linear = true;
d_differenceLogic = true;
+ d_transcendentals = false;
}
void LogicInfo::arithOnlyLinear() {
d_logicString = "";
d_linear = true;
d_differenceLogic = false;
+ d_transcendentals = false;
}
void LogicInfo::arithNonLinear() {
bool d_integers;
/** are reals used in this logic? */
bool d_reals;
+ /** transcendentals in this logic? */
+ bool d_transcendentals;
/** linear-only arithmetic in this logic? */
bool d_linear;
/** difference-only arithmetic in this logic? */
/** Are reals in this logic? */
bool areRealsUsed() const;
+ /** Are transcendentals in this logic? */
+ bool areTranscendentalsUsed() const;
+
/** Does this logic only linear arithmetic? */
bool isLinear() const;
void enableReals();
/** Disable the use of reals in this logic. */
void disableReals();
+ /** Enable the use of transcendentals in this logic. */
+ void arithTranscendentals();
/** Only permit difference arithmetic in this logic. */
void arithOnlyDifference();
/** Only permit linear arithmetic in this logic. */
regress0/parser/as.smt2 \
regress0/parser/constraint.smt2 \
regress0/parser/declarefun-emptyset-uf.smt2 \
+ regress0/parser/shadow_fun_symbol_all.smt2 \
+ regress0/parser/shadow_fun_symbol_nirat.smt2 \
regress0/parser/strings20.smt2 \
regress0/parser/strings25.smt2 \
regress0/precedence/and-not.cvc \
regress0/quantifiers/floor.smt2 \
regress0/quantifiers/is-even-pred.smt2 \
regress0/quantifiers/is-int.smt2 \
- regress0/quantifiers/issue2031-bv-var-elim.smt2 \
regress0/quantifiers/issue1805.smt2 \
+ regress0/quantifiers/issue2031-bv-var-elim.smt2 \
regress0/quantifiers/issue2033-macro-arith.smt2 \
regress0/quantifiers/lra-triv-gn.smt2 \
regress0/quantifiers/macros-int-real.smt2 \
; COMMAND-LINE: --nl-ext
; EXPECT: unsat
-(set-logic QF_UFNRA)
+(set-logic QF_UFNRAT)
(set-info :status unsat)
(declare-fun x () Real)
(assert (not (= (cos 0.0) 1.0)))
; COMMAND-LINE: --nl-ext-tf-tplanes
; EXPECT: unsat
-(set-logic QF_NRA)
+(set-logic QF_NRAT)
(declare-fun x () Real)
(assert (> (exp (- (/ 1 2))) 0.65))
; COMMAND-LINE: --nl-ext-tf-tplanes
; EXPECT: unsat
-(set-logic QF_NRA)
+(set-logic QF_NRAT)
(declare-fun x () Real)
(assert (< (exp (- (/ 1 2))) 0.6))
; COMMAND-LINE: --nl-ext-tf-tplanes
; EXPECT: unsat
-(set-logic QF_NRA)
+(set-logic QF_NRAT)
(set-info :status unsat)
(declare-fun x () Real)
; COMMAND-LINE: --nl-ext --nl-ext-tplanes
; EXPECT: unsat
-(set-logic QF_UFNRA)
+(set-logic QF_UFNRAT)
(set-info :status unsat)
(declare-fun x () Real)
(assert (not (= (+ (sin 0.2) (sin (- 0.2))) 0.0)))
-(set-logic QF_NRA)
+(set-logic QF_NRAT)
(set-info :status unsat)
(declare-fun x () Real)
(assert (> x 0.0))
; COMMAND-LINE: --nl-ext
; EXPECT: unsat
-(set-logic QF_UFNRA)
+(set-logic QF_UFNRAT)
(set-info :status unsat)
(declare-fun x () Real)
--- /dev/null
+; EXPECT: Symbol `sin' is shadowing a theory function symbol
+; SCRUBBER: grep -o "Symbol `sin' is shadowing a theory function symbol"
+; EXIT: 1
+(set-logic ALL)
+(declare-fun sin (Real) Real)
--- /dev/null
+; EXPECT: Symbol `exp' is shadowing a theory function symbol
+; SCRUBBER: grep -o "Symbol `exp' is shadowing a theory function symbol"
+; EXIT: 1
+(set-logic NIRAT)
+(declare-fun exp (Real) Real)
; COMMAND-LINE: --nl-ext-tf-tplanes
; EXPECT: unsat
-(set-logic QF_NRA)
+(set-logic QF_NRAT)
(set-info :source |printed by MathSAT|)
(declare-fun X () Real)
-(set-logic QF_NRA)
+(set-logic QF_NRAT)
(set-info :status unsat)
(set-option :arith-no-partial-fun true)
(declare-fun lat1 () Real)
; COMMAND-LINE: --nl-ext
; EXPECT: unsat
-(set-logic QF_NRA)
+(set-logic QF_NRAT)
(set-info :status unsat)
(declare-fun time__AT0@0 () Real)
(declare-fun instance.location.0__AT0@0 () Bool)
; COMMAND-LINE: --nl-ext
; EXPECT: sat
-(set-logic QF_NRA)
+(set-logic QF_NRAT)
(set-info :status sat)
(declare-fun time__AT0@0 () Real)
(declare-fun instance.y__AT0@0 () Real)
; COMMAND-LINE: --nl-ext
; EXPECT: unsat
-(set-logic QF_UFNRA)
+(set-logic QF_UFNRAT)
(declare-fun x () Real)
(assert (> (cos x) 1.0))
(check-sat)
; COMMAND-LINE: --nl-ext --no-nl-ext-tf-tplanes --no-nl-ext-inc-prec
; EXPECT: unknown
-(set-logic UFNRA)
+(set-logic UFNRAT)
(declare-fun f (Real) Real)
(assert (= (f 0.0) (cos 1)))
; COMMAND-LINE: --nl-ext-tf-tplanes
; EXPECT: sat
-(set-logic QF_NRA)
+(set-logic QF_NRAT)
(declare-fun time__AT0@0 () Real)
(declare-fun instance.y__AT0@0 () Real)
(declare-fun instance.x__AT0@0 () Real)
; COMMAND-LINE: --nl-ext-tf-tplanes
; EXPECT: unsat
-(set-logic QF_NRA)
+(set-logic QF_NRAT)
(declare-fun x () Real)
(assert (> (exp x) 2000.0))
; COMMAND-LINE: --nl-ext-tf-tplanes
; EXPECT: unsat
-(set-logic QF_NRA)
+(set-logic QF_NRAT)
(set-info :status unsat)
(declare-fun x () Real)
; COMMAND-LINE: --nl-ext
; EXPECT: unsat
-(set-logic QF_UFNRA)
+(set-logic QF_UFNRAT)
(set-info :status unsat)
(declare-fun x () Real)
(declare-fun y () Real)
; COMMAND-LINE: --nl-ext
; EXPECT: unsat
-(set-logic QF_NRA)
+(set-logic QF_NRAT)
(set-info :status unsat)
(declare-fun t@0 () Real)
(declare-fun y2@0 () Real)
; COMMAND-LINE: --nl-ext --nl-ext-tplanes
; EXPECT: unsat
-(set-logic QF_UFNRA)
+(set-logic QF_UFNRAT)
(set-info :status unsat)
(declare-fun x () Real)
(assert (< (sin 3.1) (sin 3.3)))
; COMMAND-LINE: --nl-ext --nl-ext-tplanes
; EXPECT: unsat
-(set-logic QF_UFNRA)
+(set-logic QF_UFNRAT)
(set-info :status unsat)
(declare-fun x () Real)
(assert (or (> (sin 0.1) (sin 0.2)) (> (sin 6.4) (sin 6.5))))
; COMMAND-LINE: --nl-ext
; EXPECT: unsat
-(set-logic QF_NRA)
+(set-logic QF_NRAT)
(set-info :status unsat)
(assert (or (> (sin 0.8) 0.9) (< (sin (- 0.7)) (- 0.75)) (= (sin 3.0) 0.8)))
(check-sat)
; COMMAND-LINE: --nl-ext --nl-ext-tplanes
; EXPECT: unsat
-(set-logic QF_UFNRA)
+(set-logic QF_UFNRAT)
(set-info :status unsat)
(declare-fun x () Real)
(assert (or (< (sin 0.2) (- 0.1)) (> (sin (- 0.05)) 0.05)))
; COMMAND-LINE: --nl-ext --nl-ext-tplanes
; EXPECT: unsat
-(set-logic QF_UFNRA)
+(set-logic QF_UFNRAT)
(set-info :status unsat)
(declare-fun x () Real)
(declare-fun y () Real)
; COMMAND-LINE: --nl-ext-tf-tplanes --no-check-models
; EXPECT: sat
-(set-logic QF_NRA)
+(set-logic QF_NRAT)
(set-info :status sat)
(declare-fun x () Real)
; COMMAND-LINE: --nl-ext-tf-tplanes
; EXPECT: unsat
-(set-logic QF_NRA)
+(set-logic QF_NRAT)
(set-info :status unsat)
(declare-fun x () Real)
; COMMAND-LINE: --nl-ext-tf-tplanes --no-check-models
; EXPECT: sat
-(set-logic QF_NRA)
+(set-logic QF_NRAT)
(set-info :status sat)
(declare-fun x () Real)
; COMMAND-LINE: --nl-ext-tf-tplanes
; EXPECT: unsat
-(set-logic QF_NRA)
+(set-logic QF_NRAT)
(set-info :status unsat)
(declare-fun x () Real)
; COMMAND-LINE: --nl-ext-tf-tplanes
; EXPECT: unsat
-(set-logic QF_NRA)
+(set-logic QF_NRAT)
(set-info :status unsat)
(declare-fun x () Real)
; COMMAND-LINE: --nl-ext-tf-tplanes
; EXPECT: unsat
-(set-logic QF_NRA)
+(set-logic QF_NRAT)
(set-info :status unsat)
(declare-fun x () Real)
; COMMAND-LINE: --nl-ext-tf-tplanes
; EXPECT: unsat
-(set-logic QF_NRA)
+(set-logic QF_NRAT)
(set-info :status unsat)
(declare-fun x1 () Real)
(declare-fun x2 () Real)
; COMMAND-LINE: --nl-ext-tf-tplanes
; EXPECT: unsat
-(set-logic QF_NRA)
+(set-logic QF_NRAT)
(set-info :status unsat)
(declare-fun a6 () Bool)
(assert (= a6 (> (* (csc 1.0) (sin 1.0)) 1.0)))
; COMMAND-LINE: --nl-ext-tf-tplanes
; EXPECT: unsat
-(set-logic QF_NRA)
+(set-logic QF_NRAT)
(set-info :status unsat)
(declare-fun x1 () Real)
(declare-fun x2 () Real)
; COMMAND-LINE: --nl-ext
; EXPECT: unsat
-(set-logic QF_UFNRA)
+(set-logic QF_UFNRAT)
(set-info :status unsat)
(declare-fun x () Real)
TS_ASSERT( info.isDifferenceLogic() );
TS_ASSERT( info.areIntegersUsed() );
TS_ASSERT( !info.areRealsUsed() );
+ TS_ASSERT(!info.areTranscendentalsUsed());
TS_ASSERT( !info.hasEverything() );
TS_ASSERT( !info.hasNothing() );
TS_ASSERT( !info.isDifferenceLogic() );
TS_ASSERT( info.areIntegersUsed() );
TS_ASSERT( !info.areRealsUsed() );
+ TS_ASSERT(!info.areTranscendentalsUsed());
TS_ASSERT( !info.hasEverything() );
TS_ASSERT( !info.hasNothing() );
TS_ASSERT( !info.isDifferenceLogic() );
TS_ASSERT( !info.areIntegersUsed() );
TS_ASSERT( info.areRealsUsed() );
+ TS_ASSERT(!info.areTranscendentalsUsed());
TS_ASSERT( !info.hasEverything() );
TS_ASSERT( !info.hasNothing() );
TS_ASSERT( !info.isDifferenceLogic() );
TS_ASSERT( !info.areIntegersUsed() );
TS_ASSERT( info.areRealsUsed() );
+ TS_ASSERT(!info.areTranscendentalsUsed());
TS_ASSERT( !info.hasEverything() );
TS_ASSERT( !info.hasNothing() );
TS_ASSERT( !info.isDifferenceLogic() );
TS_ASSERT( !info.areIntegersUsed() );
TS_ASSERT( info.areRealsUsed() );
+ TS_ASSERT(!info.areTranscendentalsUsed());
TS_ASSERT( !info.hasEverything() );
TS_ASSERT( !info.hasNothing() );
TS_ASSERT( !info.isDifferenceLogic() );
TS_ASSERT( info.areIntegersUsed() );
TS_ASSERT( !info.areRealsUsed() );
+ TS_ASSERT(!info.areTranscendentalsUsed());
TS_ASSERT( !info.hasEverything() );
TS_ASSERT( !info.hasNothing() );
TS_ASSERT( info.areIntegersUsed() );
TS_ASSERT( !info.isDifferenceLogic() );
TS_ASSERT( info.areRealsUsed() );
+ TS_ASSERT(info.areTranscendentalsUsed());
TS_ASSERT( !info.hasEverything() );
TS_ASSERT( !info.hasNothing() );
TS_ASSERT( info.isQuantified() );
TS_ASSERT( info.areIntegersUsed() );
TS_ASSERT( info.areRealsUsed() );
+ TS_ASSERT(info.areTranscendentalsUsed());
TS_ASSERT( !info.isLinear() );
TS_ASSERT_THROWS( info.arithOnlyLinear(), CVC4::IllegalArgumentException );
TS_ASSERT_THROWS( info.areIntegersUsed(), IllegalArgumentException );
TS_ASSERT_THROWS( info.isDifferenceLogic(), IllegalArgumentException );
TS_ASSERT_THROWS( info.areRealsUsed(), IllegalArgumentException );
+ TS_ASSERT_THROWS(info.areTranscendentalsUsed(), IllegalArgumentException);
// check copy is unchanged
info = info.getUnlockedCopy();
TS_ASSERT_THROWS( info.areIntegersUsed(), IllegalArgumentException );
TS_ASSERT_THROWS( info.isDifferenceLogic(), IllegalArgumentException );
TS_ASSERT_THROWS( info.areRealsUsed(), IllegalArgumentException );
+ TS_ASSERT_THROWS(info.areTranscendentalsUsed(), IllegalArgumentException);
// check all-included logic
info = info.getUnlockedCopy();
TS_ASSERT( info.areIntegersUsed() );
TS_ASSERT( !info.isDifferenceLogic() );
TS_ASSERT( info.areRealsUsed() );
+ TS_ASSERT(info.areTranscendentalsUsed());
// check copy is unchanged
info = info.getUnlockedCopy();
TS_ASSERT( info.areIntegersUsed() );
TS_ASSERT( !info.isDifferenceLogic() );
TS_ASSERT( info.areRealsUsed() );
+ TS_ASSERT(info.areTranscendentalsUsed());
}
void eq(const LogicInfo& logic1, const LogicInfo& logic2) const {
lt("QF_IDL", "QF_UFIDL");
lt("QF_IDL", "QF_NIA");
nc("QF_IDL", "QF_NRA");
+ nc("QF_IDL", "QF_NRAT");
lt("QF_IDL", "QF_AUFNIRA");
nc("QF_IDL", "LRA");
nc("QF_IDL", "NRA");
nc("QF_NRA", "AUFLIA");
nc("QF_NRA", "AUFLIRA");
lt("QF_NRA", "AUFNIRA");
+ lt("QF_NRA", "QF_NRAT");
gt("QF_AUFNIRA", "QF_UF");
gt("QF_AUFNIRA", "QF_LRA");
nc("QF_AUFNIRA", "AUFLIA");
nc("QF_AUFNIRA", "AUFLIRA");
lt("QF_AUFNIRA", "AUFNIRA");
+ lt("QF_AUFNIRA", "QF_AUFNIRAT");
nc("LRA", "QF_UF");
gt("LRA", "QF_LRA");
gt("AUFNIRA", "AUFLIA");
gt("AUFNIRA", "AUFLIRA");
eq("AUFNIRA", "AUFNIRA");
+ lt("AUFNIRA", "AUFNIRAT");
}
};/* class LogicInfoWhite */