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

refactor: consistently use variable w for the width of a bitvector #646

Conversation

alexkeizer
Copy link
Contributor

@alexkeizer alexkeizer commented Feb 14, 2024

Currently, lemmas about bitvectors inconsistently use n, m, v and w for the width.
I've (arbitrarily) picked w as the blessed variable, and changed all lemmas to use this, only using v when a lemma involves two bitvectors of differing widths.
I don't think the exact choice of variable matters much, but it does matter that we pick one and consistently use it.

This changes only the name of variables, it should not break any other code.

Additionally, I've dropped {w} implicit arguments in favor of a variable {w : Nat} at the start of the file.
This has one functional change: the type of getLsb_cons used to be (b : Bool) -> {w : Nat} -> ..., but is now {w : Nat} -> (b : Bool). Since this only changes the order of an implicit argument, the impact of this change should be very small.

This is still a work-in-progress. I've opened the PR already as a draft to see if I can get a leaff report to confirm there are no functional changes besides the one described above

Additionally, drop `{w}` implicit arguments in favor of a `variable {w : Nat}` at the start of the file.
This has one functional change:
the type of `getLsb_cons` used to be `(b : Bool) -> {w : Nat} -> ...`, but is now `{w : Nat} -> (b : Bool)`.
@alexkeizer
Copy link
Contributor Author

WIP

@github-actions github-actions bot added the WIP work in progress label Feb 14, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict This PR has merge conflicts with the `main` branch which must be resolved by the author. label Feb 15, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added merge-conflict This PR has merge conflicts with the `main` branch which must be resolved by the author. and removed merge-conflict This PR has merge conflicts with the `main` branch which must be resolved by the author. labels Feb 15, 2024
@kim-em
Copy link
Collaborator

kim-em commented Mar 24, 2024

If there's still useful material here, it will need to be moved to the Lean repo, and BitVec/Lemmas has been upstreamed.

@kim-em kim-em closed this Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-conflict This PR has merge conflicts with the `main` branch which must be resolved by the author. WIP work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants