diff options
author | Andres Noetzli <andres.noetzli@gmail.com> | 2020-02-24 07:46:47 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-24 09:46:47 -0600 |
commit | a431edc5eba8b04812768b475b240725fb07d8c6 (patch) | |
tree | afcd020e2e58b9a03f0c87b602c01fe0bcd2cc9d /src/theory/booleans | |
parent | 6f379f2b83a28995aa77504da1931a598b54bcc0 (diff) |
Make lambda rewriter more robust (#3806)
The lambda rewriter was not robust to the case where the lambda of the
array representation contained a disequality, e.g. `not(x = 1))`. It
would process it as `ite(not(x = 1), true, false)` instead of `ite(x =
1, false, true)`, which meant that it wasn't able to turn it into an
array representation when checking const-ness. Additionally, the
rewriter had issues when the lambda was of the form `ite((= x c1), true,
(= y c2))` (after turning it into an array and then into a lambda)
because it is expecting the false branch of the `ite` to not contain `y`
variables, making it non-constant despite the array being constant. This
commit solves that issue by normalizing `ite(not(c), x, y) ---> ite(c,
y, x)`.
Diffstat (limited to 'src/theory/booleans')
-rw-r--r-- | src/theory/booleans/theory_bool_rewriter.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/theory/booleans/theory_bool_rewriter.cpp b/src/theory/booleans/theory_bool_rewriter.cpp index c53610efa..1c5eab364 100644 --- a/src/theory/booleans/theory_bool_rewriter.cpp +++ b/src/theory/booleans/theory_bool_rewriter.cpp @@ -316,6 +316,14 @@ RewriteResponse TheoryBoolRewriter::preRewrite(TNode n) { // return RewriteResponse(REWRITE_AGAIN, resp); // } } + + if (n[0].getKind() == kind::NOT) + { + // ite(not(c), x, y) ---> ite(c, y, x) + return RewriteResponse( + REWRITE_AGAIN, nodeManager->mkNode(kind::ITE, n[0][0], n[2], n[1])); + } + // else if (n[2].isConst()) { // if(n[2] == ff){ // Node resp = (n[0]).andNode(n[1]); |