-
Notifications
You must be signed in to change notification settings - Fork 113
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.ofFn and lemmas #1078
base: main
Are you sure you want to change the base?
Conversation
Mathlib CI status (docs):
|
This seems to have grown into two separate PRs smushed together? |
Yes, I was working on the split earlier today. I will push the prequel PR soon. I'm also inclined to drop the |
Split completed, |
namespace BitVec | ||
|
||
/-- `ofFnLEAux f` returns the `BitVec m` whose `i`th bit is `f i` when `i < m`, little endian. -/ | ||
@[inline] def ofFnLEAux (m : Nat) (f : Fin n → Bool) : BitVec m := |
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.
I'm not quite sure whether we want to have these functions in general. There is no chance that bv_decide
can ever support this kind of BitVec
as it would require reasoning about a function Fin n -> Bool
which it cannot do. Whether this is an inclusion/exclusion criterium for BitVec
stuff I don't know.
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.
I'm using these for linear algebra over the 2-element field, so this is not completely related to bv_decide
.
This PR adds a lemma relating `msb` and `getMsbD`, and three lemmas regarding `getElem` and `shiftConcat`. These lemmas were needed in [Batteries#1078](leanprover-community/batteries#1078) and the request to upstream was made in the review of that PR. --------- Co-authored-by: Siddharth <[email protected]>
Nat.ofBits
andFin.ofBits
#1089Int.ofBits
#1096