← 全部题目

Grimm's Conjecture (Erdos Problem 375) on Short Blocks of Semiprimes: Twin-Prime Square Triples Are the Only Obstruction

已形式化验证(Lean 4 + Mathlib,主定理)

完整猜想没有解决。这是一个部分结果,主定理已用 Lean 形式化验证,没有人工审稿。

结论

Grimm's conjecture (1969), listed as Erdos Problem 375, says the following. If n+1,,n+k are all composite, then there are distinct primes p_1,,p_k with p_i n+i. The conjecture is open. We prove this short-interval classification. Let x 216 and h^2<24x, and let A[x,x+h]Z be a set in which every member either is a product of two primes (possibly equal) or has a prime divisor greater than h. Then the members of A can be given distinct prime divisors if and only if A does not contain all three of p^2, p(p+2), (p+2)^2 for any twin-p

论文 PDF(英文) · Zenodo 存档

Lean 证明

主定理已在 Lean 4(Mathlib 0df444a360ea)里编译通过,只用 propext、Classical.choice、Quot.sound 三个公理;陈述是否忠实由 gpt-6.2-sol 核对。

完整 Lean 文件
import Mathlib

/-- A prime representative system for a finite set `A` of naturals: an injective
choice of a prime divisor `p a ∣ a` for each `a ∈ A`. -/
def HasPrimeRepSystem (A : Finset ℕ) : Prop :=
  ∃ f : ℕ → ℕ, Set.InjOn f (A : Set ℕ) ∧ ∀ a ∈ A, (f a).Prime ∧ f a ∣ a

/-- `A` contains a twin-prime triple `{p^2, p(p+2), (p+2)^2}` with `p`, `p+2` prime. -/
def ContainsTwinPrimeTriple (A : Finset ℕ) : Prop :=
  ∃ p : ℕ, p.Prime ∧ (p + 2).Prime ∧
    p ^ 2 ∈ A ∧ p * (p + 2) ∈ A ∧ (p + 2) ^ 2 ∈ A

