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: toNat_sub_of_le #5314

Merged
merged 2 commits into from
Sep 12, 2024
Merged

feat: toNat_sub_of_le #5314

merged 2 commits into from
Sep 12, 2024

Conversation

bollu
Copy link
Contributor

@bollu bollu commented Sep 11, 2024

This adds a simplification lemma for (x - y).toNat when the subtraction is known to not overflow (i.e., y ≤ x).

We make a new section for this for two reasons:

  1. Definitions of subtraction occur before the definition of BitVec.le_def, so we cannot directly place this lemma at sub.
  2. There are other theorems of this kind, for addition and multiplication, which can morally live in the same section.

This adds a simplification lemma for `(x - y).toNat` when the subtraction is known to not overflow (i.e., `y ≤ x`).
@bollu bollu requested a review from kim-em as a code owner September 11, 2024 19:08
@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 Sep 11, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

Mathlib CI status (docs):

  • ❗ Mathlib CI can not be attempted yet, as the nightly-testing-2024-09-07 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-mathlib, Mathlib CI should run now. (2024-09-11 19:26:13)

@hargoniX hargoniX enabled auto-merge September 12, 2024 13:04
@hargoniX hargoniX added this pull request to the merge queue Sep 12, 2024
Merged via the queue into leanprover:master with commit 273b754 Sep 12, 2024
13 checks passed
tobiasgrosser pushed a commit to opencompl/lean4 that referenced this pull request Sep 16, 2024
This adds a simplification lemma for `(x - y).toNat` when the
subtraction is known to not overflow (i.e., `y ≤ x`).

We make a new section for this for two reasons:
1. Definitions of subtraction occur before the definition of
`BitVec.le_def`, so we cannot directly place this lemma at `sub`.
2. There are other theorems of this kind, for addition and
multiplication, which can morally live in the same section.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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