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: getLsb_replicate #10

Closed
wants to merge 23 commits into from
Closed

feat: getLsb_replicate #10

wants to merge 23 commits into from

Conversation

bollu
Copy link

@bollu bollu commented Jul 22, 2024

@hargoniX wanted lemmas for replicate, so here's the lemmas.

@@ -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
Copy link
Author

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)
Copy link
Author

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.

@bollu bollu changed the title Get lsb replicate feat: getLsb_replicate Jul 24, 2024
This allows bitblasting `BitVec.replicate`.
kim-em and others added 19 commits July 31, 2024 03:03
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 <kmill31415@gmail.com>
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 <github@grosser.es>
Verso needed a symbol that was unexported - this exposes it again.
@tobiasgrosser
Copy link

These were merged in leanprover#4873.

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.

7 participants