/-- Main theorem: let `x ≥ 216` and `h^2 < 24x`, and let `A ⊆ [x, x+h]` be a set
in which every member is a product of two primes (possibly equal) or has a prime
divisor greater than `h`. Then `A` has a prime representative system if and only
if `A` contains no twin-prime triple. -/
theorem prime_rep_system_iff_no_twin_prime_triple
    (x h : ℕ) (hx : 216 ≤ x) (hh : h ^ 2 < 24 * x)
    (A : Finset ℕ) (hA : A ⊆ Finset.Icc x (x + h))
    (hcond : ∀ a ∈ A,
      (∃ q q' : ℕ, q.Prime ∧ q'.Prime ∧ a = q * q') ∨
      (∃ p : ℕ, p.Prime ∧ p ∣ a ∧ h < p)) :
    HasPrimeRepSystem A ↔ ¬ ContainsTwinPrimeTriple A := by
  classical
  have rep_prime_factor : ∀ {s u v p : ℕ}, u.Prime → v.Prime → s = u * v →
      p.Prime → p ∣ s → p = u ∨ p = v := by
    intro s u v p hu hv hs hp hd
    rw [hs] at hd
    rcases (Nat.Prime.dvd_mul hp).mp hd with hd | hd
    · exact Or.inl ((Nat.prime_dvd_prime_iff_eq hp hu).mp hd)
    · exact Or.inr ((Nat.prime_dvd_prime_iff_eq hp hv).mp hd)
  have rep_other_factor : ∀ {s u v p : ℕ}, u.Prime → v.Prime → s = u * v →
      p.Prime → p ∣ s → ∃ r, r.Prime ∧ s = p * r := by
    intro s u v p hu hv hs hp hd
    rcases rep_prime_factor hu hv hs hp hd with e | e
    · exact ⟨v, hv, by rw [hs, e]⟩
    · exact ⟨u, hu, by rw [hs, e, Nat.mul_comm u v]⟩
  have rep_prime_mod : ∀ {p : ℕ}, p.Prime → 5 ≤ p → p % 2 = 1 ∧ p % 3 ≠ 0 := by
    intro p hp h5
    constructor
    · by_contra hn
      have hd : 2 ∣ p := Nat.dvd_of_mod_eq_zero (by omega)
      have e := (Nat.prime_dvd_prime_iff_eq (by decide : Nat.Prime 2) hp).mp hd
      omega
    · intro hz
      have hd : 3 ∣ p := Nat.dvd_of_mod_eq_zero hz
      have e := (Nat.prime_dvd_prime_iff_eq (by decide : Nat.Prime 3) hp).mp hd
      omega
  have rep_prime_gap : ∀ {a b c : ℕ}, a.Prime → b.Prime → c.Prime → 5 ≤ a →
      a < b → b < c → a + 6 ≤ c := by
    intro a b c ha hb hc ha5 hab hbc
    obtain ⟨ha2, ha3⟩ := rep_prime_mod ha ha5
    obtain ⟨hb2, hb3⟩ := rep_prime_mod hb (by omega)
    obtain ⟨hc2, hc3⟩ := rep_prime_mod hc (by omega)
    have hab' : a + 2 ≤ b := by omega
    have hbc' : b + 2 ≤ c := by omega
    by_contra hn
    have eb : b = a + 2 := by omega
    have ec : c = a + 4 := by omega
    rcases (show a % 3 = 1 ∨ a % 3 = 2 by omega) with e | e
    · apply hb3
      rw [eb, Nat.add_mod a 2 3, e] <;> decide
    · apply hc3
      rw [ec, Nat.add_mod a 4 3, e] <;> decide
  have rep_interval_contradiction : ∀ {x h a q r : ℕ},
      h ^ 2 < 24 * x → q + 6 ≤ r → x ≤ a * q → (a + 2) * r ≤ x + h → x ≤ a * r →
      False := by
    intro x h a q r hh hqr hlo hhi har
    have hgap : 6 * a + 2 * r ≤ h := by
      nlinarith only [hlo, hhi, Nat.mul_le_mul (le_refl a) hqr]
    have hsq : (6 * a + 2 * r) ^ 2 ≤ h ^ 2 := by
      simpa only [pow_two] using Nat.mul_le_mul hgap hgap
    have hz : (48 : ℤ) * ((a : ℤ) * (r : ℤ)) ≤
        (6 * (a : ℤ) + 2 * (r : ℤ)) ^ 2 := by
      nlinarith only [sq_nonneg (6 * (a : ℤ) - 2 * (r : ℤ))]
    have hbound : 48 * (a * r) ≤ (6 * a + 2 * r) ^ 2 := by
      exact_mod_cast hz
    omega
  have rep_large_divisor_unique : ∀ {x h a b p : ℕ},
      (x ≤ a ∧ a ≤ x + h) → (x ≤ b ∧ b ≤ x + h) →
      h < p → p ∣ a → p ∣ b → a = b := by
    intro x h a b p ha hb hp hda hdb
    obtain ⟨ha₁, ha₂⟩ := ha
    obtain ⟨hb₁, hb₂⟩ := hb
    obtain ⟨c, rfl⟩ := hda
    obtain ⟨d, rfl⟩ := hdb
    rcases lt_trichotomy c d with hcd | hcd | hcd
    · have H : p * c + p ≤ p * d := by
        simpa only [Nat.mul_add, Nat.mul_one] using
          Nat.mul_le_mul (le_refl p) (show c + 1 ≤ d from hcd)
      omega
    · rw [hcd]
    · have H : p * d + p ≤ p * c := by
        simpa only [Nat.mul_add, Nat.mul_one] using
          Nat.mul_le_mul (le_refl p) (show d + 1 ≤ c from hcd)
      omega
  have rep_dvd_sq : ∀ p : ℕ, p ∣ p ^ 2 := by
    intro p
    rw [pow_two]
    exact dvd_mul_right p p
  have rep_two_mem : ∀ {T : Finset ℕ}, 1 < T.card → ∃ a ∈ T, ∃ b ∈ T, a ≠ b := by
    intro T hT
    obtain ⟨a, ha⟩ := Finset.card_pos.mp (show 0 < T.card by omega)
    have hpos : 0 < (T.erase a).card := by
      rw [Finset.card_erase_of_mem ha]
      omega
    obtain ⟨b, hb⟩ := Finset.card_pos.mp hpos
    obtain ⟨hne, hbT⟩ := Finset.mem_erase.mp hb
    exact ⟨a, ha, b, hbT, Ne.symm hne⟩
  have core : ∀ S : Finset ℕ, (∀ s ∈ S, x ≤ s ∧ s ≤ x + h) →
      (∀ s ∈ S, ∃ u v : ℕ, u.Prime ∧ v.Prime ∧ s = u * v) →
      (∀ s ∈ S, ∀ p : ℕ, p.Prime → p ∣ s → p ≤ h) →
      (∀ s ∈ S, ∀ p : ℕ, p.Prime → p ∣ s → ∃ t ∈ S, t ≠ s ∧ p ∣ t) →
      (S.biUnion Nat.primeFactors).card < S.card →
      ∃ p : ℕ, p.Prime ∧ (p + 2).Prime ∧
        p ^ 2 ∈ S ∧ p * (p + 2) ∈ S ∧ (p + 2) ^ 2 ∈ S := by
    intro S Gmem Gsemi Gsmall Gshared hlt
    have ge5 : ∀ {s p : ℕ}, s ∈ S → p.Prime → p ∣ s → 5 ≤ p := by
      intro s p hs hp hd
      obtain ⟨u, v, hu, hv, huv⟩ := Gsemi s hs
      obtain ⟨r, hr, hsr⟩ := rep_other_factor hu hv huv hp hd
      have hrh : r ≤ h := Gsmall s hs r hr (hsr.symm ▸ dvd_mul_left r p)
      have hlo := (Gmem s hs).1
      have h3x : 3 * h < x := by
        by_contra hn
        have hc : x ≤ 3 * h := le_of_not_gt hn
        nlinarith only [hh, Nat.mul_le_mul hc hc, Nat.mul_le_mul hx (le_refl x)]
      by_contra hn
      have hp4 : p ≠ 4 := by
        intro e
        exact (by decide : ¬ Nat.Prime 4) (e ▸ hp)
      have hp3 : p ≤ 3 := by omega
      have hs3 : s ≤ 3 * h := hsr ▸ Nat.mul_le_mul hp3 hrh
      omega
    have factor : ∀ {s p : ℕ}, s ∈ S → p.Prime → p ∣ s →
        ∃ r, r.Prime ∧ s = p * r ∧ 5 ≤ r := by
      intro s p hs hp hd
      obtain ⟨u, v, hu, hv, huv⟩ := Gsemi s hs
      obtain ⟨r, hr, hsr⟩ := rep_other_factor hu hv huv hp hd
      exact ⟨r, hr, hsr, ge5 hs hr (hsr.symm ▸ dvd_mul_left r p)⟩
    have no_three : ∀ {p q₁ q₂ q₃ : ℕ}, p.Prime → q₁.Prime → q₂.Prime → q₃.Prime →
        q₁ < q₂ → q₂ < q₃ → p * q₁ ∈ S → p * q₂ ∈ S → p * q₃ ∈ S → False := by
      intro p q₁ q₂ q₃ hp hq₁ hq₂ hq₃ h₁₂ h₂₃ hs₁ hs₂ hs₃
      have hp5 := ge5 hs₁ hp (dvd_mul_right p q₁)
      have hq₁5 := ge5 hs₁ hq₁ (dvd_mul_left q₁ p)
      have hpodd := (rep_prime_mod hp hp5).1
      have h₁₃ := rep_prime_gap hq₁ hq₂ hq₃ hq₁5 h₁₂ h₂₃
      obtain ⟨b₁l, b₁u⟩ := Gmem _ hs₁
      obtain ⟨b₃l, b₃u⟩ := Gmem _ hs₃
      have h6p : 6 * p ≤ h := by
        nlinarith only [b₁l, b₃u, Nat.mul_le_mul (le_refl p) h₁₃]
      have hneighbor : ∀ q, q.Prime → p * q ∈ S →
          ∃ r, r.Prime ∧ q * r ∈ S ∧ 5 ≤ r ∧ (p = r + 2 ∨ r = p + 2) := by
        intro q hq hqs
        obtain ⟨bql, bqu⟩ := Gmem _ hqs
        have h4q : h < 4 * q := by
          by_contra hn
          have H := Nat.mul_le_mul h6p (le_of_not_gt hn)
          nlinarith only [H, hh, bql]
        obtain ⟨t, ht, htne, hqt⟩ := Gshared _ hqs q hq (dvd_mul_left q p)
        obtain ⟨r, hr, htr, hr5⟩ := factor ht hq hqt
        subst t
        obtain ⟨btl, btu⟩ := Gmem _ ht
        have hrne : r ≠ p := by
          intro e
          apply htne
          rw [e, Nat.mul_comm q p]
        have hpr : p < r + 4 := by
          by_contra hn
          have H := Nat.mul_le_mul (le_refl q) (le_of_not_gt hn)
          nlinarith only [H, btl, bqu, h4q]
        have hrp : r < p + 4 := by
          by_contra hn
          have H := Nat.mul_le_mul (le_refl q) (le_of_not_gt hn)
          nlinarith only [H, bql, btu, h4q]
        have hrodd := (rep_prime_mod hr hr5).1
        exact ⟨r, hr, ht, hr5, by omega⟩
      obtain ⟨r₁, hr₁, hs₁', hr₁5, hd₁⟩ := hneighbor q₁ hq₁ hs₁
      obtain ⟨r₃, hr₃, hs₃', hr₃5, hd₃⟩ := hneighbor q₃ hq₃ hs₃
      have he : r₁ = r₃ := by
        rcases hd₁ with hd₁ | hd₁ <;> rcases hd₃ with hd₃ | hd₃
        · omega
        · have H := rep_prime_gap hr₁ hp hr₃ hr₁5
              (show r₁ < p by omega) (show p < r₃ by omega)
          omega
        · have H := rep_prime_gap hr₃ hp hr₁ hr₃5
              (show r₃ < p by omega) (show p < r₁ by omega)
          omega
        · omega
      rw [← he] at hs₃'
      obtain ⟨c₁l, c₁u⟩ := Gmem _ hs₁'
      obtain ⟨c₃l, c₃u⟩ := Gmem _ hs₃'
      rcases hd₁ with e | e
      · refine rep_interval_contradiction (a := r₁) (q := q₁) (r := q₃)
          hh h₁₃ ?_ ?_ ?_
        · rw [Nat.mul_comm r₁ q₁]
          exact c₁l
        · rw [← e]
          exact b₃u
        · rw [Nat.mul_comm r₁ q₃]
          exact c₃l
      · refine rep_interval_contradiction (a := p) (q := q₁) (r := q₃)
          hh h₁₃ b₁l ?_ b₃l
        rw [← e, Nat.mul_comm r₁ q₃]
        exact c₃u
    have card_filter_le_two : ∀ {p : ℕ}, p.Prime →
        (S.filter (fun s => p ∣ s)).card ≤ 2 := by
      intro p hp
      by_contra hn
      let T := S.filter (fun s => p ∣ s)
      have hT : 2 < T.card := lt_of_not_ge hn
      obtain ⟨a, ha⟩ := Finset.card_pos.mp (show 0 < T.card by omega)
      have hTa : 1 < (T.erase a).card := by
        rw [Finset.card_erase_of_mem ha]
        omega
      obtain ⟨b, hb, c, hc, hbc⟩ := rep_two_mem hTa
      obtain ⟨hba, hbT⟩ := Finset.mem_erase.mp hb
      obtain ⟨hca, hcT⟩ := Finset.mem_erase.mp hc
      obtain ⟨haS, hpa⟩ := Finset.mem_filter.mp (show a ∈ S.filter (fun s => p ∣ s) from ha)
      obtain ⟨hbS, hpb⟩ := Finset.mem_filter.mp (show b ∈ S.filter (fun s => p ∣ s) from hbT)
      obtain ⟨hcS, hpc⟩ := Finset.mem_filter.mp (show c ∈ S.filter (fun s => p ∣ s) from hcT)
      obtain ⟨u, hu, rfl, _⟩ := factor haS hp hpa
      obtain ⟨v, hv, rfl, _⟩ := factor hbS hp hpb
      obtain ⟨w, hw, rfl, _⟩ := factor hcS hp hpc
      have huv : u ≠ v := fun e => hba (congrArg (fun k => p * k) e.symm)
      have huw : u ≠ w := fun e => hca (congrArg (fun k => p * k) e.symm)
      have hvw : v ≠ w := fun e => hbc (congrArg (fun k => p * k) e)
      rcases lt_or_gt_of_ne huv with h₁ | h₁ <;>
        rcases lt_or_gt_of_ne huw with h₂ | h₂ <;>
        rcases lt_or_gt_of_ne hvw with h₃ | h₃
      · exact no_three hp hu hv hw h₁ h₃ haS hbS hcS
      · exact no_three hp hu hw hv h₂ h₃ haS hcS hbS
      · omega
      · exact no_three hp hw hu hv h₂ h₁ hcS haS hbS
      · exact no_three hp hv hu hw h₁ h₂ hbS haS hcS
      · omega
      · exact no_three hp hv hw hu h₃ h₂ hbS hcS haS
      · exact no_three hp hw hv hu h₃ h₁ hcS hbS haS
    have triple_of_squares : ∀ {p q : ℕ}, p.Prime → q.Prime → p < q →
        p ^ 2 ∈ S → q ^ 2 ∈ S →
        ∃ p : ℕ, p.Prime ∧ (p + 2).Prime ∧
          p ^ 2 ∈ S ∧ p * (p + 2) ∈ S ∧ (p + 2) ^ 2 ∈ S := by
      intro p q hp hq hpq hpS hqS
      have hp5 := ge5 hpS hp (rep_dvd_sq p)
      have hpodd := (rep_prime_mod hp hp5).1
      have hqodd := (rep_prime_mod hq (by omega)).1
      obtain ⟨bpl, bpu⟩ := Gmem _ hpS
      obtain ⟨bql, bqu⟩ := Gmem _ hqS
      have h6 : h < 6 * p := by
        by_contra hn
        have hc : 6 * p ≤ h := le_of_not_gt hn
        nlinarith only [hh, bpl, Nat.mul_le_mul hc hc, Nat.zero_le x]
      have eq : q = p + 2 := by
        by_contra hn
        have h4 : p + 4 ≤ q := by omega
        nlinarith only [Nat.mul_le_mul h4 h4, bpl, bqu, h6, Nat.zero_le p]
      subst q
      obtain ⟨t, ht, htne, hpt⟩ := Gshared _ hpS p hp (rep_dvd_sq p)
      obtain ⟨r, hr, htr, hr5⟩ := factor ht hp hpt
      subst t
      have hrodd := (rep_prime_mod hr hr5).1
      obtain ⟨btl, btu⟩ := Gmem _ ht
      have hrne : r ≠ p := by
        intro e
        apply htne
        rw [e, pow_two]
      rcases lt_or_gt_of_ne hrne with hlt | hlt
      · exfalso
        have H : r + 2 ≤ p := by omega
        nlinarith only [Nat.mul_le_mul (le_refl p) H, btl, bqu, h6]
      · by_cases e : r = p + 2
        · exact ⟨p, hp, hq, hpS, e ▸ ht, hqS⟩
        · exfalso
          have H := rep_prime_gap hp hq hr hp5 (show p < p + 2 by omega)
            (show p + 2 < r by omega)
          nlinarith only [Nat.mul_le_mul (le_refl p) H, bpl, btu, h6]
    let P := S.biUnion Nat.primeFactors
    have hne0 : ∀ s ∈ S, s ≠ 0 := by
      intro s hs
      have hlo := (Gmem s hs).1
      omega
    have hprime : ∀ p ∈ P, p.Prime := by
      intro p hp
      obtain ⟨s, _, hps⟩ := Finset.mem_biUnion.mp (show p ∈ S.biUnion Nat.primeFactors from hp)
      exact (Nat.mem_primeFactors.mp hps).1
    have hfilter : ∀ s ∈ S, P.filter (fun p => p ∣ s) = s.primeFactors := by
      intro s hs
      ext p
      rw [Finset.mem_filter]
      constructor
      · rintro ⟨hp, hd⟩
        exact Nat.mem_primeFactors.mpr ⟨hprime p hp, hd, hne0 s hs⟩
      · intro hp
        exact ⟨Finset.mem_biUnion.mpr ⟨s, hs, hp⟩, (Nat.mem_primeFactors.mp hp).2.1⟩
    have hcount : ∑ s ∈ S, (P.filter (fun p => p ∣ s)).card =
        ∑ p ∈ P, (S.filter (fun s => p ∣ s)).card := by
      simp only [Finset.card_filter]
      exact Finset.sum_comm
    have hupper : ∑ s ∈ S, s.primeFactors.card ≤ 2 * P.card := by
      calc
        ∑ s ∈ S, s.primeFactors.card = ∑ s ∈ S, (P.filter (fun p => p ∣ s)).card :=
          Finset.sum_congr rfl (fun s hs => (congrArg Finset.card (hfilter s hs)).symm)
        _ = ∑ p ∈ P, (S.filter (fun s => p ∣ s)).card := hcount
        _ ≤ ∑ _p ∈ P, 2 := Finset.sum_le_sum (fun p hp => card_filter_le_two (hprime p hp))
        _ = 2 * P.card := by simp [Finset.sum_const, Nat.mul_comm]
    let Q := S.filter (fun s => s.primeFactors.card = 1)
    have hlower : 2 * S.card ≤ (∑ s ∈ S, s.primeFactors.card) + Q.card := by
      have hpoint : ∀ s ∈ S,
          2 ≤ s.primeFactors.card + (if s.primeFactors.card = 1 then 1 else 0) := by
        intro s hs
        obtain ⟨u, v, hu, hv, huv⟩ := Gsemi s hs
        have hpos : 0 < s.primeFactors.card :=
          Finset.card_pos.mpr ⟨u, Nat.mem_primeFactors.mpr
            ⟨hu, by rw [huv]; exact dvd_mul_right u v, hne0 s hs⟩⟩
        split_ifs <;> omega
      calc
        2 * S.card = ∑ _s ∈ S, 2 := by simp [Finset.sum_const, Nat.mul_comm]
        _ ≤ ∑ s ∈ S, (s.primeFactors.card + (if s.primeFactors.card = 1 then 1 else 0)) :=
          Finset.sum_le_sum hpoint
        _ = (∑ s ∈ S, s.primeFactors.card) + Q.card := by
          rw [Finset.sum_add_distrib]
          simp only [Q, Finset.card_filter]
    have hsquare : ∀ s ∈ S, s.primeFactors.card = 1 → ∃ p, p.Prime ∧ s = p ^ 2 := by
      intro s hs hc
      obtain ⟨u, v, hu, hv, huv⟩ := Gsemi s hs
      obtain ⟨w, hw⟩ := Finset.card_eq_one.mp hc
      have hu' : u ∈ s.primeFactors :=
        Nat.mem_primeFactors.mpr ⟨hu, by rw [huv]; exact dvd_mul_right u v, hne0 s hs⟩
      have hv' : v ∈ s.primeFactors :=
        Nat.mem_primeFactors.mpr ⟨hv, by rw [huv]; exact dvd_mul_left v u, hne0 s hs⟩
      rw [hw, Finset.mem_singleton] at hu' hv'
      have e : v = u := hv'.trans hu'.symm
      exact ⟨u, hu, by rw [huv, e, pow_two]⟩
    have hPS : P.card < S.card := hlt
    have hQ : 1 < Q.card := by omega
    obtain ⟨a, ha, b, hb, hab⟩ := rep_two_mem hQ
    have ha' := Finset.mem_filter.mp
      (show a ∈ S.filter (fun s => s.primeFactors.card = 1) from ha)
    have hb' := Finset.mem_filter.mp
      (show b ∈ S.filter (fun s => s.primeFactors.card = 1) from hb)
    obtain ⟨p, hp, rfl⟩ := hsquare a ha'.1 ha'.2
    obtain ⟨q, hq, rfl⟩ := hsquare b hb'.1 hb'.2
    have hpq : p ≠ q := fun e => hab (congrArg (fun k : ℕ => k ^ 2) e)
    rcases lt_or_gt_of_ne hpq with hlt | hlt
    · exact triple_of_squares hp hq hlt ha'.1 hb'.1
    · exact triple_of_squares hq hp hlt hb'.1 ha'.1
  unfold HasPrimeRepSystem ContainsTwinPrimeTriple
  constructor
  · rintro ⟨f, hinj, hf⟩ ⟨p, hp, hq, h₁, h₂, h₃⟩
    obtain ⟨hf₁, hd₁⟩ := hf _ h₁
    obtain ⟨hf₂, hd₂⟩ := hf _ h₂
    obtain ⟨hf₃, hd₃⟩ := hf _ h₃
    have e₁ : f (p ^ 2) = p :=
      (rep_prime_factor hp hp (pow_two p) hf₁ hd₁).elim id id
    have e₃ : f ((p + 2) ^ 2) = p + 2 :=
      (rep_prime_factor hq hq (pow_two (p + 2)) hf₃ hd₃).elim id id
    rcases rep_prime_factor hp hq rfl hf₂ hd₂ with e₂ | e₂
    · have e : p * (p + 2) = p ^ 2 :=
        hinj (Finset.mem_coe.mpr h₂) (Finset.mem_coe.mpr h₁) (e₂.trans e₁.symm)
      nlinarith only [e, hp.two_le]
    · have e : p * (p + 2) = (p + 2) ^ 2 :=
        hinj (Finset.mem_coe.mpr h₂) (Finset.mem_coe.mpr h₃) (e₂.trans e₃.symm)
      nlinarith only [e, hp.two_le]
  · intro hno
    have hmem : ∀ a ∈ A, x ≤ a ∧ a ≤ x + h :=
      fun a ha => Finset.mem_Icc.mp (hA ha)
    have hne0 : ∀ a ∈ A, a ≠ 0 := by
      intro a ha
      have hlo := (hmem a ha).1
      omega
    let B := A.filter (fun a => ∀ p ∈ a.primeFactors, p ≤ h)
    have hBA : B ⊆ A := Finset.filter_subset _ _
    have hsmall : ∀ a ∈ B, ∀ p : ℕ, p.Prime → p ∣ a → p ≤ h := by
      intro a ha p hp hd
      have ha' : a ∈ A ∧ ∀ q ∈ a.primeFactors, q ≤ h := by
        simpa only [B, Finset.mem_filter] using ha
      exact ha'.2 p (Nat.mem_primeFactors.mpr ⟨hp, hd, hne0 a ha'.1⟩)
    have hlarge : ∀ a ∈ A, a ∉ B → ∃ p, p.Prime ∧ p ∣ a ∧ h < p := by
      intro a ha hn
      by_contra hc
      apply hn
      simp only [B, Finset.mem_filter]
      refine ⟨ha, fun p hp => ?_⟩
      by_contra hle
      have hm := Nat.mem_primeFactors.mp hp
      exact hc ⟨p, hm.1, hm.2.1, lt_of_not_ge hle⟩
    have hsemi : ∀ a ∈ B, ∃ u v : ℕ, u.Prime ∧ v.Prime ∧ a = u * v := by
      intro a ha
      rcases hcond a (hBA ha) with hs | ⟨p, hp, hd, hlt⟩
      · exact hs
      · exact ((not_lt_of_ge (hsmall a ha p hp hd)) hlt).elim
    have hHall : ∀ n, ∀ S : Finset ℕ, S.card = n → S ⊆ B →
        S.card ≤ (S.biUnion Nat.primeFactors).card := by
      intro n
      induction n using Nat.strong_induction_on with
      | _ n ih =>
        intro S hSn hSB
        by_contra hn
        have hlt : (S.biUnion Nat.primeFactors).card < S.card := lt_of_not_ge hn
        have hSA : S ⊆ A := hSB.trans hBA
        by_cases hex : ∃ s ∈ S, ∃ p : ℕ,
            p.Prime ∧ p ∣ s ∧ ∀ t ∈ S, t ≠ s → ¬ p ∣ t
        · obtain ⟨s, hs, p, hp, hps, hpriv⟩ := hex
          have hspos := Finset.card_pos.mpr ⟨s, hs⟩
          have hlt' : (S.erase s).card < n := by
            rw [Finset.card_erase_of_mem hs]
            omega
          have hrec := ih _ hlt' (S.erase s) rfl ((Finset.erase_subset s S).trans hSB)
          have hpP : p ∈ S.biUnion Nat.primeFactors :=
            Finset.mem_biUnion.mpr ⟨s, hs, Nat.mem_primeFactors.mpr ⟨hp, hps, hne0 s (hSA hs)⟩⟩
          have hPpos := Finset.card_pos.mpr ⟨p, hpP⟩
          have hsub : (S.erase s).biUnion Nat.primeFactors ⊆
              (S.biUnion Nat.primeFactors).erase p := by
            intro q hq
            obtain ⟨t, ht, hqt⟩ := Finset.mem_biUnion.mp hq
            obtain ⟨hts, htS⟩ := Finset.mem_erase.mp ht
            refine Finset.mem_erase.mpr ⟨?_, Finset.mem_biUnion.mpr ⟨t, htS, hqt⟩⟩
            intro e
            apply hpriv t htS hts
            exact e ▸ (Nat.mem_primeFactors.mp hqt).2.1
          have hcard := Finset.card_le_card hsub
          rw [Finset.card_erase_of_mem hpP] at hcard
          rw [Finset.card_erase_of_mem hs] at hrec
          omega
        · have hshared : ∀ s ∈ S, ∀ p : ℕ, p.Prime → p ∣ s →
              ∃ t ∈ S, t ≠ s ∧ p ∣ t := by
            intro s hs p hp hd
            by_contra hc
            exact hex ⟨s, hs, p, hp, hd, fun t ht hts htd => hc ⟨t, ht, hts, htd⟩⟩
          obtain ⟨p, hp, hq, hpS, hpqS, hqS⟩ := core S
            (fun s hs => hmem s (hSA hs)) (fun s hs => hsemi s (hSB hs))
            (fun s hs => hsmall s (hSB hs)) hshared hlt
          exact hno ⟨p, hp, hq, hSA hpS, hSA hpqS, hSA hqS⟩
    have hHall' : ∀ s : Finset {a // a ∈ B},
        s.card ≤ (s.biUnion (fun b : {a // a ∈ B} => b.1.primeFactors)).card := by
      intro s
      have hc := hHall _ (s.image Subtype.val) rfl (by
        intro a ha
        obtain ⟨b, _, rfl⟩ := Finset.mem_image.mp ha
        exact b.2)
      rw [Finset.card_image_of_injective _ Subtype.val_injective] at hc
      refine hc.trans (Finset.card_le_card ?_)
      intro p hp
      obtain ⟨a, ha, hpa⟩ := Finset.mem_biUnion.mp hp
      obtain ⟨b, hb, rfl⟩ := Finset.mem_image.mp ha
      exact Finset.mem_biUnion.mpr ⟨b, hb, hpa⟩
    obtain ⟨φ, hφinj, hφmem⟩ := (Finset.all_card_le_biUnion_card_iff_exists_injective
      (fun b : {a // a ∈ B} => b.1.primeFactors)).mp hHall'
    have hex : ∀ a, ∃ p : ℕ, (∀ hb : a ∈ B, p = φ ⟨a, hb⟩) ∧
        (a ∈ A → a ∉ B → p.Prime ∧ p ∣ a ∧ h < p) := by
      intro a
      by_cases hb : a ∈ B
      · exact ⟨φ ⟨a, hb⟩, fun _ => rfl, fun _ hn => (hn hb).elim⟩
      · by_cases ha : a ∈ A
        · obtain ⟨p, hp⟩ := hlarge a ha hb
          exact ⟨p, fun hb' => (hb hb').elim, fun _ _ => hp⟩
        · exact ⟨0, fun hb' => (hb hb').elim, fun ha' _ => (ha ha').elim⟩
    let f : ℕ → ℕ := fun a => Classical.choose (hex a)
    have hf₁ : ∀ a (hb : a ∈ B), f a = φ ⟨a, hb⟩ :=
      fun a hb => (Classical.choose_spec (hex a)).1 hb
    have hf₂ : ∀ a, a ∈ A → a ∉ B → (f a).Prime ∧ f a ∣ a ∧ h < f a :=
      fun a ha hb => (Classical.choose_spec (hex a)).2 ha hb
    have hfB : ∀ a (hb : a ∈ B), (f a).Prime ∧ f a ∣ a ∧ f a ≤ h := by
      intro a hb
      have hm : f a ∈ a.primeFactors := by
        rw [hf₁ a hb]
        exact hφmem ⟨a, hb⟩
      have hp := Nat.mem_primeFactors.mp hm
      exact ⟨hp.1, hp.2.1, hsmall a hb _ hp.1 hp.2.1⟩
    refine ⟨f, ?_, ?_⟩
    · intro a ha b hb hab
      have ha' : a ∈ A := Finset.mem_coe.mp ha
      have hb' : b ∈ A := Finset.mem_coe.mp hb
      by_cases hBa : a ∈ B <;> by_cases hBb : b ∈ B
      · rw [hf₁ a hBa, hf₁ b hBb] at hab
        exact congrArg Subtype.val (hφinj hab)
      · have hlo := (hfB a hBa).2.2
        have hhi := (hf₂ b hb' hBb).2.2
        omega
      · have hlo := (hfB b hBb).2.2
        have hhi := (hf₂ a ha' hBa).2.2
        omega
      · obtain ⟨_, hda, hpa⟩ := hf₂ a ha' hBa
        obtain ⟨_, hdb, _⟩ := hf₂ b hb' hBb
        rw [hab] at hda hpa
        exact rep_large_divisor_unique (hmem a ha') (hmem b hb') hpa hda hdb
    · intro a ha
      by_cases hb : a ∈ B
      · exact ⟨(hfB a hb).1, (hfB a hb).2.1⟩
      · exact ⟨(hf₂ a ha hb).1, (hf₂ a ha hb).2.1⟩

#print axioms prime_rep_system_iff_no_twin_prime_triple

AI 和人各做了什么

AI:Claude Opus 5.5 / gpt-6.2-sol / gpt-6.2-astra 在自动流程里提出结论和证明;Claude Sonnet 自查,gpt-6.2-sol 两轮严审(high、xhigh),Claude Opus 独立复审并联网查新。人:项目负责人设定目标、搭建流程,对内容负责;没有人工审稿。

发布日期:2026-11-30