Fix missing conclusion for sep pto neg prop (#8844)
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>
Thu, 2 Jun 2022 16:37:53 +0000 (11:37 -0500)
committerGitHub <noreply@github.com>
Thu, 2 Jun 2022 16:37:53 +0000 (16:37 +0000)
Was introduced in the refactoring in #8768.

Fixes #8841.

src/theory/sep/theory_sep.cpp
test/regress/cli/CMakeLists.txt
test/regress/cli/regress0/sep/issue8841-neg-prop.smt2 [new file with mode: 0644]

index 048d93e803a886f8a09158e2b7439ebc50ec7575..75484ceb020488c4b4cb9d497e741670299c8124 100644 (file)
@@ -1825,7 +1825,23 @@ bool TheorySep::checkPto(HeapAssertInfo* e, Node p, bool polarity)
       else if (polarity != pol)
       {
         // a positive and negative pto
-        if (!areDisequal(pval, qval))
+        bool isSat = false;
+        std::vector<Node> conc;
+        // based on the lemma below, either the domain or range has to be
+        // disequal. We iterate on each child of the pto
+        for (size_t j = 0; j < 2; j++)
+        {
+          if (areDisequal(p[0][j], q[0][j]))
+          {
+            isSat = true;
+            break;
+          }
+          if (p[0][j] != q[0][j])
+          {
+            conc.push_back(p[0][j].eqNode(q[0][j]).notNode());
+          }
+        }
+        if (!isSat)
         {
           std::vector<Node> exp;
           if (plbl != qlbl)
@@ -1839,16 +1855,11 @@ bool TheorySep::checkPto(HeapAssertInfo* e, Node p, bool polarity)
           Node neg = polarity ? q : p;
           exp.push_back(pos);
           exp.push_back(neg.notNode());
-          std::vector<Node> conc;
-          if (pval != qval)
-          {
-            conc.push_back(pval.eqNode(qval).notNode());
-          }
           Node concn = nm->mkOr(conc);
           Trace("sep-pto") << "prop neg/pos: " << concn << " by " << exp
                            << std::endl;
-          // (label (pto x y) A) ^ ~(label (pto z w) B) ^ A = B => y != w
-          // or (label (pto x y) A) ^ ~(label (pto z y) B) ^ A = B => false
+          // (label (pto x y) A) ^ ~(label (pto z w) B) ^ A = B =>
+          // (x != z or y != w)
           sendLemma(exp, concn, InferenceId::SEP_PTO_NEG_PROP);
         }
       }
index 4ef2a64c77a3f0c66950a5999bca895dd3acd0ab..12f8fd4c86dedb6eaa6df47c99fd0b87f1764b68 100644 (file)
@@ -1205,6 +1205,7 @@ set(regress_0_tests
   regress0/sep/issue3720-check-model.smt2
   regress0/sep/issue5343-err.smt2
   regress0/sep/issue8659-wand-diff-heaps.smt2
+  regress0/sep/issue8841-neg-prop.smt2
   regress0/sep/nemp.smt2
   regress0/sep/nil-no-elim.smt2
   regress0/sep/nspatial-simp.smt2
diff --git a/test/regress/cli/regress0/sep/issue8841-neg-prop.smt2 b/test/regress/cli/regress0/sep/issue8841-neg-prop.smt2
new file mode 100644 (file)
index 0000000..15b1edd
--- /dev/null
@@ -0,0 +1,13 @@
+; DISABLE-TESTER: model
+(set-logic QF_ALL)
+(set-info :status sat)
+(declare-sort Loc 0)
+(declare-heap (Loc Loc))
+
+(declare-const x1 Loc)
+(declare-const x2 Loc)
+
+(assert (pto x1 x2))
+(assert (not (pto x2 x2)))
+
+(check-sat)