-
Notifications
You must be signed in to change notification settings - Fork 462
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 BitVec.intMin #5098
feat: add BitVec.intMin #5098
Conversation
Draft, as I am still polishing the order of the various theorems within the files. Any feedback is obviously already welcome. |
Mathlib CI status (docs):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me.
This is now ready-for-review from my side. |
awaiting-review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
As we are modifying |
4991e87
to
642039d
Compare
The comments are adressed, except for finding the correct imports for the new simp set. I will await advice from @bollu. |
The simp-set is also defined, so the remaining issue is a lonely build failure in the nix build, which I am not sure how to debug or if it is even introduced by this PR. |
It seems that the intMax definition was incorrect. I corrected it, but I haven't polished the proofs yet. |
Remaining steps to activating
(If you give me write access on your repo I'm happy to do these steps, too.) |
Cool. I gave you write access. I guess it's easier if you push this through. |
d0234c7
to
934cc9c
Compare
This PR also pulls in some mathlib theorems on testBit and Nat and establishes facts about 2^w that are needed here and which are generally useful for bitvector reasoning. The following theorem is not generalized to arbitrary x instead of 2, as this would require a condition to be added for x > 1 which would have to be passed to simp each time this theorem should fire. chore: derive from testBit_two_pow chore: convert first to prop and then decide chore: move intMax down as well chore: add simp set Add simp-set into this PR chore: fix simp extension Move file to src/Lean to fix build Add prelude update date Add university of cambridge as copyright holder improve naming use whitespace uniformly use decide (n = m) Drop the 'Nat.' namespace Update src/Init/Data/BitVec/Lemmas.lean Co-authored-by: Siddharth <[email protected]> Update src/Init/Data/BitVec/Lemmas.lean Co-authored-by: Siddharth <[email protected]> Fix build add some theorems Revert "add some theorems" This reverts commit fb97bc2. WIP Shorten proof Update src/Init/Data/Nat/Lemmas.lean finish proofs Update src/Init/Data/BitVec/Lemmas.lean Co-authored-by: Kim Morrison <[email protected]> Update src/Init/Data/Nat/Lemmas.lean Co-authored-by: Kim Morrison <[email protected]> chore: move BoolToPropSimps
6c2e907
to
5f347e7
Compare
We keep the library interface for
intMin
minimal and make it anabbrev
fortwoPow
. To ensure a uniform library interface, we also turnintMax
into an abbrev forallOnes
.To improve proof automation, we introduce a simp-set
boolToPropSimps
plus corresponding lemmas that turn ourintMin_toLsb
proof into a simplesimp; omega
proof. This simp set is not yet active, but should become so after a stage-0 update.This PR also pulls in some mathlib theorems on testBit and Nat and establishes facts about
2 ^ w
that are needed here and which are generally useful for bitvector reasoning.The following theorem is not generalized to arbitrary
x
instead of2
, as this would require a condition to be added forx > 1
which would have to be passed to simp each time this theorem should fire:Mathlib reports only errors for theorems that this PR moves into lean.