Make `STRINGS_CTN_DECOMPOSE` an explicit conflict (#6663)
authorAndres Noetzli <andres.noetzli@gmail.com>
Wed, 2 Jun 2021 13:50:51 +0000 (06:50 -0700)
committerGitHub <noreply@github.com>
Wed, 2 Jun 2021 13:50:51 +0000 (13:50 +0000)
Fixes #6643. The STRINGS_CTN_DECOMPOSE inference is always a conflict
but we sometimes sent it as an inference. To make sure that the
inference manager actually recognizes the inference as a conflict, this
commit ensures that the conclusion is always false and modifies the
explanation accordingly.

src/theory/strings/extf_solver.cpp
test/regress/CMakeLists.txt
test/regress/regress0/strings/issue6643-ctn-decompose-conflict.smt2 [new file with mode: 0644]

index 8b5e35023dc684fbb9dcefbd34cdfee8eeef35a3..fc8fb15b00bee661946827b81a9659cb9f9fd577 100644 (file)
@@ -547,7 +547,9 @@ void ExtfSolver::checkExtfInference(Node n,
             if (d_state.areEqual(conc, d_false))
             {
               // we are in conflict
-              d_im.sendInference(in.d_exp, conc, InferenceId::STRINGS_CTN_DECOMPOSE);
+              d_im.addToExplanation(conc, d_false, in.d_exp);
+              d_im.sendInference(
+                  in.d_exp, d_false, InferenceId::STRINGS_CTN_DECOMPOSE);
               Assert(d_state.isInConflict());
               return;
             }
index 3adb3ebbbcdf1b56bf94f3dae085391ba80f32ba..daa28580ad294ad6e8e216b1d22d4e851e37f7d8 100644 (file)
@@ -1150,6 +1150,7 @@ set(regress_0_tests
   regress0/strings/issue6520.smt2
   regress0/strings/issue6560-indexof-reduction.smt2
   regress0/strings/issue6604-re-elim.smt2
+  regress0/strings/issue6643-ctn-decompose-conflict.smt2
   regress0/strings/itos-entail.smt2
   regress0/strings/large-model.smt2
   regress0/strings/leadingzero001.smt2
diff --git a/test/regress/regress0/strings/issue6643-ctn-decompose-conflict.smt2 b/test/regress/regress0/strings/issue6643-ctn-decompose-conflict.smt2
new file mode 100644 (file)
index 0000000..41a5156
--- /dev/null
@@ -0,0 +1,7 @@
+; COMMAND-LINE: --strings-exp
+(set-logic QF_SLIA)
+(declare-fun y () String)
+(declare-fun z () String)
+(assert (not (= (str.contains y (str.replace "A" "" z)) (str.contains y "A"))))
+(set-info :status sat)
+(check-sat)