-
Notifications
You must be signed in to change notification settings - Fork 456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: BitVec.shiftLeft in terms of extractLsb' #6743
Merged
hargoniX
merged 1 commit into
leanprover:master
from
opencompl:lean4-shiftLeft-concat-extract
Jan 24, 2025
Merged
feat: BitVec.shiftLeft in terms of extractLsb' #6743
hargoniX
merged 1 commit into
leanprover:master
from
opencompl:lean4-shiftLeft-concat-extract
Jan 24, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bollu
force-pushed
the
lean4-shiftLeft-concat-extract
branch
2 times, most recently
from
January 22, 2025 17:10
fe80fdd
to
8177439
Compare
github-actions
bot
added
the
toolchain-available
A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
label
Jan 22, 2025
Mathlib CI status (docs):
|
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jan 22, 2025
This PR supports rewriting `ushiftRight` in terms of `extractLsb'`. This is the companion PR to #6743 which adds the similar lemmas about `shiftLeft`. ```lean theorem ushiftRight_eq_zero {x : BitVec w} {n : Nat} (hn : w ≤ n) : x >>> n = 0#w theorem ushiftRight_eq_extractLsb'_of_lt {x : BitVec w} {n : Nat} (hn : n < w) : x >>> n = ((0#n) ++ (x.extractLsb' n (w - n))).cast (by omega) ```
bollu
force-pushed
the
lean4-shiftLeft-concat-extract
branch
2 times, most recently
from
January 24, 2025 14:40
6be7fd1
to
d74a4e0
Compare
that normalize left shidts Also, update the theorem names in the PR message to match their current names. |
auto-merge was automatically disabled
January 24, 2025 14:47
Head branch was pushed to by a user without write access
bollu
force-pushed
the
lean4-shiftLeft-concat-extract
branch
from
January 24, 2025 14:48
a49508a
to
d6ccd52
Compare
This PR adds rewrites from Bitwuzla that normalize left shifts in terms of extracting bits and concatenating zeroes. If the shift amount is larger than the bitwidth, then the resulting bitvector is zero. ```lean theorem shiftLeft_eq {x : BitVec w} {n : Nat} (hn : w ≤ n) : x <<< n = 0#w theorem shiftLeft_eq_concat_of_lt {x : BitVec w} {n : Nat} (hn : n < w) : x <<< n = ((x.extractLsb' 0 (w-n)).append (BitVec.zero n)).cast (by omega) ```
bollu
force-pushed
the
lean4-shiftLeft-concat-extract
branch
from
January 24, 2025 14:53
d6ccd52
to
77ef60e
Compare
tobiasgrosser
approved these changes
Jan 24, 2025
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Jan 24, 2025
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4
that referenced
this pull request
Jan 24, 2025
leanprover-community-bot
added
the
builds-mathlib
CI has verified that Mathlib builds against this PR
label
Jan 24, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
builds-mathlib
CI has verified that Mathlib builds against this PR
changelog-library
Library
toolchain-available
A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
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 rewrites that normalizes left shifts by extracting bits and concatenating zeroes. If the shift amount is larger than the bit-width, then the resulting bitvector is zero.