[Rewriter] Always rewrite again when kind changes (#8007)
authorAndres Noetzli <andres.noetzli@gmail.com>
Fri, 4 Feb 2022 19:04:07 +0000 (11:04 -0800)
committerGitHub <noreply@github.com>
Fri, 4 Feb 2022 19:04:07 +0000 (19:04 +0000)
commitf76b1dc5757518da2baa61c3924940cc776242ad
tree029ef6a6ccc5c620fef5c360fa47ef5cf31b420d
parenta2d4f2cc2d546bd132e67f34301588d10dbd065b
[Rewriter] Always rewrite again when kind changes (#8007)

Fixes cvc5/cvc5-projects#438. The rewriter
returned REWRITE_DONE prematurely when rewriting operators such as
bvand in certain cases. If only a single term was left after removing
duplicates from a bvand, the kind of the current node would change and
another pre-rewrite could apply, but the rewriter still returned
REWRITE_DONE. After adding an assertion in the rewriter that checks
that REWRITE_DONE implies that no other pre-rewrite applies, it was
discovered that not only the bit-vector rewriter has this issue, but
other rewriters, e.g., the Boolean rewriter, as well. This commit
changes our semantics for REWRITE_DONE to mean that no other rewrite
applies provided that the kind did not change. This makes it easier for
developers to decide when to return REWRITE_DONE, because it only
requires reasoning about rewrites that apply to a single kind.
src/theory/rewriter.cpp
src/theory/theory_rewriter.h
test/regress/CMakeLists.txt
test/regress/regress0/bv/proj-issue438-prerewrite-fixed-point.smt2 [new file with mode: 0644]
test/regress/regress1/bv/proj-issue438-prerewrite-fixed-point-original.smt2 [new file with mode: 0644]