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 BitVec.(getMsbD, msb)_(rotateLeft, RotateRight) #34

Closed
wants to merge 10 commits into from

Conversation

luisacicolini
Copy link

@luisacicolini luisacicolini commented Nov 11, 2024

This PR introduces theorems BitVec.(getMsbD, msb)_(rotateLeft, rotateRight)

@bollu
Copy link

bollu commented Nov 11, 2024

@luisacicolini High-level comment: What we do in this proof is to play games to rewrite rotateLeft into rotateLeftAux, while trying to juggle the lsb/msb mismatch. I almost feel that we should write a variant of the getLsb_rotateLeftAux theorems, so we now have a getMsb_rotateLeftAux, and then follow the same proof strategy as we do for getLsb to get the getMsb theorems. I suspect that the proof we have now will adapt (easily?) to prove properties of rotateLeftAux, since we start our proof with:

rw [← rotateLeft_mod_eq_rotateLeft]
...
rw [rotateLeft_eq_rotateLeftAux_of_lt (by assumption)]

So I feel it's worth it to write a clearer proof directly in terms of getMsb_rotateLeftAux

@bollu bollu self-requested a review November 11, 2024 10:03
@luisacicolini
Copy link
Author

luisacicolini commented Nov 11, 2024

thanok you @bollu. So, if I understand correctly, we now want getMsbD_rotateLeftAux_of_geq, getMsbD_rotateLeftAux_of_le, getMsbD_rotateRightAux_of_geq, getMsbD_rotateRightAux_of_le, right?

@bollu
Copy link

bollu commented Nov 11, 2024

@luisacicolini Correct.

@luisacicolini
Copy link
Author

Thank you @bollu. I just pushed all the theorems, including the helper ones, following a similar proving strategy as getLsbD theorems.

Copy link

@bollu bollu left a comment

Choose a reason for hiding this comment

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

LGTM, modulo the change I asked for!

@luisacicolini
Copy link
Author

I will now close this PR and open one to lean4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants