feat: bitblasting support for BitVec.carry
#6766
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds two normalization lemmas to the
bv_normalize
simpset, which will enablebv_decide
to reason aboutBitVec.carry
: these lemmas areBitVec.carry_eq_getLsbD_add_zeroExtend
andBitVec.carry_width_eq_msb_add_zeroExtend
. In principle, the former is strictly more general than the latter (which is applicable only in the casecarry w x y _
, wherew
is the width ofx
andy
). However, I choose to include the latter still, because asking for the final carry bit is particularly common, and it has a simpler rhs, which presumably means a faster bitblasted circuit.In the process of adding these lemmas, I also proved
carry_gt
, which (analogous togetLsbD_ge
) says that asking for an out-of-range carry bit givesfalse
. I didn't end up needing this lemma, but it seemed a useful addition to the API nonetheless, so I kept it around. The PR also adds a missingCommutative
instance for Boolean xor (which is needed for the main result).TODO (this PR is still WIP):