Skip to content

[Merged by Bors] - refactor: replace Bitvec with Std.BitVec#5920

Closed
mhk119 wants to merge 209 commits intomasterfrom
Bitvecnew
Closed

[Merged by Bors] - refactor: replace Bitvec with Std.BitVec#5920
mhk119 wants to merge 209 commits intomasterfrom
Bitvecnew

Conversation

@mhk119
Copy link
Copy Markdown
Contributor

@mhk119 mhk119 commented Jul 15, 2023

re-adding definitions and theorems about bitvectors that mathlib has for Bitvec to the new Std.BitVec type, and getting rid of the former.

In std, the choice was made to define ult (unsigned less than) and related comparisons as Bool-valued, where the corresponding defs for Bitvec in mathlib are Prop-valued. Std does not have definitions for the respective greater-equal or greater-than comparisons, so we add those here, but we choose to be consistent with std and make them Bool-valued as well, breaking with the old API.


EDIT (alexkeizer):
Since opening this PR, substantial parts of the proposed refactor have been upstreamed to std.
This PR has thus changed its goal from:

Redefine BitVec w as Fin (2^w) instead of Vector Bool w because the Fin representation is computationally more efficient and allows users to reuse existing theorems on Fin or Nat easily.

Open in Gitpod

mhk119 and others added 30 commits June 11, 2023 20:23
Co-authored-by: Scott Morrison <scott@tqft.net>
Co-authored-by: Scott Morrison <scott@tqft.net>
Co-authored-by: Scott Morrison <scott@tqft.net>
Co-authored-by: Scott Morrison <scott@tqft.net>
Co-authored-by: Chris Hughes <33847686+ChrisHughes24@users.noreply.github.com>
Co-authored-by: Chris Hughes <33847686+ChrisHughes24@users.noreply.github.com>
Co-authored-by: Chris Hughes <33847686+ChrisHughes24@users.noreply.github.com>
Co-authored-by: Chris Hughes <33847686+ChrisHughes24@users.noreply.github.com>
Co-authored-by: Chris Hughes <33847686+ChrisHughes24@users.noreply.github.com>
Co-authored-by: Chris Hughes <33847686+ChrisHughes24@users.noreply.github.com>
Co-authored-by: Chris Hughes <33847686+ChrisHughes24@users.noreply.github.com>
Co-authored-by: Chris Hughes <33847686+ChrisHughes24@users.noreply.github.com>
Co-authored-by: Chris Hughes <33847686+ChrisHughes24@users.noreply.github.com>
Co-authored-by: Chris Hughes <33847686+ChrisHughes24@users.noreply.github.com>
Co-authored-by: Chris Hughes <33847686+ChrisHughes24@users.noreply.github.com>
Co-authored-by: Chris Hughes <33847686+ChrisHughes24@users.noreply.github.com>
Co-authored-by: Chris Hughes <33847686+ChrisHughes24@users.noreply.github.com>
tobiasgrosser and others added 5 commits November 26, 2023 14:23
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@eric-wieser
Copy link
Copy Markdown
Member

bors merge

This looks good to go now; thanks for splitting out all the other smaller PRs to make this a manageable size!

@github-actions github-actions bot added ready-to-merge This PR has been sent to bors. and removed awaiting-review labels Nov 29, 2023
mathlib-bors bot pushed a commit that referenced this pull request Nov 29, 2023
re-adding definitions and theorems about bitvectors that mathlib has for `Bitvec` to the new `Std.BitVec` type, and getting rid of the former.

In std, the choice was made to define ult (unsigned less than) and related comparisons as `Bool`-valued, where the corresponding defs for `Bitvec` in mathlib are `Prop`-valued. Std does not have definitions for the respective greater-equal or greater-than comparisons, so we add those here, but we choose to be consistent with std and make them `Bool`-valued as well, breaking with the old API. 



Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Co-authored-by: Alex Keizer <alex@keizer.dev>
Co-authored-by: Harun Khan <harun19@stanford.edu>
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Nov 29, 2023

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title refactor: replace Bitvec with Std.BitVec [Merged by Bors] - refactor: replace Bitvec with Std.BitVec Nov 29, 2023
@mathlib-bors mathlib-bors bot closed this Nov 29, 2023
@mathlib-bors mathlib-bors bot deleted the Bitvecnew branch November 29, 2023 12:53
@alexkeizer
Copy link
Copy Markdown
Collaborator

Yay, we finally made it! Thanks everyone for helping out along the way!

@tobiasgrosser
Copy link
Copy Markdown
Contributor

Thank you all, indeed!

@mhk119
Copy link
Copy Markdown
Contributor Author

mhk119 commented Nov 30, 2023

Thanks everyone for your hard work! This is amazing.

mathlib-bors bot pushed a commit that referenced this pull request Nov 30, 2023
This matches the name of `Std.BitVec`.
Performing the rename was deliberately left out of #5920, to avoid creating a break in the git history.
@linesthatinterlace
Copy link
Copy Markdown
Collaborator

Congratulations!

grunweg pushed a commit that referenced this pull request Dec 15, 2023
These were factored out of #5920 as they seem generally useful.
awueth pushed a commit that referenced this pull request Dec 19, 2023
These were factored out of #5920 as they seem generally useful.
awueth pushed a commit that referenced this pull request Dec 19, 2023
These are generally useful and split out of #5920.



Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
awueth pushed a commit that referenced this pull request Dec 19, 2023
re-adding definitions and theorems about bitvectors that mathlib has for `Bitvec` to the new `Std.BitVec` type, and getting rid of the former.

In std, the choice was made to define ult (unsigned less than) and related comparisons as `Bool`-valued, where the corresponding defs for `Bitvec` in mathlib are `Prop`-valued. Std does not have definitions for the respective greater-equal or greater-than comparisons, so we add those here, but we choose to be consistent with std and make them `Bool`-valued as well, breaking with the old API. 



Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Co-authored-by: Alex Keizer <alex@keizer.dev>
Co-authored-by: Harun Khan <harun19@stanford.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR has been sent to bors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants