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: theorems for ushiftRight #33

Closed
wants to merge 1 commit into from
Closed

feat: theorems for ushiftRight #33

wants to merge 1 commit into from

Conversation

mhk119
Copy link
Collaborator

@mhk119 mhk119 commented Nov 8, 2024

No description provided.

@bollu
Copy link

bollu commented Nov 11, 2024

@mhk119 I just pushed to the PR, and broke the proof strategy down into smaller chunks so it's easier to upstream. Let me know what you think, and if you're happy with the PR.

@mhk119
Copy link
Collaborator Author

mhk119 commented Nov 11, 2024

@mhk119 I just pushed to the PR, and broke the proof strategy down into smaller chunks so it's easier to upstream. Let me know what you think, and if you're happy with the PR.

This looks good !

Comment on lines +38 to +39
theorem shiftRight_zero (n : Int) : n >>> 0 = n := by
simp [Int.shiftRight_eq_div_pow]

Choose a reason for hiding this comment

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

Should n be of type BitVec?


/--
Unsigned shift right by at least one bit makes the value of the bitvector less than or equal to `2^(w-1)`,
makes the interpretation of the bitvector `Int` and `Nat` agree.

Choose a reason for hiding this comment

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

makes the two times in a row is grammatically suspicious.

have := show 2 * x.toNat >>> n < 2 ^ w by
omega
omega
· have : x.toNat >>> n = 0 := by

Choose a reason for hiding this comment

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

Can this be simplified with ushiftRight_eq_zero?

@tobiasgrosser
Copy link

@bollu, can this be closed?

@bollu bollu closed this Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants