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] - feat(Data/Nat/Prime): some lemmas on primes and powers #10025

Closed
wants to merge 4 commits into from

Conversation

MichaelStollBayreuth
Copy link
Collaborator

@MichaelStollBayreuth MichaelStollBayreuth commented Jan 26, 2024

This is the first PR in a sequence that adds auxiliary lemmas from the EulerProducts project to Mathlib.

It adds two lemmas on prime numbers and powers:

lemma Nat.Prime.one_le {p : ℕ} (hp : p.Prime) : 1 ≤ p

lemma Nat.Prime.pow_inj {p q m n : ℕ} (hp : p.Prime) (hq : q.Prime)
    (h : p ^ (m + 1) = q ^ (n + 1)) : p = q ∧ m = n

(The first one is for discoverability by exact? in cases one needs 1 ≤ p.)


Open in Gitpod

@MichaelStollBayreuth MichaelStollBayreuth added awaiting-review The author would like community review of the PR awaiting-CI labels Jan 26, 2024
@MichaelStollBayreuth MichaelStollBayreuth changed the title feat(Data.Nat.{Pow|Prime}): three lemmas on primes and powers feat(Data.Nat.{Pow|Prime}): some lemmas on primes and powers Jan 26, 2024
@MichaelStollBayreuth MichaelStollBayreuth changed the title feat(Data.Nat.{Pow|Prime}): some lemmas on primes and powers feat(Data.Nat.Prime): some lemmas on primes and powers Jan 26, 2024
@MichaelStollBayreuth MichaelStollBayreuth changed the title feat(Data.Nat.Prime): some lemmas on primes and powers feat(Data/Nat/Prime): some lemmas on primes and powers Jan 26, 2024
@@ -736,6 +738,14 @@ theorem prime_iff_prime_int {p : ℕ} : p.Prime ↔ _root_.Prime (p : ℤ) :=
simpa only [Int.coe_nat_dvd, (Int.ofNat_mul _ _).symm] using hp.2.2 a b⟩⟩
#align nat.prime_iff_prime_int Nat.prime_iff_prime_int

/-- Two prime powers with positive exponents are equal only when the primes and the
exponents are equal. -/
lemma Prime.pow_injective {p q m n : ℕ} (hp : p.Prime) (hq : q.Prime)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Theorems whose name ends with "injective" usually have Injective as their conclusion. Probably _inj is better. You might also want _inj_left (p=q) and _inj_right (m=n) (assuming I got my left and right correct)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll change "injective" to "inj".

Loogling for "_inj_left" shows that it is not consistent, with a 7-5 majority concluding equality for the first argument. There are quite a few more with "_left_inj" (I didn't try to count here).
Nat.pow_right_injective gives the "_inv_right" version (using Nat.Prime.two_le); would the version for the second argument still be good to have (essentially replacing 2 ≤ n with n.Prime)?
Nat.pow_left_injective is more general (no restriction to primes), so the left version is maybe not necessary.

@ocfnash
Copy link
Contributor

ocfnash commented Jan 30, 2024

Thanks!

bors merge

@github-actions github-actions bot added ready-to-merge This PR has been sent to bors. and removed awaiting-review The author would like community review of the PR labels Jan 30, 2024
mathlib-bors bot pushed a commit that referenced this pull request Jan 30, 2024
This is the first PR in a sequence that adds auxiliary lemmas from the [EulerProducts](https://github.com/MichaelStollBayreuth/EulerProducts) project to Mathlib.

It adds two lemmas on prime numbers and powers:
```lean
lemma Nat.Prime.one_le {p : ℕ} (hp : p.Prime) : 1 ≤ p

lemma Nat.Prime.pow_injective {p q m n : ℕ} (hp : p.Prime) (hq : q.Prime)
    (h : p ^ (m + 1) = q ^ (n + 1)) : p = q ∧ m = n
```
(The first one is for discoverability by `exact?` in cases one needs `1 ≤ p`.)
@mathlib-bors
Copy link

mathlib-bors bot commented Jan 30, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat(Data/Nat/Prime): some lemmas on primes and powers [Merged by Bors] - feat(Data/Nat/Prime): some lemmas on primes and powers Jan 30, 2024
@mathlib-bors mathlib-bors bot closed this Jan 30, 2024
@mathlib-bors mathlib-bors bot deleted the MS_LSeries_Nat branch January 30, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR has been sent to bors.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants