Archive: a^n+1 is prime only if n is a power of two#14049
Archive: a^n+1 is prime only if n is a power of two#14049
a^n+1 is prime only if n is a power of two#14049Conversation
PR summary 6f097b9016Import changesNo significant changes to the import graph Declarations diff
You can run this locally as follows## summary with just the declaration names:
./scripts/no_lost_declarations.sh short <optional_commit>
## more verbose report:
./scripts/no_lost_declarations.sh <optional_commit> |
|
Unclear what and why is failing... |
|
Run |
Ruben-VandeVelde
left a comment
There was a problem hiding this comment.
Thanks, some mostly stylistic suggestions.
Should this go into archive or mathlib proper?
Archive/EulerFermat.lean
Outdated
| have true_or_false (A B : Prop) (hB : ¬ B) (hab : A ∨ B) : A := by simp_all only [or_false] | ||
| apply true_or_false at h₁ |
There was a problem hiding this comment.
You may be looking for Or.resolve_right
There was a problem hiding this comment.
This changes the logic, so I'd rather leave it. Is it a problem?
Thank for the review. I think some proof of this should go in Mathlib, but not sure about this one. Other proofs can be found or are linked in https://math.stackexchange.com/questions/140804/if-2n1-is-prime-why-must-n-be-a-power-of-2, and there is the one in Harvey & Wright mentioned in this PR. I do not know if these are shorter / more elegant. |
|
I would be in favor of this result going into mathlib with a more streamlined proof. |
Do you think this specific approach can be substantially streamlined? Or do you think another approach would result in what could go in Mathlib? I might take this up then, but it wouldn't affect this PR, I guess. |
Maybe I misunderstood. Did you mean mathlib or mathlib/Mathlib? |
|
I meant mathlib/Mathlib. I think a more direct approach would probably be better. Perhaps something along the lines of this: |
Archive/EulerFermat.lean
Outdated
| . use a ^ 2 ^ k + 1 | ||
| have h₁ : a ^ 2 ^ k + 1 ≠ 1 := by | ||
| rw [ne_eq, add_left_eq_self, pow_eq_zero_iff] | ||
| . exact not_eq_zero_of_lt ha |
There was a problem hiding this comment.
[lint-style] reported by reviewdog 🐶
| . exact not_eq_zero_of_lt ha | |
| · exact not_eq_zero_of_lt ha |
|
Remarkable reduction, many thanks. I used this, and you can see the result in the last commit, which I hope is not too bad. I think this commit (after I have reduced it further) will then be split into several PRs because the lemmas belong to different parts of Mathlib. This PR will depend on them and the code will move to Nat.Prime. All with attribution. That's my idea. What do you think? |
Any nonzero natural number is the product of an odd part `m` and a power of two `2 ^ k`. This is a trivial consequence of the existing `exists_eq_pow_mul_and_not_dvd`, but performs a convenient restatement in terms of `Odd`. Needed by #14049. Co-authored-by: Thomas Browning <tb65536@uw.edu>
|
@tb65536 where to put the final theorem? I looked at No, copying won't work because of |
For `a > 1`, `a ^ b = a` iff `b = 1`. Lemma needed by #14049. Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com>
Any nonzero natural number is the product of an odd part `m` and a power of two `2 ^ k`. This is a trivial consequence of the existing `exists_eq_pow_mul_and_not_dvd`, but performs a convenient restatement in terms of `Odd`. Needed by #14049. Co-authored-by: Thomas Browning <tb65536@uw.edu>
For `a > 1`, `a ^ b = a` iff `b = 1`. Lemma needed by #14049. Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com>
|
This PR/issue depends on: |
The fact that primes of the form
a^n+1must havena power of two was stated andthe proof outlined in three sentences by Euler in the year 1738 [E026]. A proof can be
found in Hardy & Wright, An introduction to the theory of numbers (5th ed., 1979),
p.15, Theorem 17. In the proof below we followed Euler's thoughts.
Nat/PrimebyNat/Factors#14357-->