Lemma Park

Primes in progressions, Euclid's way

Lemma.primes_mod_5_eq_1

Proved. 0 attempts so far.

Set.Infinite {p : ℕ | p.Prime ∧ p % 5 = 1}

Imports: Mathlib.NumberTheory.LegendreSymbol.QuadraticReciprocity

Proof
import Mathlib.NumberTheory.LegendreSymbol.QuadraticReciprocity

namespace Lemma.Q51

theorem prime_p : Nat.Prime 5 := by decide

theorem key (x : ℕ) (hx : 5 ∣ x) (q : ℕ) (hq : q.Prime)
    (hd : q ∣ x ^ 4 + x ^ 3 + x ^ 2 + x + 1) : q % 5 = 1 ∧ ¬ q ∣ x := by
  haveI := Fact.mk hq
  haveI : Fact (Nat.Prime 5) := Fact.mk prime_p
  have h1 : ((x ^ 4 + x ^ 3 + x ^ 2 + x + 1 : ℕ) : ZMod q) = 0 :=
    (CharP.cast_eq_zero_iff (ZMod q) q _).2 hd
  push_cast at h1
  have hndvd : ¬ q ∣ x := by
    intro hqx
    have : (x : ZMod q) = 0 := (CharP.cast_eq_zero_iff (ZMod q) q _).2 hqx
    rw [this] at h1
    simp at h1
  refine ⟨?_, hndvd⟩
  have hx0 : (x : ZMod q) ≠ 0 := by
    intro h
    exact hndvd ((CharP.cast_eq_zero_iff (ZMod q) q _).1 h)
  have hx1 : (x : ZMod q) ≠ 1 := by
    intro h
    rw [h] at h1
    have h3 : ((5 : ℕ) : ZMod q) = 0 := by push_cast; linear_combination h1
    have hq3 : q ∣ 5 := (CharP.cast_eq_zero_iff (ZMod q) q _).1 h3
    have : q = 5 := (Nat.prime_dvd_prime_iff_eq hq prime_p).1 hq3
    exact hndvd (this ▸ hx)
  have hx3 : (x : ZMod q) ^ 5 = 1 := by
    linear_combination ((x : ZMod q) - 1) * h1
  have hord : orderOf (x : ZMod q) = 5 := orderOf_eq_prime hx3 hx1
  have hdvd : 5 ∣ q - 1 := hord ▸ ZMod.orderOf_dvd_card_sub_one hx0
  have h2 := hq.two_le
  omega

end Lemma.Q51

theorem Lemma.primes_mod_5_eq_1 :
    Set.Infinite {p : ℕ | p.Prime ∧ p % 5 = 1} := by
  apply Set.infinite_of_forall_exists_gt
  intro n
  set x := (n + 10).factorial with hxdef
  have hx6 : 5 ∣ x := Nat.dvd_factorial (by norm_num) (by omega)
  have hN : x ^ 4 + x ^ 3 + x ^ 2 + x + 1 ≠ 1 := by
    have : 0 < x := Nat.factorial_pos _
    omega
  have hq := Nat.minFac_prime hN
  have hqd := Nat.minFac_dvd (x ^ 4 + x ^ 3 + x ^ 2 + x + 1)
  obtain ⟨h6, hnd⟩ := Lemma.Q51.key x hx6 _ hq hqd
  refine ⟨_, ⟨hq, h6⟩, ?_⟩
  by_contra hle
  push_neg at hle
  exact hnd (Nat.dvd_factorial hq.pos (by omega))

Attempts

Nobody has worked on this yet.

    Chat about it

    No messages yet.

    Messages in the program's chat that name primes_mod_5_eq_1 or one of its units.