void TptpPrinter::toStream(std::ostream& out, const Model& m) const
{
- out << "% SZS output start FiniteModel for " << m.getInputName() << endl;
+ std::string statusName(m.isKnownSat() ? "FiniteModel"
+ : "CandidateFiniteModel");
+ out << "% SZS output start " << statusName << " for " << m.getInputName()
+ << endl;
for(size_t i = 0; i < m.getNumCommands(); ++i) {
this->Printer::toStreamUsing(language::output::LANG_SMTLIB_V2_5, out, m, m.getCommand(i));
}
- out << "% SZS output end FiniteModel for " << m.getInputName() << endl;
+ out << "% SZS output end " << statusName << " for " << m.getInputName()
+ << endl;
}
void TptpPrinter::toStream(std::ostream& out,
return out;
}
-Model::Model() :
- d_smt(*smt::currentSmtEngine()) {
-}
+Model::Model() : d_smt(*smt::currentSmtEngine()), d_isKnownSat(false) {}
size_t Model::getNumCommands() const {
return d_smt.d_modelCommands->size() + d_smt.d_modelGlobalCommands.size();
friend std::ostream& operator<<(std::ostream&, const Model&);
friend class SmtEngine;
- /** the input name (file name, etc.) this model is associated to */
- std::string d_inputName;
-
protected:
/** The SmtEngine we're associated with */
SmtEngine& d_smt;
const SmtEngine* getSmtEngine() const { return &d_smt; }
/** get the input name (file name, etc.) this model is associated to */
std::string getInputName() const { return d_inputName; }
+ /**
+ * Returns true if this model is guaranteed to be a model of the input
+ * formula. Notice that when CVC4 answers "unknown", it may have a model
+ * available for which this method returns false. In this case, this model is
+ * only a candidate solution.
+ */
+ bool isKnownSat() const { return d_isKnownSat; }
//--------------------------- model cores
/** set using model core
*
* this model.
*/
virtual std::vector<Expr> getDomainElements(Type t) const = 0;
+
+ protected:
+ /** the input name (file name, etc.) this model is associated to */
+ std::string d_inputName;
+ /**
+ * Flag set to false if the model is associated with an "unknown" response
+ * from the solver.
+ */
+ bool d_isKnownSat;
};/* class Model */
class ModelBuilder {
throw RecoverableModalException(ss.str().c_str());
}
- if (d_smtMode != SMT_MODE_SAT)
+ if (d_smtMode != SMT_MODE_SAT && d_smtMode != SMT_MODE_SAT_UNKNOWN)
{
std::stringstream ss;
ss << "Cannot " << c
{
d_smtMode = SMT_MODE_UNSAT;
}
- else
+ else if (d_status.asSatisfiabilityResult().isSat() == Result::SAT)
{
- // Notice that unknown response moves to sat mode, since the same set
- // of commands (get-model, get-value) are applicable to this case.
d_smtMode = SMT_MODE_SAT;
}
+ else
+ {
+ d_smtMode = SMT_MODE_SAT_UNKNOWN;
+ }
Trace("smt") << "SmtEngine::" << (isQuery ? "query" : "checkSat") << "("
<< assumptions << ") => " << r << endl;
ModelCoreBuilder::setModelCore(eassertsProc, m, options::modelCoresMode());
}
m->d_inputName = d_filename;
+ m->d_isKnownSat = (d_smtMode == SMT_MODE_SAT);
return m;
}
typedef context::CDList<Node> NodeList;
/**
- * The current mode of the solver, see Figure 4.1 on page 52 of the
- * SMT-LIB version 2.6 standard
+ * The current mode of the solver, which is an extension of Figure 4.1 on
+ * page 52 of the SMT-LIB version 2.6 standard
* http://smtlib.cs.uiowa.edu/papers/smt-lib-reference-v2.6-r2017-07-18.pdf
*/
enum SmtMode
SMT_MODE_START,
// normal state of the solver, after assert/push/pop/declare/define
SMT_MODE_ASSERT,
- // immediately after a check-sat returning "sat" or "unknown"
+ // immediately after a check-sat returning "sat"
SMT_MODE_SAT,
+ // immediately after a check-sat returning "unknown"
+ SMT_MODE_SAT_UNKNOWN,
// immediately after a check-sat returning "unsat"
SMT_MODE_UNSAT,
// immediately after a successful call to get-abduct