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

[Merged by Bors] - refactor(number_theory/primorial): split the proof, golf it #18238

Closed
wants to merge 4 commits into from

Conversation

urkud
Copy link
Member

@urkud urkud commented Jan 20, 2023

  • Add nat.prime.dvd_choose, delete less general dvd_choose_of_middling_prime.
  • Add primorial_pos, primorial_add, primorial_add_dvd, and primorial_add_le.
  • Golf some proofs.

Here is a proof of dvd_choose_of_middling_prime based on nat.prime.dvd_choose:

open nat

lemma dvd_choose_of_middling_prime (p : ℕ) (is_prime : nat.prime p) (m : ℕ)
  (p_big : m + 1 < p) (p_small : p ≤ 2 * m + 1) : p ∣ choose (2 * m + 1) (m + 1) :=
is_prime.dvd_choose p_big (by simpa [two_mul] using p_big.le) p_small

Forward-ported in leanprover-community/mathlib4#1770


Open in Gitpod

@urkud urkud added awaiting-review The author would like community review of the PR t-algebra Algebra (groups, rings, fields etc) t-number-theory Number theory (also use t-algebra or t-analysis to specialize) labels Jan 20, 2023
Copy link
Collaborator

@YaelDillies YaelDillies left a comment

Choose a reason for hiding this comment

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

For future reference, can you add to the PR description a proof of dvd_choose_of_middling_prime from your new lemmas?

@urkud
Copy link
Member Author

urkud commented Jan 22, 2023

For future reference, can you add to the PR description a proof of dvd_choose_of_middling_prime from your new lemmas?

Done. Also forward-ported.

Copy link
Collaborator

@YaelDillies YaelDillies 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, that's perfect!

More lemmas, less lines. The kind of PRs I like to see.

maintainer merge

@YaelDillies
Copy link
Collaborator

Oh wait, sorry. It seemed that merge conflicts just happened.

@YaelDillies YaelDillies added the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Jan 24, 2023
@urkud
Copy link
Member Author

urkud commented Jan 24, 2023

I'll look into this tonight.

@urkud urkud removed the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Jan 25, 2023
@fpvandoorn
Copy link
Member

bors d+

@bors
Copy link

bors bot commented Jan 25, 2023

✌️ urkud can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@github-actions github-actions bot added delegated The PR author may merge after reviewing final suggestions. and removed awaiting-review The author would like community review of the PR labels Jan 25, 2023
@urkud
Copy link
Member Author

urkud commented Jan 25, 2023

bors merge

@github-actions github-actions bot added the ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) label Jan 25, 2023
bors bot pushed a commit that referenced this pull request Jan 25, 2023
* Add `nat.prime.dvd_choose`, delete less general `dvd_choose_of_middling_prime`.
* Add `primorial_pos`, `primorial_add`, `primorial_add_dvd`, and `primorial_add_le`.
* Golf some proofs.

Here is a proof of `dvd_choose_of_middling_prime` based on `nat.prime.dvd_choose`:

```lean
open nat

lemma dvd_choose_of_middling_prime (p : ℕ) (is_prime : nat.prime p) (m : ℕ)
  (p_big : m + 1 < p) (p_small : p ≤ 2 * m + 1) : p ∣ choose (2 * m + 1) (m + 1) :=
is_prime.dvd_choose p_big (by simpa [two_mul] using p_big.le) p_small
```

Forward-ported in leanprover-community/mathlib4#1770
@bors
Copy link

bors bot commented Jan 25, 2023

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title refactor(number_theory/primorial): split the proof, golf it [Merged by Bors] - refactor(number_theory/primorial): split the proof, golf it Jan 25, 2023
@bors bors bot closed this Jan 25, 2023
@bors bors bot deleted the YK-primorial branch January 25, 2023 22:56
bors bot pushed a commit to leanprover-community/mathlib4 that referenced this pull request Jan 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated The PR author may merge after reviewing final suggestions. ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) t-algebra Algebra (groups, rings, fields etc) t-number-theory Number theory (also use t-algebra or t-analysis to specialize)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants