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: BitVec.twoPow and lemmas, toward bitblasting multiplication for LeanSAT #4417

Merged
merged 5 commits into from
Jun 23, 2024

Conversation

bollu
Copy link
Contributor

@bollu bollu commented Jun 10, 2024

We add a new definition BitVec.twoPow w i to represent (1#w <<< i).
This expression is used to test bits when building the multiplication bitblaster.

Patch 1/?, being peeled from opencompl#6.

@bollu bollu requested a review from kim-em as a code owner June 10, 2024 11:51
@bollu bollu marked this pull request as draft June 10, 2024 12:09
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Jun 10, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

leanprover-community-mathlib4-bot commented Jun 10, 2024

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 366f3ac272b6a12b19cabd8573652fc138804bdf --onto ea46bf2839ad1c98d3a0c3e5caad8a81f812934c. (2024-06-10 12:15:02)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase bd3b466f2f4f6d9ff10c65fbf68f758ecaa071c3 --onto bedcbfcfeed429428c3e7f008b6984fc8c2b2b76. (2024-06-13 10:18:13)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase bd3b466f2f4f6d9ff10c65fbf68f758ecaa071c3 --onto 1cf71e54cf268e87cf5c43c830d953f5c88e6c39. (2024-06-17 14:22:18)

bollu and others added 2 commits June 13, 2024 11:07
… LeanSAT

We add a new definition `BitVec.twoPow w i` to represent `(1#w <<< i)`.
This expression is used to test bits when building the multiplication bitblaster.

Patch 1/?, being peeled from #6.
@bollu bollu force-pushed the hargonix-twoPow branch from 52af7b8 to cc88952 Compare June 13, 2024 10:07
@bollu bollu marked this pull request as ready for review June 13, 2024 10:43
@kim-em
Copy link
Collaborator

kim-em commented Jun 13, 2024

Mostly happy, but:

Convince me that this needs a name, and shouldn't just be written out as its definition in all the statements.

The proofs are less trivial than I expected (they are fine), and I think this justifies giving a name, but I just want to push back a little so we don't accumulate named entities needlessly!

@bollu
Copy link
Contributor Author

bollu commented Jun 15, 2024

@semorrison That's somewhat of a hard ask :) I abstracted it precisely because dealing with the raw definitions was unwieldy.

I've been mulling over this a little, and I wonder what the 'correct' approach is. The crux is that I want to break a bitvector into the bitwise-or of different 1 <<< i's, and having a name for this 1 <<< i object makes things easy because:

  1. It conceptually isolates the core idea of each induction.
  2. It makes naming lemmas easier, as they now talk about twoPow.

I wonder what you recommend in such a situation. I also wonder how mathlib handles such scenarios!

@kim-em
Copy link
Collaborator

kim-em commented Jun 15, 2024

No, I think your justification is satisfactory! Let's get the minor suggestions sorted out, and I can merge.

@kim-em kim-em added the awaiting-author Waiting for PR author to address issues label Jun 16, 2024
@bollu
Copy link
Contributor Author

bollu commented Jun 17, 2024

I've fixed all nits now.

@bollu
Copy link
Contributor Author

bollu commented Jun 17, 2024

awaiting-review

@github-actions github-actions bot added awaiting-review Waiting for someone to review the PR and removed awaiting-author Waiting for PR author to address issues labels Jun 17, 2024
@kim-em kim-em added this pull request to the merge queue Jun 23, 2024
Merged via the queue into leanprover:master with commit bc6188a Jun 23, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-review Waiting for someone to review the PR toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants