Do not debug check model for models with approximations (#3673)
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>
Thu, 30 Jan 2020 09:32:47 +0000 (03:32 -0600)
committerGitHub <noreply@github.com>
Thu, 30 Jan 2020 09:32:47 +0000 (01:32 -0800)
We don't run check-model for models with approximate values, however we were still running the internal debugCheckModel method, which leads to assertion failures. This disables this check.

Fixes #3652.

src/theory/theory_model_builder.cpp
test/regress/CMakeLists.txt
test/regress/regress0/nl/issue3652.smt2 [new file with mode: 0644]

index 11758f1e9d1143a6343326ae33683865aa7ab10e..02dded8b3f98da87a5bf502f73f16bedc84237bf 100644 (file)
@@ -1127,6 +1127,11 @@ void TheoryEngineModelBuilder::debugCheckModel(TheoryModel* tm)
 {
 #ifdef CVC4_ASSERTIONS
   Assert(tm->isBuilt());
+  if (tm->hasApproximations())
+  {
+    // models with approximations may fail the assertions below
+    return;
+  }
   eq::EqClassesIterator eqcs_i = eq::EqClassesIterator(tm->d_equalityEngine);
   std::map<Node, Node>::iterator itMap;
   // Check that every term evaluates to its representative in the model
index bd36657276972bce001bd968ff0394d4d64bead2..b35c13757f636c4f151775a0a7c0fc3594e873ff 100644 (file)
@@ -549,6 +549,7 @@ set(regress_0_tests
   regress0/nl/issue3407.smt2
   regress0/nl/issue3411.smt2
   regress0/nl/issue3475.smt2
+  regress0/nl/issue3652.smt2
   regress0/nl/magnitude-wrong-1020-m.smt2
   regress0/nl/mult-po.smt2
   regress0/nl/nia-wrong-tl.smt2
diff --git a/test/regress/regress0/nl/issue3652.smt2 b/test/regress/regress0/nl/issue3652.smt2
new file mode 100644 (file)
index 0000000..f3429b7
--- /dev/null
@@ -0,0 +1,7 @@
+;COMMAND-LINE: --check-models
+;EXIT: 1
+;EXPECT: (error "Cannot run check-model on a model with approximate values.")
+(set-logic QF_NRA)
+(declare-fun a () Real)
+(assert (= (* a a) 2))
+(check-sat)