Skip to content

Conversation

@bollu
Copy link
Contributor

@bollu bollu commented Apr 30, 2025

This PR provides a compact formula for the MSB of the sdiv. Most of the work in the PR involves handling the corner cases of division overflowing (e.g. intMin / -1 = intMin)

bollu added 10 commits April 29, 2025 10:10
In this PR, we add lemmas for `msb_sdiv`.
This needs quite a bit of analysis on `Int.tdiv`,
and we develop the theory of `Int.tdiv` to enable proving `msb_sdiv`.
The salient points are as follows:
- First, sdiv equals tdiv.
@bollu bollu changed the title feat: msb_sdiv feat: BitVec.msb_sdiv Apr 30, 2025
@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 Apr 30, 2025
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Apr 30, 2025

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase b677702b02a3127e5f0d1a25b40fe55ed7b623f5 --onto a1989c2387f90c4cde9f07de6c7cc8f7525cab6f. You can force Mathlib CI using the force-mathlib-ci label. (2025-04-30 14:20:45)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase b677702b02a3127e5f0d1a25b40fe55ed7b623f5 --onto 2b4f372317f214e92988a79fc765586fbfb64e97. You can force Mathlib CI using the force-mathlib-ci label. (2025-05-12 21:09:59)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase b677702b02a3127e5f0d1a25b40fe55ed7b623f5 --onto 9b9dd8546a123d746580649b239f26c26d370d20. You can force Mathlib CI using the force-mathlib-ci label. (2025-06-09 07:34:34)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase b677702b02a3127e5f0d1a25b40fe55ed7b623f5 --onto faffe863343211d03d07d4ef19d90a2aa9d6fc8c. You can force Mathlib CI using the force-mathlib-ci label. (2025-06-13 19:50:00)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase b677702b02a3127e5f0d1a25b40fe55ed7b623f5 --onto 957b904ef9fd11ed9cb49f12fcc9d7b989c01900. You can force Mathlib CI using the force-mathlib-ci label. (2025-06-16 10:02:00)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase b677702b02a3127e5f0d1a25b40fe55ed7b623f5 --onto fdf6d2ea3bdbebb736aa5d05d00b27a5abaa8fb8. You can force Mathlib CI using the force-mathlib-ci label. (2025-06-17 15:24:28)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase b677702b02a3127e5f0d1a25b40fe55ed7b623f5 --onto e83b7681407043c75f5167c2e4da13e25078a0c0. You can force Mathlib CI using the force-mathlib-ci label. (2025-06-18 14:35:42)

Copy link
Contributor

@luisacicolini luisacicolini left a comment

Choose a reason for hiding this comment

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

lgtm!

@bollu bollu marked this pull request as ready for review June 17, 2025 16:35
@bollu bollu requested a review from kim-em as a code owner June 17, 2025 16:35
@tobiasgrosser
Copy link
Contributor

changelog-library

@github-actions github-actions bot added the changelog-library Library label Jun 17, 2025
Copy link
Contributor

@tobiasgrosser tobiasgrosser left a comment

Choose a reason for hiding this comment

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

Thank you @bollu. Modulo the last comments, this looks good to me.

@bollu
Copy link
Contributor Author

bollu commented Jun 18, 2025

changelog-library

@hargoniX hargoniX added changelog-library Library and removed changelog-library Library labels Jun 18, 2025
@bollu
Copy link
Contributor Author

bollu commented Jun 18, 2025

@tobiasgrosser all comments addressed.

@hargoniX hargoniX added this pull request to the merge queue Jun 19, 2025
Merged via the queue into leanprover:master with commit da9a536 Jun 19, 2025
15 checks passed
wkrozowski pushed a commit to wkrozowski/lean4 that referenced this pull request Jun 24, 2025
This PR provides a compact formula for the MSB of the sdiv. Most of the
work in the PR involves handling the corner cases of division
overflowing (e.g. `intMin / -1 = intMin`)

---------

Co-authored-by: Luisa Cicolini <[email protected]>
Co-authored-by: Tobias Grosser <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-library Library 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.

5 participants