Fix BV-abstraction check to consider SKOLEM. (#2042)
authorMathias Preiner <mathias.preiner@gmail.com>
Sat, 2 Jun 2018 18:18:36 +0000 (11:18 -0700)
committerAndres Noetzli <andres.noetzli@gmail.com>
Sat, 2 Jun 2018 18:18:36 +0000 (11:18 -0700)
Further, fix a bug in the AIG bitblaster that was also uncovered with the
minimized file.

src/theory/bv/abstraction.cpp
src/theory/bv/bitblast/aig_bitblaster.cpp
src/theory/bv/bitblast/aig_bitblaster.h
test/regress/Makefile.tests
test/regress/regress0/bv/bv-abstr-bug2.smt2 [new file with mode: 0644]

index 46ccc4c3d5376e38b6fe91535b39b112435cff46..f0c1d548812bbc9d0e1d691081ee4d6991c43dc2 100644 (file)
@@ -276,7 +276,7 @@ Node AbstractionModule::computeSignature(TNode node) {
 
 Node AbstractionModule::getSignatureSkolem(TNode node)
 {
-  Assert(node.getKind() == kind::VARIABLE);
+  Assert(node.getMetaKind() == kind::metakind::VARIABLE);
   NodeManager* nm = NodeManager::currentNM();
   unsigned bitwidth = utils::getSize(node);
   if (d_signatureSkolems.find(bitwidth) == d_signatureSkolems.end())
@@ -550,8 +550,9 @@ void AbstractionModule::collectArguments(TNode node, TNode signature, std::vecto
   if (seen.find(node)!= seen.end())
     return;
 
-  if (node.getKind() == kind::VARIABLE ||
-      node.getKind() == kind::CONST_BITVECTOR) {
+  if (node.getMetaKind() == kind::metakind::VARIABLE
+      || node.getKind() == kind::CONST_BITVECTOR)
+  {
     // a constant in the node can either map to an argument of the abstraction
     // or can be hard-coded and part of the abstraction
     if (signature.getKind() == kind::SKOLEM) {
@@ -666,8 +667,7 @@ Node AbstractionModule::substituteArguments(TNode signature, TNode apply, unsign
   }
 
   if (signature.getNumChildren() == 0) {
-    Assert (signature.getKind() != kind::VARIABLE &&
-            signature.getKind() != kind::SKOLEM);
+    Assert(signature.getKind() != kind::metakind::VARIABLE);
     seen[signature] = signature;
     return signature;
   }
index 7e666bcbfd9f08bc10207229a0a9f4bd08f2a7c5..80930866fbfa46b75537d4651ae701188beec921 100644 (file)
@@ -139,7 +139,8 @@ AigBitblaster::AigBitblaster()
       d_nullContext(new context::Context()),
       d_aigCache(),
       d_bbAtoms(),
-      d_aigOutputNode(NULL)
+      d_aigOutputNode(NULL),
+      d_notify()
 {
   prop::SatSolver* solver = nullptr;
   switch (options::bvSatSolver())
@@ -149,8 +150,8 @@ AigBitblaster::AigBitblaster()
       prop::BVSatSolverInterface* minisat =
           prop::SatSolverFactory::createMinisat(
               d_nullContext.get(), smtStatisticsRegistry(), "AigBitblaster");
-      MinisatEmptyNotify notify;
-      minisat->setNotify(&notify);
+      d_notify.reset(new MinisatEmptyNotify());
+      minisat->setNotify(d_notify.get());
       solver = minisat;
       break;
     }
index 30f1dd00b755b813220261982dea388f3c2d5640..dea2d0429a0de40224df91362a9d788c9788adba 100644 (file)
@@ -67,6 +67,8 @@ class AigBitblaster : public TBitblaster<Abc_Obj_t*>
   // the thing we are checking for sat
   Abc_Obj_t* d_aigOutputNode;
 
+  std::unique_ptr<MinisatEmptyNotify> d_notify;
+
   void addAtom(TNode atom);
   void simplifyAig();
   void storeBBAtom(TNode atom, Abc_Obj_t* atom_bb) override;
index 0e0cee7f8fbe249d830179fa36638f88149c0fd2..0c5920951a7fc876dee67811dd09faf612b665e9 100644 (file)
@@ -161,6 +161,7 @@ REG0_TESTS = \
        regress0/bv/bug733.smt2 \
        regress0/bv/bug734.smt2 \
        regress0/bv/bv-abstr-bug.smt2 \
+       regress0/bv/bv-abstr-bug2.smt2 \
        regress0/bv/bv-int-collapse1.smt2 \
        regress0/bv/bv-int-collapse2.smt2 \
        regress0/bv/bv-options1.smt2 \
diff --git a/test/regress/regress0/bv/bv-abstr-bug2.smt2 b/test/regress/regress0/bv/bv-abstr-bug2.smt2
new file mode 100644 (file)
index 0000000..939439a
--- /dev/null
@@ -0,0 +1,7 @@
+; COMMAND-LINE: --solve-int-as-bv=32 --bitblast=eager
+(set-logic QF_NIA)
+(set-info :status sat)
+(declare-fun _substvar_7_ () Bool)
+(declare-fun _substvar_3_ () Int)
+(assert (or _substvar_7_ (= 0 _substvar_3_)))
+(check-sat)