}
int ValidityChecker::stackLevel() {
- return d_smt->getStackLevel();
+ Unimplemented("This CVC3 compatibility function not yet implemented (sorry!)");
}
void ValidityChecker::push() {
}
void ValidityChecker::popto(int stackLevel) {
- CheckArgument(stackLevel >= 0, stackLevel,
- "Cannot pop to a negative stack level %u", stackLevel);
- CheckArgument(unsigned(stackLevel) <= d_smt->getStackLevel(), stackLevel,
- "Cannot pop to a level higher than the current one! "
- "At level %u, user requested level %d",
- d_smt->getStackLevel(), stackLevel);
- while(unsigned(stackLevel) < d_smt->getStackLevel()) {
- pop();
- }
+ Unimplemented("This CVC3 compatibility function not yet implemented (sorry!)");
}
int ValidityChecker::scopeLevel() {
* holds the last substitution from d_topLevelSubstitutions
* that was pushed out to SAT.
* If d_lastSubstitutionPos == d_topLevelSubstitutions.end(),
- * then nothing has been pushed out yet. */
+ * then nothing has been pushed out yet.
+ */
context::CDO<SubstitutionMap::iterator> d_lastSubstitutionPos;
static const bool d_doConstantProp = true;
d_assertionList(NULL),
d_assignments(NULL),
d_logic(),
+ d_pendingPops(0),
d_fullyInited(false),
d_problemExtended(false),
d_queryMade(false),
Dump("benchmark") << QuitCommand();
}
+ doPendingPops();
+
// check to see if a postsolve() is pending
if(d_needPostsolve) {
d_theoryEngine->postsolve();
SmtScope smts(this);
try {
+ doPendingPops();
+
while(options::incrementalSolving() && d_userContext->getLevel() > 1) {
- internalPop();
+ internalPop(true);
}
shutdown();
// returns false if simpflication led to "false"
bool SmtEnginePrivate::simplifyAssertions()
throw(TypeCheckingException, AssertionException) {
+ Assert(d_smt.d_pendingPops == 0);
try {
Trace("simplify") << "SmtEnginePrivate::simplify()" << endl;
Result SmtEngine::check() {
Assert(d_fullyInited);
+ Assert(d_pendingPops == 0);
Trace("smt") << "SmtEngine::check()" << endl;
void SmtEnginePrivate::processAssertions() {
Assert(d_smt.d_fullyInited);
+ Assert(d_smt.d_pendingPops == 0);
Trace("smt") << "SmtEnginePrivate::processAssertions()" << endl;
SmtScope smts(this);
finalOptionsAreSet();
+ doPendingPops();
Trace("smt") << "SmtEngine::checkSat(" << e << ")" << endl;
SmtScope smts(this);
finalOptionsAreSet();
+ doPendingPops();
Trace("smt") << "SMT query(" << e << ")" << endl;
Assert(e.getExprManager() == d_exprManager);
SmtScope smts(this);
finalOptionsAreSet();
+ doPendingPops();
Trace("smt") << "SmtEngine::assertFormula(" << e << ")" << endl;
ensureBoolean(e);
if(d_assertionList != NULL) {
Assert(e.getExprManager() == d_exprManager);
SmtScope smts(this);
finalOptionsAreSet();
+ doPendingPops();
if( options::typeChecking() ) {
e.getType(true);// ensure expr is type-checked at this point
}
bool SmtEngine::addToAssignment(const Expr& e) throw(AssertionException) {
SmtScope smts(this);
finalOptionsAreSet();
+ doPendingPops();
Type type = e.getType(options::typeChecking());
// must be Boolean
CheckArgument( type.isBoolean(), e,
Trace("smt") << "SMT addToModelCommand(" << c << ", " << c_type << ")" << endl;
SmtScope smts(this);
finalOptionsAreSet();
+ doPendingPops();
if( options::produceModels() ) {
d_theoryEngine->getModel()->addCommand( c, c_type );
}
Trace("smt") << "SMT getModel()" << endl;
SmtScope smts(this);
+ finalOptionsAreSet();
+
+ if(Dump.isOn("benchmark")) {
+ Dump("benchmark") << GetModelCommand();
+ }
+
if(d_status.isNull() ||
d_status.asSatisfiabilityResult() == Result::UNSAT ||
d_problemExtended) {
vector<Expr> SmtEngine::getAssertions()
throw(ModalException, AssertionException) {
+ finalOptionsAreSet();
if(Dump.isOn("benchmark")) {
Dump("benchmark") << GetAssertionsCommand();
}
return vector<Expr>(d_assertionList->begin(), d_assertionList->end());
}
-size_t SmtEngine::getStackLevel() const {
- SmtScope smts(this);
- Trace("smt") << "SMT getStackLevel()" << endl;
- return d_context->getLevel();
-}
-
void SmtEngine::push() {
SmtScope smts(this);
finalOptionsAreSet();
+ doPendingPops();
Trace("smt") << "SMT push()" << endl;
d_private->processAssertions();
if(Dump.isOn("benchmark")) {
AlwaysAssert(d_userLevels.size() > 0 && d_userLevels.back() < d_userContext->getLevel());
while (d_userLevels.back() < d_userContext->getLevel()) {
- internalPop();
+ internalPop(true);
}
d_userLevels.pop_back();
void SmtEngine::internalPush() {
Assert(d_fullyInited);
Trace("smt") << "SmtEngine::internalPush()" << endl;
+ doPendingPops();
if(options::incrementalSolving()) {
d_private->processAssertions();
d_userContext->push();
}
}
-void SmtEngine::internalPop() {
+void SmtEngine::internalPop(bool immediate) {
Assert(d_fullyInited);
Trace("smt") << "SmtEngine::internalPop()" << endl;
if(options::incrementalSolving()) {
+ ++d_pendingPops;
+ }
+ if(immediate) {
+ doPendingPops();
+ }
+}
+
+void SmtEngine::doPendingPops() {
+ Assert(d_pendingPops == 0 || options::incrementalSolving());
+ while(d_pendingPops > 0) {
d_propEngine->pop();
d_context->pop();
d_userContext->pop();
+ --d_pendingPops;
}
}