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: add bv_decide normalization rules for ofBool (a.getLsbD i) and ofBool a[i] #5375

Merged
merged 6 commits into from
Sep 18, 2024

Conversation

alexkeizer
Copy link
Contributor

@alexkeizer alexkeizer commented Sep 17, 2024

In LNSym we often use the pattern ofBool (a.getLsbD i) to pick out a specific bit (i) from a bitvector (a).

By adding a rewrite to extractLsb to bv_decides normalization set, we can still automatically close goals that have this pattern. In the process, I also added a simp-lemma about the value of a Fin 1.

@alexkeizer alexkeizer changed the title feat: add bv_decide normalization rulesfor ofBool (a.getLsbD i) and ofBool a[i] feat: add bv_decide normalization rules for ofBool (a.getLsbD i) and ofBool a[i] Sep 17, 2024
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Sep 17, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

leanprover-community-mathlib4-bot commented Sep 17, 2024

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 078e9b6d778932430adf9ecbbf02e1025e922ce1 --onto c25d2066471c7726b64d7f3eea8b5cce9910f33d. (2024-09-17 20:39:48)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 21d71de481e3d497a3ceeac85e50b50338b5636d --onto 445c8f2ee02ec75cdd8b2811bd56f4fb16adb655. (2024-09-18 01:49:51)

shigoel pushed a commit to leanprover/LNSym that referenced this pull request Sep 17, 2024
### Description:

I've opened [#5375](leanprover/lean4#5375)
upstream, but in the meantime we can add the normalization rule
ourselves. This ensures we don't have to get rid of uses of the `ofBool
(getLsb ..)` pattern in #159

### Testing:

What tests have been run? Did `make all` succeed for your changes? Was
conformance testing successful on an Aarch64 machine? Yes

### License:

By submitting this pull request, I confirm that my contribution is
made under the terms of the Apache 2.0 license.
@alexkeizer
Copy link
Contributor Author

@hargoniX addressed your comments, another round of review please!

Copy link
Contributor

@tobiasgrosser tobiasgrosser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Thank you.

@hargoniX hargoniX added this pull request to the merge queue Sep 18, 2024
Merged via the queue into leanprover:master with commit 4641ed8 Sep 18, 2024
13 checks passed
shigoel pushed a commit to leanprover/LNSym that referenced this pull request Sep 20, 2024
### Description:

I've opened [#5375](leanprover/lean4#5375)
upstream, but in the meantime we can add the normalization rule
ourselves. This ensures we don't have to get rid of uses of the `ofBool
(getLsb ..)` pattern in #159

### Testing:

What tests have been run? Did `make all` succeed for your changes? Was
conformance testing successful on an Aarch64 machine? Yes

### License:

By submitting this pull request, I confirm that my contribution is
made under the terms of the Apache 2.0 license.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

4 participants