-
Notifications
You must be signed in to change notification settings - Fork 465
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.(toInt, toFin)_twoPow
#7225
base: master
Are you sure you want to change the base?
Conversation
Bitvec.(toInt, toFin)_twoPow
changelog-library |
have hy : (2 ^ i % 2 ^ (w + 1)) = 2 ^ i := by rw [Nat.mod_eq_of_lt (by rw [Nat.pow_lt_pow_iff_right (by omega)]; omega)] | ||
have hj : 2 * 2 ^ i = 2 ^ (i + 1) := by rw [Nat.pow_add, Nat.mul_comm] |
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.
have hy : (2 ^ i % 2 ^ (w + 1)) = 2 ^ i := by rw [Nat.mod_eq_of_lt (by rw [Nat.pow_lt_pow_iff_right (by omega)]; omega)] | |
have hj : 2 * 2 ^ i = 2 ^ (i + 1) := by rw [Nat.pow_add, Nat.mul_comm] | |
have hy : 2 ^ i % 2 ^ (w + 1) = 2 ^ i := by rw [Nat.mod_eq_of_lt (by rw [Nat.pow_lt_pow_iff_right (by omega)]; omega)] | |
have hj : 2 * 2 ^ i = 2 ^ (i + 1) := by rw [Nat.pow_add, Nat.mul_comm] |
I wonder if these two lemma above should not be named simp lemmas.
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.
In fact, the entire second half of the proof would be a lot nicer, if we can make avoid the casts in the middle and just make this all simp away. I am wondering if there is a set of simp lemmas which could help here?
by_cases i + 1 = (w + 1) | ||
· simp [show i = w by omega]; omega |
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.
by_cases i + 1 = (w + 1) | |
· simp [show i = w by omega]; omega | |
by_cases i + 1 = w + 1 | |
· simp [show i = w by omega]; omega |
Mathlib CI status (docs):
|
This PR contains
BitVec.(toInt, toFin)_twoPow
theorems, completing the API forBitVec.*_twoPow
.