[BV] Fix strategy for `RewriteExtract` (#8011)
authorAndres Noetzli <andres.noetzli@gmail.com>
Tue, 1 Feb 2022 21:58:41 +0000 (13:58 -0800)
committerGitHub <noreply@github.com>
Tue, 1 Feb 2022 21:58:41 +0000 (21:58 +0000)
commit2d3c3cd7234488982ad8b769d787a6c69bb9f19e
tree4dd5d94eb772845959912540199c13e4b0191e3d
parent1f47ed4a01d5cca1730bb27fb3c2a4e7a8ade232
[BV] Fix strategy for `RewriteExtract` (#8011)

`RewriteExtract` was being too eager to return `REWRITE_DONE`. In
particular, it could happen that a term could be rewritten by a series
of `ExtractExtract` and `ExtractConcat` rewrites, but the method would
return `REWRITE_AGAIN` after the first application of `ExtractExtract`.
This commit fixes the method to be more conservative and return
`REWRITE_AGAIN` whenever a rewrite changed the node being rewritten.
Additionally, the commit makes constant folding the last step (to
maximize the chances that it applies) and makes `ExtractExtract` rewrite
multiple nested applications of `extract` with a single application.
src/theory/bv/theory_bv_rewrite_rules_core.h
src/theory/bv/theory_bv_rewriter.cpp