diff options
author | Andrew Reynolds <andrew.j.reynolds@gmail.com> | 2019-05-01 00:35:14 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-01 00:35:14 -0500 |
commit | 7ac83bb567ca0f0a45ebe3b4c3dffa0689f9b4b2 (patch) | |
tree | f3cd98a52b95bbc366afa8901c04c7c9f4fa8362 /src/theory/strings/regexp_elim.cpp | |
parent | d998d5e4213503e0913581d57c09ad486cded5c1 (diff) |
Use total versions of div/mod in re-elim-agg (#2986)
Diffstat (limited to 'src/theory/strings/regexp_elim.cpp')
-rw-r--r-- | src/theory/strings/regexp_elim.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/theory/strings/regexp_elim.cpp b/src/theory/strings/regexp_elim.cpp index b6a997629..e132d8e24 100644 --- a/src/theory/strings/regexp_elim.cpp +++ b/src/theory/strings/regexp_elim.cpp @@ -547,11 +547,13 @@ Node RegExpElimination::eliminateStar(Node atom) Node lens = nm->mkNode(STRING_LENGTH, s); lens = Rewriter::rewrite(lens); Assert(lens.isConst()); + Assert(lens.getConst<Rational>().sgn() > 0); std::vector<Node> conj; + // lens is a positive constant, so it is safe to use total div/mod here. Node bound = nm->mkNode( AND, nm->mkNode(LEQ, d_zero, index), - nm->mkNode(LT, index, nm->mkNode(INTS_DIVISION, lenx, lens))); + nm->mkNode(LT, index, nm->mkNode(INTS_DIVISION_TOTAL, lenx, lens))); Node conc = nm->mkNode(STRING_SUBSTR, x, nm->mkNode(MULT, index, lens), lens) .eqNode(s); @@ -559,7 +561,9 @@ Node RegExpElimination::eliminateStar(Node atom) Node bvl = nm->mkNode(BOUND_VAR_LIST, index); Node res = nm->mkNode(FORALL, bvl, body); res = nm->mkNode( - AND, nm->mkNode(INTS_MODULUS, lenx, lens).eqNode(d_zero), res); + AND, + nm->mkNode(INTS_MODULUS_TOTAL, lenx, lens).eqNode(d_zero), + res); // e.g. // x in ("abc")* ---> // forall k. 0 <= k < (len( x ) div 3) => substr(x,3*k,3) = "abc" ^ |