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: USize.size inequalities #6203

Merged
merged 4 commits into from
Nov 27, 2024
Merged

Conversation

tydeu
Copy link
Member

@tydeu tydeu commented Nov 24, 2024

This PR adds the theorems le_usize_size and usize_size_le, which make proving inequalities about USize.size easier.

It also deprecates usize_size_gt_zero in favor of usize_size_pos (as that seems more consistent with our naming covention) and adds USize.toNat_ofNat_of_lt_32 for dealing with small USize literals.

It also moves USize.ofNat32 and USize.toUInt64 to Init.Data.UInt.Basic as neither are used in Init.Prelude anymore.

@tydeu tydeu mentioned this pull request Nov 24, 2024
@tydeu
Copy link
Member Author

tydeu commented Nov 24, 2024

These inequalities could also be named USize.le_size and USize.size_le, but I stuck with the current usize_size convention. This also avoids a clash with batteries, which already defines them and uses 2 ^ _ to represent the size instead of the computed value. I used the computed value as that is also current core convention.

@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 Nov 24, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Nov 24, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Nov 24, 2024
@leanprover-community-bot leanprover-community-bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Nov 25, 2024
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Nov 25, 2024

Mathlib CI status (docs):

  • ✅ Mathlib branch lean-pr-testing-6203 has successfully built against this PR. (2024-11-25 00:02:56) View Log
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 43dfc2a25fc64095fb76d576802a70d88773fea8 --onto 884a9ea2ff70bb4d0c6da4a1c23ffc26c3a974ee. (2024-11-25 13:49:54)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 43dfc2a25fc64095fb76d576802a70d88773fea8 --onto 20acc72a29a8bb4d55223651caa0553ffa82ac88. (2024-11-26 04:58:06)

@tydeu tydeu marked this pull request as ready for review November 25, 2024 00:13
@tydeu tydeu requested a review from kim-em as a code owner November 25, 2024 00:13
@tydeu tydeu added the changelog-library Library label Nov 25, 2024
Co-authored-by: Kim Morrison <kim@tqft.net>
@tydeu tydeu added this pull request to the merge queue Nov 26, 2024
Merged via the queue into leanprover:master with commit 3d511a5 Nov 27, 2024
16 checks passed
@tydeu tydeu deleted the usize-size-ineq branch November 27, 2024 02:23
JovanGerb pushed a commit to JovanGerb/lean4 that referenced this pull request Jan 21, 2025
This PR adds the theorems `le_usize_size` and `usize_size_le`, which
make proving inequalities about `USize.size` easier.

It also deprecates `usize_size_gt_zero` in favor of `usize_size_pos` (as
that seems more consistent with our naming covention) and adds
`USize.toNat_ofNat_of_lt_32` for dealing with small USize literals.

It also moves `USize.ofNat32` and `USize.toUInt64` to
`Init.Data.UInt.Basic` as neither are used in `Init.Prelude` anymore.

---------

Co-authored-by: Kim Morrison <kim@tqft.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builds-mathlib CI has verified that Mathlib builds against this PR 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.

3 participants