-
Notifications
You must be signed in to change notification settings - Fork 0
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: getLsb_replicate #10
Conversation
@@ -583,11 +583,9 @@ instance : HAppend (BitVec w) (BitVec v) (BitVec (w + v)) := ⟨.append⟩ | |||
-- TODO: write this using multiplication | |||
/-- `replicate i x` concatenates `i` copies of `x` into a new vector of length `w*i`. -/ | |||
def replicate : (i : Nat) → BitVec w → BitVec (w*i) | |||
| 0, _ => 0 | |||
| 0, _ => 0#0 |
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.
Not sure if this change was strictly necessary, but it makes it cleaner to read.
have hEq : w + w*n = w*(n + 1) := by | ||
rw [Nat.mul_add, Nat.add_comm, Nat.mul_one] | ||
hEq ▸ (x ++ replicate n x) | ||
(x ++ replicate n x).cast (by rw [Nat.mul_succ]; omega) |
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 replaced the cast by BitVec.cast, for which we have better equation lemmas.
It addresses a performance issue at https://github.com/leanprover/LNSym/blob/proof_size_expt/Proofs/SHA512/Experiments/Sym20.lean
This allows bitblasting `BitVec.replicate`.
This theorem is meant to say that `List.take` and `List.takeWhile` commute.
This also updates the 4.9.0 release notes with backported changes.
…urrent setting (leanprover#4781) It is confusing that the message suggesting to use the `diagnostics` option is given even when the option is already set. This PR makes use of lazy message data to make the message contingent on the option being false. It also tones down the promise that there is any diagonostic information available, since sometimes there is nothing to report. Suggested by Johan Commelin.
Co-authored-by: Kyle Miller <[email protected]>
To be implemented in leanprover#4814
…er#4538) Co-authored-by: Mac Malone <[email protected]>
This came up in the context of simplifying proof states for https://github.com/leanprover/LNSym.
This message is often incorporated into source files via `#guard_msgs`. This change ensures it won't go over the 100 character ruler, and I think is equally grammatical. :-)
This PR also fixes a missing borrow annotation.
This adds theorems `ushiftRight_rec_zero`, `ushiftRight_rec_succ`, `ushiftRight_rec_eq`, and `shiftRight_eq_shiftRight_rec`. --------- Co-authored-by: Tobias Grosser <[email protected]>
This performance issue was exposed by the benchmarks at https://github.com/leanprover/LNSym/tree/proof_size_expt/Proofs/SHA512/Experiments
Verso needed a symbol that was unexported - this exposes it again.
These were merged in leanprover#4873. |
@hargoniX wanted lemmas for replicate, so here's the lemmas.