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: add BitVec.getLsb_concat #3457

Merged
merged 4 commits into from
Feb 23, 2024
Merged

Conversation

alexkeizer
Copy link
Contributor

First (baby)-step to a concat-based bitblast: a characterization of concat in terms of getLsb.

The proof might benefit slightly from a toNat_concat lemma, but I wasn't sure what the normal form there should be, so I avoided it.

@alexkeizer alexkeizer requested a review from kim-em as a code owner February 22, 2024 14:26
@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 Feb 22, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

leanprover-community-mathlib4-bot commented Feb 22, 2024

Mathlib CI status (docs):

  • ❗ Std/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase b6ed97bb3dad824d3c1fc82dbf290ef0505c42d0 --onto 12b867da5ace89f61d5a9fe011c2bb0469c40a10. (2024-02-22 14:38:33)
  • ❗ Std/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 815200eaad2a0fe31ef24df9ea37a2f3a054a4a1 --onto 6719af350fde9339354f28d091458df39a4af9d4. (2024-02-22 20:54:41)

@alexkeizer
Copy link
Contributor Author

awaiting-review

@github-actions github-actions bot added the awaiting-review Waiting for someone to review the PR label Feb 22, 2024
Comment on lines 427 to 429
(concat x b).getLsb i = match i with
| 0 => b
| i+1 => x.getLsb i := by
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm skeptical of this as a simp lemma with the match on the RHS.

The @[simp] lemmas should be for getLsb_concat_zero and getLsb_concat_succ.

Comment on lines 220 to +224
theorem toNat_le_one (c:Bool) : c.toNat ≤ 1 := by
cases c <;> trivial

theorem toNat_lt (b : Bool) : b.toNat < 2 :=
Nat.lt_succ_of_le (toNat_le_one _)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer consistent names here, but I think toNat_lt is correct, so will rename the other one.

src/Init/Data/Bool.lean Outdated Show resolved Hide resolved
@kim-em kim-em enabled auto-merge February 23, 2024 00:44
@kim-em kim-em added this pull request to the merge queue Feb 23, 2024
Merged via the queue into leanprover:master with commit 8bf6475 Feb 23, 2024
9 checks passed
github-merge-queue bot pushed a commit that referenced this pull request Feb 23, 2024
To merge after #3457.

---------

Co-authored-by: Alex Keizer <[email protected]>
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.

3 participants