#include "decision/decision_engine.h"
#include "expr/bound_var_manager.h"
#include "expr/node.h"
+#include "expr/node_algorithm.h"
#include "options/base_options.h"
#include "options/expr_options.h"
#include "options/language.h"
finishInit();
d_state->doPendingPops();
+ // as an optimization we do not check whether formula is well-formed here, and
+ // defer this check for certain cases within the assertions module.
Trace("smt") << "SolverEngine::assertFormula(" << formula << ")" << endl;
// Substitute out any abstract values in ex
{
SolverEngineScope smts(this);
+ ensureWellFormedTerm(ex, "get value");
Trace("smt") << "SMT getValue(" << ex << ")" << endl;
TypeNode expectedType = ex.getType();
finishInit();
+ for (const Node& e : exprs)
+ {
+ ensureWellFormedTerm(e, "block model values");
+ }
+
TheoryModel* m = getAvailableModel("block model values");
// get expanded assertions
const Options& SolverEngine::options() const { return d_env->getOptions(); }
+void SolverEngine::ensureWellFormedTerm(const Node& n,
+ const std::string& src) const
+{
+ bool wasShadow = false;
+ if (expr::hasFreeOrShadowedVar(n, wasShadow))
+ {
+ std::string varType(wasShadow ? "shadowed" : "free");
+ std::stringstream se;
+ se << "Cannot process term with " << varType << " variable in " << src
+ << ".";
+ throw ModalException(se.str().c_str());
+ }
+}
+
std::vector<Node> SolverEngine::getExpandedAssertions()
{
std::vector<Node> easserts = getAssertions();
*/
const Options& options() const;
+ /**
+ * Check that the given term is a valid closed term, which can be used as an
+ * argument to, e.g., assert, get-value, block-model-values, etc.
+ *
+ * @param n The node to check
+ * @param src The source of the check, which is printed in the exception if
+ * this check fails.
+ */
+ void ensureWellFormedTerm(const Node& n, const std::string& src) const;
+
/* Members -------------------------------------------------------------- */
/** Solver instance that owns this SolverEngine instance. */
ASSERT_NO_THROW(slv.simplify(t54));
}
+TEST_F(TestApiBlackSolver, proj_issue431)
+{
+ Solver slv;
+ slv.setOption("produce-models", "true");
+ slv.setOption("produce-unsat-assumptions", "true");
+ slv.setOption("produce-assertions", "true");
+ Sort s1 = slv.getStringSort();
+ Sort s3 = slv.getIntegerSort();
+ Sort s7 = slv.mkArraySort(s1, s3);
+ Term t3 = slv.mkConst(s1, "_x2");
+ Term t57 = slv.mkVar(s7, "_x38");
+ Term t103 = slv.mkTerm(Kind::SELECT, {t57, t3});
+ slv.checkSat();
+ ASSERT_THROW(slv.blockModelValues({t103}), CVC5ApiException);
+}
+
} // namespace test
} // namespace cvc5