-
Notifications
You must be signed in to change notification settings - Fork 455
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.(getMsbD, msb)_(extractLsb', extractLsb), getMsbD_extractLsb'_eq_getLsbD
#6792
base: master
Are you sure you want to change the base?
Conversation
Mathlib CI status (docs):
|
changelog-library |
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.
Thanks for the API :) I request a couple of minor syntactic changes, and one simplification of a theorem statement.
src/Init/Data/BitVec/Lemmas.lean
Outdated
(extractLsb hi lo x).msb = (decide (0 < hi - lo + 1) && | ||
(decide (lo + (hi - lo) < n) && x.getMsbD (n - 1 - (lo + (hi - lo))))) := by |
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.
(extractLsb hi lo x).msb = (decide (0 < hi - lo + 1) &&
(decide (lo + (hi - lo) < n) && x.getMsbD (n - 1 - (lo + (hi - lo))))) := by
I feel the conditions can be simplified. We should be able to write decide (0 < hi - lo + 1)
as decide (lo <= hi)
. Similarly, given this, is it not the case that decide (lo + (hi - lo) < n)
is equivalent to decide (hi < n)
, and the final case is x.getMsbD (n - 1 - hi)
? Note that I'm not 100% sure about the above computations, but it does seem to me that lo + (hi - lo)
is refactorable by using another decide (...)
condition if necessary
Co-authored-by: Siddharth <[email protected]>
Co-authored-by: Siddharth <[email protected]>
git push
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.
Some style comments
Co-authored-by: Alex Keizer <[email protected]>
awaiting-review |
This PR adds theorems
BitVec.(getMsbD, msb)_(extractLsb', extractLsb), getMsbD_extractLsb'_eq_getLsbD
.