/*! \file command.cpp
** \verbatim
** Top contributors (to current version):
- ** Morgan Deters, Andrew Reynolds, Francois Bobot
+ ** Tim King, Morgan Deters, Aina Niemetz
** This file is part of the CVC4 project.
- ** Copyright (c) 2009-2017 by the authors listed in the file AUTHORS
+ ** Copyright (c) 2009-2018 by the authors listed in the file AUTHORS
** in the top-level source directory) and their institutional affiliations.
** All rights reserved. See the file COPYING in the top-level source
** directory for licensing information.\endverbatim
return out;
}
-/* class CommandPrintSuccess */
+
+/* output stream insertion operator for benchmark statuses */
+std::ostream& operator<<(std::ostream& out, BenchmarkStatus status)
+{
+ switch (status)
+ {
+ case SMT_SATISFIABLE: return out << "sat";
+
+ case SMT_UNSATISFIABLE: return out << "unsat";
+
+ case SMT_UNKNOWN: return out << "unknown";
+
+ default: return out << "BenchmarkStatus::[UNKNOWNSTATUS!]";
+ }
+}
+
+/* -------------------------------------------------------------------------- */
+/* class CommandPrintSuccess */
+/* -------------------------------------------------------------------------- */
void CommandPrintSuccess::applyPrintSuccess(std::ostream& out)
{
return out;
}
-/* class Command */
+/* -------------------------------------------------------------------------- */
+/* class Command */
+/* -------------------------------------------------------------------------- */
Command::Command() : d_commandStatus(NULL), d_muted(false) {}
Command::Command(const Command& cmd)
}
}
-/* class EmptyCommand */
+/* -------------------------------------------------------------------------- */
+/* class EmptyCommand */
+/* -------------------------------------------------------------------------- */
EmptyCommand::EmptyCommand(std::string name) : d_name(name) {}
std::string EmptyCommand::getName() const { return d_name; }
Command* EmptyCommand::clone() const { return new EmptyCommand(d_name); }
std::string EmptyCommand::getCommandName() const { return "empty"; }
-/* class EchoCommand */
+
+/* -------------------------------------------------------------------------- */
+/* class EchoCommand */
+/* -------------------------------------------------------------------------- */
EchoCommand::EchoCommand(std::string output) : d_output(output) {}
std::string EchoCommand::getOutput() const { return d_output; }
Command* EchoCommand::clone() const { return new EchoCommand(d_output); }
std::string EchoCommand::getCommandName() const { return "echo"; }
-/* class AssertCommand */
+
+/* -------------------------------------------------------------------------- */
+/* class AssertCommand */
+/* -------------------------------------------------------------------------- */
AssertCommand::AssertCommand(const Expr& e, bool inUnsatCore)
: d_expr(e), d_inUnsatCore(inUnsatCore)
}
std::string AssertCommand::getCommandName() const { return "assert"; }
-/* class PushCommand */
+
+/* -------------------------------------------------------------------------- */
+/* class PushCommand */
+/* -------------------------------------------------------------------------- */
void PushCommand::invoke(SmtEngine* smtEngine)
{
Command* PushCommand::clone() const { return new PushCommand(); }
std::string PushCommand::getCommandName() const { return "push"; }
-/* class PopCommand */
+
+/* -------------------------------------------------------------------------- */
+/* class PopCommand */
+/* -------------------------------------------------------------------------- */
void PopCommand::invoke(SmtEngine* smtEngine)
{
Command* PopCommand::clone() const { return new PopCommand(); }
std::string PopCommand::getCommandName() const { return "pop"; }
-/* class CheckSatCommand */
+
+/* -------------------------------------------------------------------------- */
+/* class CheckSatCommand */
+/* -------------------------------------------------------------------------- */
CheckSatCommand::CheckSatCommand() : d_expr() {}
CheckSatCommand::CheckSatCommand(const Expr& expr, bool inUnsatCore)
}
std::string CheckSatCommand::getCommandName() const { return "check-sat"; }
-/* class QueryCommand */
+
+/* -------------------------------------------------------------------------- */
+/* class CheckSatAssumingCommand */
+/* -------------------------------------------------------------------------- */
+
+CheckSatAssumingCommand::CheckSatAssumingCommand(Expr term) : d_terms()
+{
+ d_terms.push_back(term);
+}
+
+CheckSatAssumingCommand::CheckSatAssumingCommand(const std::vector<Expr>& terms,
+ bool inUnsatCore)
+ : d_terms(terms), d_inUnsatCore(inUnsatCore)
+{
+ PrettyCheckArgument(
+ terms.size() >= 1, terms, "cannot get-value of an empty set of terms");
+}
+
+const std::vector<Expr>& CheckSatAssumingCommand::getTerms() const
+{
+ return d_terms;
+}
+
+void CheckSatAssumingCommand::invoke(SmtEngine* smtEngine)
+{
+ try
+ {
+ d_result = smtEngine->checkSat(d_terms);
+ d_commandStatus = CommandSuccess::instance();
+ }
+ catch (exception& e)
+ {
+ d_commandStatus = new CommandFailure(e.what());
+ }
+}
+
+Result CheckSatAssumingCommand::getResult() const
+{
+ return d_result;
+}
+
+void CheckSatAssumingCommand::printResult(std::ostream& out,
+ uint32_t verbosity) const
+{
+ if (!ok())
+ {
+ this->Command::printResult(out, verbosity);
+ }
+ else
+ {
+ out << d_result << endl;
+ }
+}
+
+Command* CheckSatAssumingCommand::exportTo(
+ ExprManager* exprManager, ExprManagerMapCollection& variableMap)
+{
+ vector<Expr> exportedTerms;
+ for (const Expr& e : d_terms)
+ {
+ exportedTerms.push_back(e.exportTo(exprManager, variableMap));
+ }
+ CheckSatAssumingCommand* c =
+ new CheckSatAssumingCommand(exportedTerms, d_inUnsatCore);
+ c->d_result = d_result;
+ return c;
+}
+
+Command* CheckSatAssumingCommand::clone() const
+{
+ CheckSatAssumingCommand* c =
+ new CheckSatAssumingCommand(d_terms, d_inUnsatCore);
+ c->d_result = d_result;
+ return c;
+}
+
+std::string CheckSatAssumingCommand::getCommandName() const
+{
+ return "check-sat-assuming";
+}
+
+/* -------------------------------------------------------------------------- */
+/* class QueryCommand */
+/* -------------------------------------------------------------------------- */
QueryCommand::QueryCommand(const Expr& e, bool inUnsatCore)
: d_expr(e), d_inUnsatCore(inUnsatCore)
}
std::string QueryCommand::getCommandName() const { return "query"; }
-/* class CheckSynthCommand */
+
+/* -------------------------------------------------------------------------- */
+/* class CheckSynthCommand */
+/* -------------------------------------------------------------------------- */
CheckSynthCommand::CheckSynthCommand() : d_expr() {}
CheckSynthCommand::CheckSynthCommand(const Expr& expr) : d_expr(expr) {}
}
std::string CheckSynthCommand::getCommandName() const { return "check-synth"; }
-/* class ResetCommand */
+
+/* -------------------------------------------------------------------------- */
+/* class ResetCommand */
+/* -------------------------------------------------------------------------- */
void ResetCommand::invoke(SmtEngine* smtEngine)
{
Command* ResetCommand::clone() const { return new ResetCommand(); }
std::string ResetCommand::getCommandName() const { return "reset"; }
-/* class ResetAssertionsCommand */
+
+/* -------------------------------------------------------------------------- */
+/* class ResetAssertionsCommand */
+/* -------------------------------------------------------------------------- */
void ResetAssertionsCommand::invoke(SmtEngine* smtEngine)
{
return "reset-assertions";
}
-/* class QuitCommand */
+/* -------------------------------------------------------------------------- */
+/* class QuitCommand */
+/* -------------------------------------------------------------------------- */
void QuitCommand::invoke(SmtEngine* smtEngine)
{
Command* QuitCommand::clone() const { return new QuitCommand(); }
std::string QuitCommand::getCommandName() const { return "exit"; }
-/* class CommentCommand */
+
+/* -------------------------------------------------------------------------- */
+/* class CommentCommand */
+/* -------------------------------------------------------------------------- */
CommentCommand::CommentCommand(std::string comment) : d_comment(comment) {}
std::string CommentCommand::getComment() const { return d_comment; }
Command* CommentCommand::clone() const { return new CommentCommand(d_comment); }
std::string CommentCommand::getCommandName() const { return "comment"; }
-/* class CommandSequence */
+
+/* -------------------------------------------------------------------------- */
+/* class CommandSequence */
+/* -------------------------------------------------------------------------- */
CommandSequence::CommandSequence() : d_index(0) {}
CommandSequence::~CommandSequence()
}
std::string CommandSequence::getCommandName() const { return "sequence"; }
-/* class DeclarationSequenceCommand */
-/* class DeclarationDefinitionCommand */
+/* -------------------------------------------------------------------------- */
+/* class DeclarationDefinitionCommand */
+/* -------------------------------------------------------------------------- */
DeclarationDefinitionCommand::DeclarationDefinitionCommand(
const std::string& id)
}
std::string DeclarationDefinitionCommand::getSymbol() const { return d_symbol; }
-/* class DeclareFunctionCommand */
+
+/* -------------------------------------------------------------------------- */
+/* class DeclareFunctionCommand */
+/* -------------------------------------------------------------------------- */
DeclareFunctionCommand::DeclareFunctionCommand(const std::string& id,
Expr func,
return "declare-fun";
}
-/* class DeclareTypeCommand */
+/* -------------------------------------------------------------------------- */
+/* class DeclareTypeCommand */
+/* -------------------------------------------------------------------------- */
DeclareTypeCommand::DeclareTypeCommand(const std::string& id,
size_t arity,
return "declare-sort";
}
-/* class DefineTypeCommand */
+/* -------------------------------------------------------------------------- */
+/* class DefineTypeCommand */
+/* -------------------------------------------------------------------------- */
DefineTypeCommand::DefineTypeCommand(const std::string& id, Type t)
: DeclarationDefinitionCommand(id), d_params(), d_type(t)
}
std::string DefineTypeCommand::getCommandName() const { return "define-sort"; }
-/* class DefineFunctionCommand */
+
+/* -------------------------------------------------------------------------- */
+/* class DefineFunctionCommand */
+/* -------------------------------------------------------------------------- */
DefineFunctionCommand::DefineFunctionCommand(const std::string& id,
Expr func,
return "define-fun";
}
-/* class DefineNamedFunctionCommand */
+/* -------------------------------------------------------------------------- */
+/* class DefineNamedFunctionCommand */
+/* -------------------------------------------------------------------------- */
DefineNamedFunctionCommand::DefineNamedFunctionCommand(
const std::string& id,
return new DefineNamedFunctionCommand(d_symbol, d_func, d_formals, d_formula);
}
-/* class DefineFunctionRecCommand */
+/* -------------------------------------------------------------------------- */
+/* class DefineFunctionRecCommand */
+/* -------------------------------------------------------------------------- */
DefineFunctionRecCommand::DefineFunctionRecCommand(
Expr func, const std::vector<Expr>& formals, Expr formula)
DefineFunctionRecCommand::DefineFunctionRecCommand(
const std::vector<Expr>& funcs,
- const std::vector<std::vector<Expr> >& formals,
+ const std::vector<std::vector<Expr>>& formals,
const std::vector<Expr>& formulas)
{
d_funcs.insert(d_funcs.end(), funcs.begin(), funcs.end());
return d_funcs;
}
-const std::vector<std::vector<Expr> >& DefineFunctionRecCommand::getFormals()
+const std::vector<std::vector<Expr>>& DefineFunctionRecCommand::getFormals()
const
{
return d_formals;
exprManager, variableMap, /* flags = */ ExprManager::VAR_FLAG_DEFINED);
funcs.push_back(func);
}
- std::vector<std::vector<Expr> > formals;
+ std::vector<std::vector<Expr>> formals;
for (unsigned i = 0, size = d_formals.size(); i < size; i++)
{
std::vector<Expr> formals_c;
return "define-fun-rec";
}
-/* class SetUserAttribute */
+/* -------------------------------------------------------------------------- */
+/* class SetUserAttribute */
+/* -------------------------------------------------------------------------- */
SetUserAttributeCommand::SetUserAttributeCommand(
const std::string& attr,
return "set-user-attribute";
}
-/* class SimplifyCommand */
+/* -------------------------------------------------------------------------- */
+/* class SimplifyCommand */
+/* -------------------------------------------------------------------------- */
SimplifyCommand::SimplifyCommand(Expr term) : d_term(term) {}
Expr SimplifyCommand::getTerm() const { return d_term; }
}
std::string SimplifyCommand::getCommandName() const { return "simplify"; }
-/* class ExpandDefinitionsCommand */
+
+/* -------------------------------------------------------------------------- */
+/* class ExpandDefinitionsCommand */
+/* -------------------------------------------------------------------------- */
ExpandDefinitionsCommand::ExpandDefinitionsCommand(Expr term) : d_term(term) {}
Expr ExpandDefinitionsCommand::getTerm() const { return d_term; }
return "expand-definitions";
}
-/* class GetValueCommand */
+/* -------------------------------------------------------------------------- */
+/* class GetValueCommand */
+/* -------------------------------------------------------------------------- */
GetValueCommand::GetValueCommand(Expr term) : d_terms()
{
vector<Expr> result;
ExprManager* em = smtEngine->getExprManager();
NodeManager* nm = NodeManager::fromExprManager(em);
- for (std::vector<Expr>::const_iterator i = d_terms.begin();
- i != d_terms.end();
- ++i)
+ for (const Expr& e : d_terms)
{
- Assert(nm == NodeManager::fromExprManager((*i).getExprManager()));
+ Assert(nm == NodeManager::fromExprManager(e.getExprManager()));
smt::SmtScope scope(smtEngine);
Node request = Node::fromExpr(
- options::expandDefinitions() ? smtEngine->expandDefinitions(*i) : *i);
- Node value = Node::fromExpr(smtEngine->getValue(*i));
+ options::expandDefinitions() ? smtEngine->expandDefinitions(e) : e);
+ Node value = Node::fromExpr(smtEngine->getValue(e));
if (value.getType().isInteger() && request.getType() == nm->realType())
{
// Need to wrap in special marker so that output printers know this
}
std::string GetValueCommand::getCommandName() const { return "get-value"; }
-/* class GetAssignmentCommand */
+
+/* -------------------------------------------------------------------------- */
+/* class GetAssignmentCommand */
+/* -------------------------------------------------------------------------- */
GetAssignmentCommand::GetAssignmentCommand() {}
void GetAssignmentCommand::invoke(SmtEngine* smtEngine)
{
try
{
- std::vector<std::pair<Expr,Expr>> assignments = smtEngine->getAssignment();
+ std::vector<std::pair<Expr, Expr>> assignments = smtEngine->getAssignment();
vector<SExpr> sexprs;
for (const auto& p : assignments)
{
return "get-assignment";
}
-/* class GetModelCommand */
+/* -------------------------------------------------------------------------- */
+/* class GetModelCommand */
+/* -------------------------------------------------------------------------- */
GetModelCommand::GetModelCommand() : d_result(nullptr), d_smtEngine(nullptr) {}
void GetModelCommand::invoke(SmtEngine* smtEngine)
}
std::string GetModelCommand::getCommandName() const { return "get-model"; }
-/* class GetProofCommand */
+
+/* -------------------------------------------------------------------------- */
+/* class GetProofCommand */
+/* -------------------------------------------------------------------------- */
GetProofCommand::GetProofCommand() : d_smtEngine(nullptr), d_result(nullptr) {}
void GetProofCommand::invoke(SmtEngine* smtEngine)
}
std::string GetProofCommand::getCommandName() const { return "get-proof"; }
-/* class GetInstantiationsCommand */
+
+/* -------------------------------------------------------------------------- */
+/* class GetInstantiationsCommand */
+/* -------------------------------------------------------------------------- */
GetInstantiationsCommand::GetInstantiationsCommand() : d_smtEngine(nullptr) {}
void GetInstantiationsCommand::invoke(SmtEngine* smtEngine)
return "get-instantiations";
}
-/* class GetSynthSolutionCommand */
+/* -------------------------------------------------------------------------- */
+/* class GetSynthSolutionCommand */
+/* -------------------------------------------------------------------------- */
GetSynthSolutionCommand::GetSynthSolutionCommand() : d_smtEngine(nullptr) {}
void GetSynthSolutionCommand::invoke(SmtEngine* smtEngine)
return "get-instantiations";
}
-/* class GetQuantifierEliminationCommand */
+/* -------------------------------------------------------------------------- */
+/* class GetQuantifierEliminationCommand */
+/* -------------------------------------------------------------------------- */
GetQuantifierEliminationCommand::GetQuantifierEliminationCommand() : d_expr() {}
GetQuantifierEliminationCommand::GetQuantifierEliminationCommand(
return d_doFull ? "get-qe" : "get-qe-disjunct";
}
-/* class GetUnsatCoreCommand */
+/* -------------------------------------------------------------------------- */
+/* class GetUnsatCoreCommand */
+/* -------------------------------------------------------------------------- */
GetUnsatCoreCommand::GetUnsatCoreCommand() {}
void GetUnsatCoreCommand::invoke(SmtEngine* smtEngine)
return "get-unsat-core";
}
-/* class GetAssertionsCommand */
+/* -------------------------------------------------------------------------- */
+/* class GetAssertionsCommand */
+/* -------------------------------------------------------------------------- */
GetAssertionsCommand::GetAssertionsCommand() {}
void GetAssertionsCommand::invoke(SmtEngine* smtEngine)
return "get-assertions";
}
-/* class SetBenchmarkStatusCommand */
+/* -------------------------------------------------------------------------- */
+/* class SetBenchmarkStatusCommand */
+/* -------------------------------------------------------------------------- */
SetBenchmarkStatusCommand::SetBenchmarkStatusCommand(BenchmarkStatus status)
: d_status(status)
return "set-info";
}
-/* class SetBenchmarkLogicCommand */
+/* -------------------------------------------------------------------------- */
+/* class SetBenchmarkLogicCommand */
+/* -------------------------------------------------------------------------- */
SetBenchmarkLogicCommand::SetBenchmarkLogicCommand(std::string logic)
: d_logic(logic)
return "set-logic";
}
-/* class SetInfoCommand */
+/* -------------------------------------------------------------------------- */
+/* class SetInfoCommand */
+/* -------------------------------------------------------------------------- */
SetInfoCommand::SetInfoCommand(std::string flag, const SExpr& sexpr)
: d_flag(flag), d_sexpr(sexpr)
}
std::string SetInfoCommand::getCommandName() const { return "set-info"; }
-/* class GetInfoCommand */
+
+/* -------------------------------------------------------------------------- */
+/* class GetInfoCommand */
+/* -------------------------------------------------------------------------- */
GetInfoCommand::GetInfoCommand(std::string flag) : d_flag(flag) {}
std::string GetInfoCommand::getFlag() const { return d_flag; }
}
std::string GetInfoCommand::getCommandName() const { return "get-info"; }
-/* class SetOptionCommand */
+
+/* -------------------------------------------------------------------------- */
+/* class SetOptionCommand */
+/* -------------------------------------------------------------------------- */
SetOptionCommand::SetOptionCommand(std::string flag, const SExpr& sexpr)
: d_flag(flag), d_sexpr(sexpr)
}
std::string SetOptionCommand::getCommandName() const { return "set-option"; }
-/* class GetOptionCommand */
+
+/* -------------------------------------------------------------------------- */
+/* class GetOptionCommand */
+/* -------------------------------------------------------------------------- */
GetOptionCommand::GetOptionCommand(std::string flag) : d_flag(flag) {}
std::string GetOptionCommand::getFlag() const { return d_flag; }
}
std::string GetOptionCommand::getCommandName() const { return "get-option"; }
-/* class SetExpressionNameCommand */
+
+/* -------------------------------------------------------------------------- */
+/* class SetExpressionNameCommand */
+/* -------------------------------------------------------------------------- */
SetExpressionNameCommand::SetExpressionNameCommand(Expr expr, std::string name)
: d_expr(expr), d_name(name)
return "set-expr-name";
}
-/* class DatatypeDeclarationCommand */
+/* -------------------------------------------------------------------------- */
+/* class DatatypeDeclarationCommand */
+/* -------------------------------------------------------------------------- */
DatatypeDeclarationCommand::DatatypeDeclarationCommand(
const DatatypeType& datatype)
return "declare-datatypes";
}
-/* class RewriteRuleCommand */
+/* -------------------------------------------------------------------------- */
+/* class RewriteRuleCommand */
+/* -------------------------------------------------------------------------- */
RewriteRuleCommand::RewriteRuleCommand(const std::vector<Expr>& vars,
const std::vector<Expr>& guards,
return "rewrite-rule";
}
-/* class PropagateRuleCommand */
+/* -------------------------------------------------------------------------- */
+/* class PropagateRuleCommand */
+/* -------------------------------------------------------------------------- */
PropagateRuleCommand::PropagateRuleCommand(const std::vector<Expr>& vars,
const std::vector<Expr>& guards,
{
return "propagate-rule";
}
-
-/* output stream insertion operator for benchmark statuses */
-std::ostream& operator<<(std::ostream& out, BenchmarkStatus status)
-{
- switch (status)
- {
- case SMT_SATISFIABLE: return out << "sat";
-
- case SMT_UNSATISFIABLE: return out << "unsat";
-
- case SMT_UNKNOWN: return out << "unknown";
-
- default: return out << "BenchmarkStatus::[UNKNOWNSTATUS!]";
- }
-}
-
-} /* CVC4 namespace */
+} // namespace CVC4
/*! \file smt_engine.cpp
** \verbatim
** Top contributors (to current version):
- ** Morgan Deters, Tim King, Andrew Reynolds
+ ** Morgan Deters, Andrew Reynolds, Tim King
** This file is part of the CVC4 project.
- ** Copyright (c) 2009-2017 by the authors listed in the file AUTHORS
+ ** Copyright (c) 2009-2018 by the authors listed in the file AUTHORS
** in the top-level source directory) and their institutional affiliations.
** All rights reserved. See the file COPYING in the top-level source
** directory for licensing information.\endverbatim
Result SmtEngine::checkSat(const Expr& ex, bool inUnsatCore)
{
return checkSatisfiability(ex, inUnsatCore, false);
-} /* SmtEngine::checkSat() */
+}
+
+Result SmtEngine::checkSat(const vector<Expr>& exprs, bool inUnsatCore)
+{
+ return checkSatisfiability(exprs, inUnsatCore, false);
+}
Result SmtEngine::query(const Expr& ex, bool inUnsatCore)
{
Assert(!ex.isNull());
return checkSatisfiability(ex, inUnsatCore, true);
-} /* SmtEngine::query() */
+}
-Result SmtEngine::checkSatisfiability(const Expr& ex, bool inUnsatCore, bool isQuery) {
- try {
- Assert(ex.isNull() || ex.getExprManager() == d_exprManager);
+Result SmtEngine::query(const vector<Expr>& exprs, bool inUnsatCore)
+{
+ return checkSatisfiability(exprs, inUnsatCore, true);
+}
+
+Result SmtEngine::checkSatisfiability(const Expr& expr,
+ bool inUnsatCore,
+ bool isQuery)
+{
+ return checkSatisfiability(
+ expr.isNull() ? vector<Expr>() : vector<Expr>{expr},
+ inUnsatCore,
+ isQuery);
+}
+
+Result SmtEngine::checkSatisfiability(const vector<Expr>& exprs,
+ bool inUnsatCore,
+ bool isQuery)
+{
+ try
+ {
SmtScope smts(this);
finalOptionsAreSet();
doPendingPops();
- Trace("smt") << "SmtEngine::" << (isQuery ? "query" : "checkSat") << "(" << ex << ")" << endl;
+ Trace("smt") << "SmtEngine::" << (isQuery ? "query" : "checkSat") << "("
+ << exprs << ")" << endl;
if(d_queryMade && !options::incrementalSolving()) {
throw ModalException("Cannot make multiple queries unless "
"(try --incremental)");
}
- Expr e;
- if(!ex.isNull()) {
- // Substitute out any abstract values in ex.
- e = d_private->substituteAbstractValues(Node::fromExpr(ex)).toExpr();
- // Ensure expr is type-checked at this point.
- ensureBoolean(e);
- }
-
// check to see if a postsolve() is pending
if(d_needPostsolve) {
d_theoryEngine->postsolve();
d_needPostsolve = false;
}
-
// Note that a query has been made
d_queryMade = true;
-
// reset global negation
d_globalNegation = false;
bool didInternalPush = false;
- // Add the formula
- if(!e.isNull()) {
- // Push the context
+
+ vector<Expr> t_exprs;
+ if (isQuery)
+ {
+ size_t size = exprs.size();
+ if (size > 1)
+ {
+ /* Assume: not (BIGAND exprs) */
+ t_exprs.push_back(d_exprManager->mkExpr(kind::AND, exprs).notExpr());
+ }
+ else if (size == 1)
+ {
+ /* Assume: not expr */
+ t_exprs.push_back(exprs[0].notExpr());
+ }
+ }
+ else
+ {
+ /* Assume: BIGAND exprs */
+ t_exprs = exprs;
+ }
+
+ Result r(Result::SAT_UNKNOWN, Result::UNKNOWN_REASON);
+ for (Expr e : t_exprs)
+ {
+ // Substitute out any abstract values in ex.
+ e = d_private->substituteAbstractValues(Node::fromExpr(e)).toExpr();
+ Assert(e.getExprManager() == d_exprManager);
+ // Ensure expr is type-checked at this point.
+ ensureBoolean(e);
+
+ /* Add assumption */
internalPush();
didInternalPush = true;
-
d_problemExtended = true;
- Expr ea = isQuery ? e.notExpr() : e;
- if(d_assertionList != NULL) {
- d_assertionList->push_back(ea);
+ if (d_assertionList != NULL)
+ {
+ d_assertionList->push_back(e);
}
- d_private->addFormula(ea.getNode(), inUnsatCore);
+ d_private->addFormula(e.getNode(), inUnsatCore);
}
- Result r(Result::SAT_UNKNOWN, Result::UNKNOWN_REASON);
r = isQuery ? check().asValidityResult() : check().asSatisfiabilityResult();
- if ( ( options::solveRealAsInt() || options::solveIntAsBV() > 0 ) && r.asSatisfiabilityResult().isSat() == Result::UNSAT) {
+ if ((options::solveRealAsInt() || options::solveIntAsBV() > 0)
+ && r.asSatisfiabilityResult().isSat() == Result::UNSAT)
+ {
r = Result(Result::SAT_UNKNOWN, Result::UNKNOWN_REASON);
}
// flipped if we did a global negation
d_needPostsolve = true;
// Dump the query if requested
- if(Dump.isOn("benchmark")) {
+ if (Dump.isOn("benchmark"))
+ {
// the expr already got dumped out if assertion-dumping is on
- if( isQuery ){
- Dump("benchmark") << QueryCommand(ex);
- }else{
- Dump("benchmark") << CheckSatCommand(ex);
+ if (isQuery && exprs.size() == 1)
+ {
+ Dump("benchmark") << QueryCommand(exprs[0]);
+ }
+ else
+ {
+ Dump("benchmark") << CheckSatAssumingCommand(t_exprs, inUnsatCore);
}
}
d_problemExtended = false;
- Trace("smt") << "SmtEngine::" << (isQuery ? "query" : "checkSat") << "(" << e << ") => " << r << endl;
+ Trace("smt") << "SmtEngine::" << (isQuery ? "query" : "checkSat") << "("
+ << exprs << ") => " << r << endl;
// Check that SAT results generate a model correctly.
if(options::checkModels()) {