summaryrefslogtreecommitdiff
path: root/src/theory
diff options
context:
space:
mode:
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>2021-07-12 12:20:57 -0500
committerGitHub <noreply@github.com>2021-07-12 10:20:57 -0700
commitb71bf740b517c3a530d92c33bd24769330708d76 (patch)
treea3a772f8d3b8254ffa80f783b8cf6ccd951f5ddc /src/theory
parenta6f629584c25faf34dbb9bc1c044aa0db57713ef (diff)
Improvements to debug check model (#6861)
This makes it so that debug-check-models applies in production mode, not just in debug mode. It also verifies that type constraints are met.
Diffstat (limited to 'src/theory')
-rw-r--r--src/theory/model_manager.cpp6
-rw-r--r--src/theory/theory_model_builder.cpp26
2 files changed, 18 insertions, 14 deletions
diff --git a/src/theory/model_manager.cpp b/src/theory/model_manager.cpp
index c1c488f65..0d56dd6db 100644
--- a/src/theory/model_manager.cpp
+++ b/src/theory/model_manager.cpp
@@ -95,10 +95,10 @@ bool ModelManager::buildModel()
// 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 "
diff --git a/src/theory/theory_model_builder.cpp b/src/theory/theory_model_builder.cpp
index e3e197953..e43cb26c8 100644
--- a/src/theory/theory_model_builder.cpp
+++ b/src/theory/theory_model_builder.cpp
@@ -1089,7 +1089,6 @@ void TheoryEngineModelBuilder::postProcessModel(bool incomplete, TheoryModel* m)
void TheoryEngineModelBuilder::debugCheckModel(TheoryModel* tm)
{
-#ifdef CVC5_ASSERTIONS
if (tm->hasApproximations())
{
// models with approximations may fail the assertions below
@@ -1111,7 +1110,7 @@ void TheoryEngineModelBuilder::debugCheckModel(TheoryModel* tm)
// 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)
@@ -1119,21 +1118,26 @@ void TheoryEngineModelBuilder::debugCheckModel(TheoryModel* tm)
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);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback