// now, finish building the model
d_modelBuiltSuccess = finishBuildModel();
- if (Trace.isOn("model-builder"))
+ if (Trace.isOn("model-final"))
{
- Trace("model-builder") << "Final model:" << std::endl;
- Trace("model-builder") << d_model->debugPrintModelEqc() << std::endl;
+ Trace("model-final") << "Final model:" << std::endl;
+ Trace("model-final") << d_model->debugPrintModelEqc() << std::endl;
}
Trace("model-builder") << "ModelManager: model built success is "
void TheoryEngineModelBuilder::debugCheckModel(TheoryModel* tm)
{
-#ifdef CVC5_ASSERTIONS
if (tm->hasApproximations())
{
// models with approximations may fail the assertions below
// if Boolean, it does not necessarily have a constant representative, use
// get value instead
rep = tm->getValue(eqc);
- Assert(rep.isConst());
+ AlwaysAssert(rep.isConst());
}
eq::EqClassIterator eqc_i = eq::EqClassIterator(eqc, tm->d_equalityEngine);
for (; !eqc_i.isFinished(); ++eqc_i)
Node n = *eqc_i;
static int repCheckInstance = 0;
++repCheckInstance;
-
+ AlwaysAssert(rep.getType().isSubtypeOf(n.getType()))
+ << "Representative " << rep << " of " << n
+ << " violates type constraints (" << rep.getType() << " and "
+ << n.getType() << ")";
// non-linear mult is not necessarily accurate wrt getValue
if (n.getKind() != kind::NONLINEAR_MULT)
{
- Debug("check-model::rep-checking") << "( " << repCheckInstance << ") "
- << "n: " << n << endl
- << "getValue(n): " << tm->getValue(n)
- << endl
- << "rep: " << rep << endl;
- Assert(tm->getValue(*eqc_i) == rep)
- << "run with -d check-model::rep-checking for details";
+ if (tm->getValue(*eqc_i) != rep)
+ {
+ std::stringstream err;
+ err << "Failed representative check:" << std::endl
+ << "( " << repCheckInstance << ") "
+ << "n: " << n << endl
+ << "getValue(n): " << tm->getValue(n) << std::endl
+ << "rep: " << rep << std::endl;
+ AlwaysAssert(tm->getValue(*eqc_i) == rep) << err.str();
+ }
}
}
}
-#endif /* CVC5_ASSERTIONS */
// builder-specific debugging
debugModel(tm);