Skip to content
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: teach bv_normalize overshifting equals 0 #6849

Closed
wants to merge 1 commit into from

Conversation

vlad902
Copy link
Contributor

@vlad902 vlad902 commented Jan 29, 2025

This PR adds lemmas that x >>> n = 0 and x <<< n = 0 when n exceeds x's bithwidth to the bv_normalize simpset.

This PR adds lemmas that `x >>> n = 0` and `x <<< n = 0` when n exceeds
x's bithwidth to the bv_normalize simpset.
@vlad902 vlad902 requested a review from hargoniX as a code owner January 29, 2025 13:47
@vlad902
Copy link
Contributor Author

vlad902 commented Jan 29, 2025

changelog-library

@github-actions github-actions bot added changelog-library Library toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN labels Jan 29, 2025
@leanprover-community-bot
Copy link
Collaborator

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 5c0231f508cca395fe790cd85b426954ace4075b --onto 20c616503abe5ce4253c56dbcd7766a91c675ba0. (2025-01-29 14:10:34)

@hargoniX
Copy link
Contributor

hargoniX commented Jan 29, 2025

We want to implement this one a little differently, consider the two PRs:

these add theory for both overshifting and general constant shifting. The idea for bv_decide would be the following: write a simproc that acts on shifts by constants. It extracts the constants and applies the lemmas as appropriate to return either 0#w directly or an 0#w concatenated with an extract.

@vlad902
Copy link
Contributor Author

vlad902 commented Jan 30, 2025

Yea I suppose this is something I didn't quite understand, right now it seems like bv_normalize is able to apply these to e.g. x <<< 100 when x is a BitVec 16, but when the hypothesis 16 ≤ 100 was generated and whether one could rely on Lean to do this in all contexts/for all constants is not clear to me.

@vlad902 vlad902 closed this Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-library Library toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants