Weaken assertion in CEGQI (#7548)
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>
Mon, 1 Nov 2021 23:04:16 +0000 (18:04 -0500)
committerGitHub <noreply@github.com>
Mon, 1 Nov 2021 23:04:16 +0000 (23:04 +0000)
The assertion can be violated in mixed Int/Real arithmetic. The instantiator utility nevertheless safe guards Int vs Real subtyping.

Fixes #7537.

src/theory/quantifiers/cegqi/ceg_instantiator.cpp
test/regress/CMakeLists.txt
test/regress/regress1/quantifiers/issue7537-cegqi-comp-types.smt2 [new file with mode: 0644]

index 28314c730c80c672180ed39df45ae252a0675716..9dc11955bbed073b8dcec9a5fe8f81d87c07d327 100644 (file)
@@ -1076,7 +1076,7 @@ bool CegInstantiator::doAddInstantiation(std::vector<Node>& vars,
       Node n = it->second;
       Trace("cegqi-inst-debug") << "  " << d_input_vars[i] << " -> " << n
                                << std::endl;
-      Assert(n.getType().isSubtypeOf(d_input_vars[i].getType()));
+      Assert(n.getType().isComparableTo(d_input_vars[i].getType()));
       subs.push_back( n );
     }
   }
@@ -1088,7 +1088,7 @@ bool CegInstantiator::doAddInstantiation(std::vector<Node>& vars,
       Node v = d_input_vars[i];
       Trace("cegqi-inst") << i << " (" << d_curr_iphase[v] << ") : " 
                          << v << " -> " << subs[i] << std::endl;
-      Assert(subs[i].getType().isSubtypeOf(v.getType()));
+      Assert(subs[i].getType().isComparableTo(v.getType()));
     }
   }
   Trace("cegqi-inst-debug") << "Do the instantiation...." << std::endl;
index 67c31240f16bb45a3373d9c0ab7e62d7bcbbb70d..7c53e27affe8719f1fee19c15537e7e386a420c6 100644 (file)
@@ -1983,6 +1983,7 @@ set(regress_1_tests
   regress1/quantifiers/issue6775-vts-int.smt2
   regress1/quantifiers/issue6845-nl-lemma-tc.smt2
   regress1/quantifiers/issue7385-sygus-inst-i.smt2
+  regress1/quantifiers/issue7537-cegqi-comp-types.smt2
   regress1/quantifiers/issue993.smt2
   regress1/quantifiers/javafe.ast.StmtVec.009.smt2
   regress1/quantifiers/lia-witness-div-pp.smt2
diff --git a/test/regress/regress1/quantifiers/issue7537-cegqi-comp-types.smt2 b/test/regress/regress1/quantifiers/issue7537-cegqi-comp-types.smt2
new file mode 100644 (file)
index 0000000..bc9691e
--- /dev/null
@@ -0,0 +1,6 @@
+(set-logic ALL)
+(set-info :status sat)
+(declare-fun r1 () Real)
+(declare-fun r5 () Real)
+(assert (forall ((q102 Int)) (or (= q102 (/ r1 r5)) (= (= 0.0 q102) (< 1.0 (/ r1 r5))))))
+(check-sat)