From: Andrew Reynolds Date: Thu, 11 Oct 2018 05:31:57 +0000 (-0500) Subject: Fix string ext inference for rewrites that introduce negation (#2618) X-Git-Tag: cvc5-1.0.0~4434 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c26a0f8fd971a72e8e9bdf058930c06587856604;p=cvc5.git Fix string ext inference for rewrites that introduce negation (#2618) --- diff --git a/src/theory/strings/theory_strings.cpp b/src/theory/strings/theory_strings.cpp index 26ff9188f..fb25e1348 100644 --- a/src/theory/strings/theory_strings.cpp +++ b/src/theory/strings/theory_strings.cpp @@ -1778,18 +1778,21 @@ void TheoryStrings::checkExtfInference( Node n, Node nr, ExtfInfoTmp& in, int ef Node conc = nm->mkNode(STRING_STRCTN, pol ? nr[1] : onr, pol ? onr : nr[1]); conc = Rewriter::rewrite(conc); + conc = conc.negate(); bool do_infer = false; - if (conc.getKind() == EQUAL) + bool pol = conc.getKind() != NOT; + Node lit = pol ? conc : conc[0]; + if (lit.getKind() == EQUAL) { - do_infer = !areDisequal(conc[0], conc[1]); + do_infer = pol ? !areEqual(lit[0], lit[1]) + : !areDisequal(lit[0], lit[1]); } else { - do_infer = !areEqual(conc, d_false); + do_infer = !areEqual(lit, pol ? d_true : d_false); } if (do_infer) { - conc = conc.negate(); std::vector exp_c; exp_c.insert(exp_c.end(), in.d_exp.begin(), in.d_exp.end()); Node ofrom = d_extf_info_tmp[nr[0]].d_ctn_from[opol][i]; diff --git a/test/regress/CMakeLists.txt b/test/regress/CMakeLists.txt index bfcd640b9..902ddf0f9 100644 --- a/test/regress/CMakeLists.txt +++ b/test/regress/CMakeLists.txt @@ -1548,6 +1548,7 @@ set(regress_1_tests regress1/strings/strings-lt-simple.smt2 regress1/strings/strip-endpt-sound.smt2 regress1/strings/substr001.smt2 + regress1/strings/timeout-no-resp.smt2 regress1/strings/type002.smt2 regress1/strings/type003.smt2 regress1/strings/username_checker_min.smt2 diff --git a/test/regress/Makefile.tests b/test/regress/Makefile.tests index fc080f0e0..91f33721a 100644 --- a/test/regress/Makefile.tests +++ b/test/regress/Makefile.tests @@ -1545,6 +1545,7 @@ REG1_TESTS = \ regress1/strings/strings-lt-simple.smt2 \ regress1/strings/strip-endpt-sound.smt2 \ regress1/strings/substr001.smt2 \ + regress1/strings/timeout-no-resp.smt2 \ regress1/strings/type002.smt2 \ regress1/strings/type003.smt2 \ regress1/strings/username_checker_min.smt2 \ diff --git a/test/regress/regress1/strings/timeout-no-resp.smt2 b/test/regress/regress1/strings/timeout-no-resp.smt2 new file mode 100644 index 000000000..65608da62 --- /dev/null +++ b/test/regress/regress1/strings/timeout-no-resp.smt2 @@ -0,0 +1,7 @@ +(set-logic SLIA) +(set-info :status sat) +(set-option :strings-exp true) +(declare-const x String) +(declare-const y String) +(assert (not (= (str.replace "A" (str.replace x "A" y) x) (str.replace "A" x (str.replace x y x))))) +(check-sat) \ No newline at end of file