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 Nat.mod_eq_sub and fix dependencies from Nat.sub_mul_eq_mod_of_lt_of_le #6160

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

luisacicolini
Copy link
Contributor

@luisacicolini luisacicolini commented Nov 21, 2024

This PR adds theorem mod_eq_sub, makes theorem sub_mul_eq_mod_of_lt_of_le not private anymore and moves its location within the rotate* section to use it in other proofs.

@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 21, 2024
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Nov 21, 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 9cf83706e743debb47f3b1a48e1b92210c1c0720 --onto 72e952eadc6a171310f1d8e9d6e78acf98421494. (2024-11-21 19:11:18)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 9cf83706e743debb47f3b1a48e1b92210c1c0720 --onto 884a9ea2ff70bb4d0c6da4a1c23ffc26c3a974ee. (2024-11-25 08:57:09)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 9cf83706e743debb47f3b1a48e1b92210c1c0720 --onto 9a17919ef11c2dba824498229633b8333a0b53d9. (2024-11-26 11:54:24)

@kim-em kim-em added the awaiting-author Waiting for PR author to address issues label Nov 21, 2024
@luisacicolini
Copy link
Contributor Author

Thanks a lot @kim-em @bollu for the reviews! It took me some time to understand it, but the proof of mod_eq_sub_of_le_of_lt should now be okay.

@luisacicolini luisacicolini marked this pull request as ready for review November 25, 2024 08:38
@luisacicolini
Copy link
Contributor Author

luisacicolini commented Nov 25, 2024

awaiting-reviews

@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 Nov 25, 2024
@luisacicolini
Copy link
Contributor Author

luisacicolini commented Nov 25, 2024

Actually, it looks like one such theorem exists already: Nat.sub_mul_eq_mod_of_lt_of_le so I guess this PR is not needed after all and I can use the other theorem. And maybe move the private theorem to Nat.

@kim-em
Copy link
Collaborator

kim-em commented Nov 26, 2024

Could we make sure

theorem mod_eq_sub (x w : Nat) : x % w = x - w * (x / w) := by
  conv => rhs; congr; rw [← mod_add_div x w]
  simp

makes it in? Either strip this PR down to just that, or close this PR and include it in a subsequent PR?

@luisacicolini luisacicolini changed the title feat: add generalized Nat.mod_eq_sub_of_le_of_lt feat: add Nat.mod_eq_sub and fix dependencies from Nat.sub_mul_eq_mod_of_lt_of_le Nov 26, 2024
@luisacicolini
Copy link
Contributor Author

I have fixed the dependencies from the existing theorem (which is now not private anymore and in a different location, otherwise I could not use it) and kept mod_eq_sub. Happy to split the PR into two if that is better.

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