Fixes cvc5/cvc5-projects#436.
return false;
}
+bool SetDefaults::usesInputConversion(const Options& opts,
+ std::ostream& reason) const
+{
+ if (opts.smt.solveBVAsInt != options::SolveBVAsIntMode::OFF)
+ {
+ reason << "solveBVAsInt";
+ return true;
+ }
+ if (opts.smt.solveIntAsBV > 0)
+ {
+ reason << "solveIntAsBV";
+ return true;
+ }
+ if (opts.smt.solveRealAsInt)
+ {
+ reason << "solveRealAsInt";
+ return true;
+ }
+ return false;
+}
+
bool SetDefaults::incompatibleWithProofs(Options& opts,
std::ostream& reason) const
{
return opts.smt.unsatCoresMode == options::UnsatCoresMode::ASSUMPTIONS;
}
+bool SetDefaults::incompatibleWithSygus(Options& opts,
+ std::ostream& reason) const
+{
+ // sygus should not be combined with preprocessing passes that convert the
+ // input
+ if (usesInputConversion(opts, reason))
+ {
+ return true;
+ }
+ return false;
+}
+
bool SetDefaults::incompatibleWithQuantifiers(Options& opts,
std::ostream& reason) const
{
// if we are attempting to rewrite everything to SyGuS, use sygus()
if (usesSygus(opts))
{
+ std::stringstream reasonNoSygus;
+ if (incompatibleWithSygus(opts, reasonNoSygus))
+ {
+ std::stringstream ss;
+ ss << reasonNoSygus.str() << " not supported in sygus.";
+ throw OptionException(ss.str());
+ }
+ // now, set defaults based on sygus
setDefaultsSygus(opts);
}
// counterexample-guided instantiation for non-sygus
* Determine whether we will be using SyGuS.
*/
bool usesSygus(const Options& opts) const;
+ /**
+ * Does options enable an input conversion, e.g. solve-bv-as-int?
+ * If this method returns true, then reason is updated with the name of the
+ * option.
+ */
+ bool usesInputConversion(const Options& opts, std::ostream& reason) const;
/**
* Check if incompatible with incremental mode. Notice this method may modify
* the options to ensure that we are compatible with incremental mode.
* techniques that may interfere with producing correct unsat cores.
*/
bool safeUnsatCores(const Options& opts) const;
+ /**
+ * Check if incompatible with sygus. Notice this method may
+ * modify the options to ensure that we are compatible with sygus.
+ * The output stream reason is similar to above.
+ */
+ bool incompatibleWithSygus(Options& opts, std::ostream& reason) const;
/**
* Check if incompatible with quantified formulas. Notice this method may
* modify the options to ensure that we are compatible with quantified logics.
ASSERT_NO_THROW(slv.simplify(t54));
}
+TEST_F(TestApiBlackSolver, proj_issue436)
+{
+ Solver slv;
+ slv.setOption("produce-abducts", "true");
+ slv.setOption("solve-bv-as-int", "sum");
+ Sort s8 = slv.mkBitVectorSort(68);
+ Term t17 = slv.mkConst(s8, "_x6");
+ Term t23;
+ {
+ uint32_t bw = s8.getBitVectorSize();
+ t23 = slv.mkBitVector(bw, 1);
+ }
+ Term t33 = slv.mkTerm(Kind::BITVECTOR_ULT, {t17, t23});
+ Term abduct;
+ // solve-bv-as-int is incompatible with get-abduct
+ ASSERT_THROW(slv.getAbduct(t33, abduct), CVC5ApiException);
+}
+
TEST_F(TestApiBlackSolver, proj_issue431)
{
Solver slv;