-
Notifications
You must be signed in to change notification settings - Fork 426
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.getElem_[add|add_add_bool|mul|rotateLeft|rotateRight… #5508
Conversation
…|twoPow|one|replicate] ... and mark getElem_setWidth as `@[simp]`.
18b096e
to
ef74003
Compare
Mathlib CI status (docs):
|
@kim-em, I just tried this for @[simp]
theorem getElem_rotateLeft {x : BitVec w} {r i : Nat} (h : i < w) :
(x.rotateLeft r)[i] =
if (i < r % w) then
(x[(w - (r % w) + i)]'(by /- I do not get `i < r % w` here -/ sorry)) else
(x[i - (r % w)]'(by omega)) := by
simp [← BitVec.getLsbD_eq_getElem, h] |
You need to name the condition: |
Perfect. This was the hint I needed. |
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.
Otherwise LGTM now.
Co-authored-by: Kim Morrison <scott@tqft.net>
Co-authored-by: Kim Morrison <scott@tqft.net>
Co-authored-by: Kim Morrison <scott@tqft.net>
Co-authored-by: Kim Morrison <scott@tqft.net>
All comments addressed. This now looks very neat. |
…|twoPow|one|replicate]
... and mark
getElem_setWidth
as@[simp]
.getElem_rotateLeft
andgetElem_rotateRight
have a non-trivial rhs but we followgetLsbD_[rotateLeft|rotateRight]
for consistency.