The internal solver no longer cares about what assertions are named / are in the unsat core.
This simplifies the code so that the (now unused) `inUnsatCore` flag is removed from all interfaces.
This eliminates another external use of `getSmtEngine`.
ASSERT_TOK { PARSER_STATE->checkThatLogicIsSet(); }
{ PARSER_STATE->clearLastNamedTerm(); }
term[expr, expr2]
- { bool inUnsatCore = PARSER_STATE->lastNamedTerm().first == expr;
- cmd->reset(new AssertCommand(expr, inUnsatCore));
- if(inUnsatCore) {
+ { cmd->reset(new AssertCommand(expr));
+ if (PARSER_STATE->lastNamedTerm().first == expr)
+ {
// set the expression name, if there was a named term
std::pair<api::Term, std::string> namedTerm =
PARSER_STATE->lastNamedTerm();
SYM_MAN->setExpressionName(aexpr, name, true);
}
// make the command to assert the formula
- cmd = PARSER_STATE->makeAssertCommand(fr, aexpr, /* cnf == */ true, true);
+ cmd = PARSER_STATE->makeAssertCommand(fr, aexpr, true);
}
| FOF_TOK LPAREN_TOK nameN[name] COMMA_TOK formulaRole[fr] COMMA_TOK
{ PARSER_STATE->setCnf(false); PARSER_STATE->setFof(true); }
SYM_MAN->setExpressionName(aexpr, name, true);
}
// make the command to assert the formula
- cmd = PARSER_STATE->makeAssertCommand(fr, aexpr, /* cnf == */ false, true);
+ cmd = PARSER_STATE->makeAssertCommand(fr, aexpr, false);
}
| TFF_TOK LPAREN_TOK nameN[name] COMMA_TOK
( TYPE_TOK COMMA_TOK tffTypedAtom[cmd]
SYM_MAN->setExpressionName(aexpr, name, true);
}
// make the command to assert the formula
- cmd = PARSER_STATE->makeAssertCommand(fr, aexpr, /* cnf == */ false, true);
+ cmd = PARSER_STATE->makeAssertCommand(fr, aexpr, false);
}
) RPAREN_TOK DOT_TOK
| THF_TOK
SYM_MAN->setExpressionName(aexpr, name, true);
}
// make the command to assert the formula
- cmd = PARSER_STATE->makeAssertCommand(
- fr, aexpr, /* cnf == */ false, true);
+ cmd = PARSER_STATE->makeAssertCommand(fr, aexpr, false);
}
) RPAREN_TOK DOT_TOK
| INCLUDE_TOK LPAREN_TOK unquotedFileName[name]
cvc5::api::Term aexpr = PARSER_STATE->getAssertionDistinctConstants();
if( !aexpr.isNull() )
{
- seq->addCommand(new AssertCommand(aexpr, false));
+ seq->addCommand(new AssertCommand(aexpr));
}
std::string filename = PARSER_STATE->getInput()->getInputStreamName();
return d_nullExpr;
}
-Command* Tptp::makeAssertCommand(FormulaRole fr,
- api::Term expr,
- bool cnf,
- bool inUnsatCore)
+Command* Tptp::makeAssertCommand(FormulaRole fr, api::Term expr, bool cnf)
{
// For SZS ontology compliance.
// if we're in cnf() though, conjectures don't result in "Theorem" or
if( expr.isNull() ){
return new EmptyCommand("Untreated role for expression");
}else{
- return new AssertCommand(expr, inUnsatCore);
+ return new AssertCommand(expr);
}
}
* getAssertionExpr above). This may set a flag in the parser to mark
* that we have asserted a conjecture.
*/
- Command* makeAssertCommand(FormulaRole fr,
- api::Term expr,
- bool cnf,
- bool inUnsatCore);
+ Command* makeAssertCommand(FormulaRole fr, api::Term expr, bool cnf);
/** Ugly hack because I don't know how to return an expression from a
token */
}
void Assertions::initializeCheckSat(const std::vector<Node>& assumptions,
- bool inUnsatCore,
bool isEntailmentCheck)
{
NodeManager* nm = NodeManager::currentNM();
Node n = d_absValues.substituteAbstractValues(e);
// Ensure expr is type-checked at this point.
ensureBoolean(n);
- addFormula(n, inUnsatCore, true, true, false, false);
+ addFormula(n, true, true, false, false);
}
if (d_globalDefineFunLemmas != nullptr)
{
// zero assertions)
for (const Node& lemma : *d_globalDefineFunLemmas)
{
- addFormula(lemma, false, true, false, true, false);
+ addFormula(lemma, true, false, true, false);
}
}
}
-void Assertions::assertFormula(const Node& n, bool inUnsatCore)
+void Assertions::assertFormula(const Node& n)
{
ensureBoolean(n);
bool maybeHasFv = language::isInputLangSygus(options::inputLanguage());
- addFormula(n, inUnsatCore, true, false, false, maybeHasFv);
+ addFormula(n, true, false, false, maybeHasFv);
}
std::vector<Node>& Assertions::getAssumptions() { return d_assumptions; }
}
void Assertions::addFormula(TNode n,
- bool inUnsatCore,
bool inInput,
bool isAssumption,
bool isFunDef,
return;
}
Trace("smt") << "SmtEnginePrivate::addFormula(" << n
- << "), inUnsatCore = " << inUnsatCore
<< ", inInput = " << inInput
<< ", isAssumption = " << isAssumption
<< ", isFunDef = " << isFunDef << std::endl;
{
// we don't check for free variables here, since even if we are sygus,
// we could contain functions-to-synthesize within definitions.
- addFormula(n, false, true, false, true, false);
+ addFormula(n, true, false, true, false);
}
}
* upcoming check-sat call.
*
* @param assumptions The assumptions of the upcoming check-sat call.
- * @param inUnsatCore Whether assumptions are in the unsat core.
* @param isEntailmentCheck Whether we are checking entailment of assumptions
* in the upcoming check-sat call.
*/
void initializeCheckSat(const std::vector<Node>& assumptions,
- bool inUnsatCore,
bool isEntailmentCheck);
/**
* Add a formula to the current context: preprocess, do per-theory
* setup, use processAssertionList(), asserting to T-solver for
* literals and conjunction of literals. Returns false if
- * immediately determined to be inconsistent. This version
- * takes a Boolean flag to determine whether to include this asserted
- * formula in an unsat core (if one is later requested).
+ * immediately determined to be inconsistent.
*
* @throw TypeCheckingException, LogicException, UnsafeInterruptException
*/
- void assertFormula(const Node& n, bool inUnsatCore = true);
+ void assertFormula(const Node& n);
/**
* Assert that n corresponds to an assertion from a define-fun or
* define-fun-rec command.
* (this is used to distinguish assertions and assumptions)
*/
void addFormula(TNode n,
- bool inUnsatCore,
bool inInput,
bool isAssumption,
bool isFunDef,
/* class AssertCommand */
/* -------------------------------------------------------------------------- */
-AssertCommand::AssertCommand(const api::Term& t, bool inUnsatCore)
- : d_term(t), d_inUnsatCore(inUnsatCore)
-{
-}
+AssertCommand::AssertCommand(const api::Term& t) : d_term(t) {}
api::Term AssertCommand::getTerm() const { return d_term; }
void AssertCommand::invoke(api::Solver* solver, SymbolManager* sm)
{
try
{
- solver->getSmtEngine()->assertFormula(termToNode(d_term), d_inUnsatCore);
+ solver->assertFormula(d_term);
d_commandStatus = CommandSuccess::instance();
}
catch (UnsafeInterruptException& e)
}
}
-Command* AssertCommand::clone() const
-{
- return new AssertCommand(d_term, d_inUnsatCore);
-}
+Command* AssertCommand::clone() const { return new AssertCommand(d_term); }
std::string AssertCommand::getCommandName() const { return "assert"; }
/* class QueryCommand */
/* -------------------------------------------------------------------------- */
-QueryCommand::QueryCommand(const api::Term& t, bool inUnsatCore)
- : d_term(t), d_inUnsatCore(inUnsatCore)
-{
-}
+QueryCommand::QueryCommand(const api::Term& t) : d_term(t) {}
api::Term QueryCommand::getTerm() const { return d_term; }
void QueryCommand::invoke(api::Solver* solver, SymbolManager* sm)
Command* QueryCommand::clone() const
{
- QueryCommand* c = new QueryCommand(d_term, d_inUnsatCore);
+ QueryCommand* c = new QueryCommand(d_term);
c->d_result = d_result;
return c;
}
{
protected:
api::Term d_term;
- bool d_inUnsatCore;
public:
- AssertCommand(const api::Term& t, bool inUnsatCore = true);
+ AssertCommand(const api::Term& t);
api::Term getTerm() const;
protected:
api::Term d_term;
api::Result d_result;
- bool d_inUnsatCore;
public:
- QueryCommand(const api::Term& t, bool inUnsatCore = true);
+ QueryCommand(const api::Term& t);
api::Term getTerm() const;
api::Result getResult() const;
Assert(ne.getNumChildren() == 3);
// We consider this to be an entailment check, which also avoids incorrect
// status reporting (see SmtEngineState::d_expectedStatus).
- Result r =
- d_smtSolver.checkSatisfiability(as, std::vector<Node>{ne}, false, true);
+ Result r = d_smtSolver.checkSatisfiability(as, std::vector<Node>{ne}, true);
Trace("smt-qe") << "Query returned " << r << std::endl;
if (r.asSatisfiabilityResult().isSat() != Result::UNSAT)
{
return checkSat(nullNode);
}
-Result SmtEngine::checkSat(const Node& assumption, bool inUnsatCore)
+Result SmtEngine::checkSat(const Node& assumption)
{
if (Dump.isOn("benchmark"))
{
{
assump.push_back(assumption);
}
- return checkSatInternal(assump, inUnsatCore, false);
+ return checkSatInternal(assump, false);
}
-Result SmtEngine::checkSat(const std::vector<Node>& assumptions,
- bool inUnsatCore)
+Result SmtEngine::checkSat(const std::vector<Node>& assumptions)
{
if (Dump.isOn("benchmark"))
{
assumptions);
}
}
- return checkSatInternal(assumptions, inUnsatCore, false);
+ return checkSatInternal(assumptions, false);
}
-Result SmtEngine::checkEntailed(const Node& node, bool inUnsatCore)
+Result SmtEngine::checkEntailed(const Node& node)
{
if (Dump.isOn("benchmark"))
{
}
return checkSatInternal(
node.isNull() ? std::vector<Node>() : std::vector<Node>{node},
- inUnsatCore,
true)
.asEntailmentResult();
}
-Result SmtEngine::checkEntailed(const std::vector<Node>& nodes,
- bool inUnsatCore)
+Result SmtEngine::checkEntailed(const std::vector<Node>& nodes)
{
- return checkSatInternal(nodes, inUnsatCore, true).asEntailmentResult();
+ return checkSatInternal(nodes, true).asEntailmentResult();
}
Result SmtEngine::checkSatInternal(const std::vector<Node>& assumptions,
- bool inUnsatCore,
bool isEntailmentCheck)
{
try
<< assumptions << ")" << endl;
// check the satisfiability with the solver object
Result r = d_smtSolver->checkSatisfiability(
- *d_asserts.get(), assumptions, inUnsatCore, isEntailmentCheck);
+ *d_asserts.get(), assumptions, isEntailmentCheck);
Trace("smt") << "SmtEngine::" << (isEntailmentCheck ? "query" : "checkSat")
<< "(" << assumptions << ") => " << r << endl;
return res;
}
-Result SmtEngine::assertFormula(const Node& formula, bool inUnsatCore)
+Result SmtEngine::assertFormula(const Node& formula)
{
SmtScope smts(this);
finishInit();
// Substitute out any abstract values in ex
Node n = d_absValues->substituteAbstractValues(formula);
- d_asserts->assertFormula(n, inUnsatCore);
+ d_asserts->assertFormula(n);
return quickCheck().asEntailmentResult();
}/* SmtEngine::assertFormula() */
* Add a formula to the current context: preprocess, do per-theory
* setup, use processAssertionList(), asserting to T-solver for
* literals and conjunction of literals. Returns false if
- * immediately determined to be inconsistent. This version
- * takes a Boolean flag to determine whether to include this asserted
- * formula in an unsat core (if one is later requested).
+ * immediately determined to be inconsistent. Note this formula will
+ * be included in the unsat core when applicable.
*
* @throw TypeCheckingException, LogicException, UnsafeInterruptException
*/
- Result assertFormula(const Node& formula, bool inUnsatCore = true);
+ Result assertFormula(const Node& formula);
/**
* Reduce an unsatisfiable core to make it minimal.
*
* @throw Exception
*/
- Result checkEntailed(const Node& assumption, bool inUnsatCore = true);
- Result checkEntailed(const std::vector<Node>& assumptions,
- bool inUnsatCore = true);
+ Result checkEntailed(const Node& assumption);
+ Result checkEntailed(const std::vector<Node>& assumptions);
/**
* Assert a formula (if provided) to the current context and call
* @throw Exception
*/
Result checkSat();
- Result checkSat(const Node& assumption, bool inUnsatCore = true);
- Result checkSat(const std::vector<Node>& assumptions,
- bool inUnsatCore = true);
+ Result checkSat(const Node& assumption);
+ Result checkSat(const std::vector<Node>& assumptions);
/**
* Returns a set of so-called "failed" assumptions.
* Check satisfiability (used to check satisfiability and entailment).
*/
Result checkSatInternal(const std::vector<Node>& assumptions,
- bool inUnsatCore,
bool isEntailmentCheck);
/**
Result SmtSolver::checkSatisfiability(Assertions& as,
const std::vector<Node>& assumptions,
- bool inUnsatCore,
bool isEntailmentCheck)
{
// update the state to indicate we are about to run a check-sat
d_state.notifyCheckSat(hasAssumptions);
// then, initialize the assertions
- as.initializeCheckSat(assumptions, inUnsatCore, isEntailmentCheck);
+ as.initializeCheckSat(assumptions, isEntailmentCheck);
// make the check
Assert(d_smt.isFullyInited());
* during this call.
* @param assumptions The assumptions for this check-sat call, which are
* temporary assertions.
- * @param inUnsatCore Whether assumptions are in the unsat core.
* @param isEntailmentCheck Whether this is an entailment check (assumptions
* are negated in this case).
*/
Result checkSatisfiability(Assertions& as,
const std::vector<Node>& assumptions,
- bool inUnsatCore,
bool isEntailmentCheck);
/**
* Process the assertions that have been asserted in as. This moves the set of
query.push_back(body);
}
- Result r = d_smtSolver.checkSatisfiability(as, query, false, false);
+ Result r = d_smtSolver.checkSatisfiability(as, query, false);
// Check that synthesis solutions satisfy the conjecture
if (options::checkSynthSol()