/-
Copyright 2025 The Formal Conjectures Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-/
import FormalConjecturesUtilErdős Problem 56
Reference: erdosproblems.com/56
open scoped Finsetnamespace Erdos56
Say a set of natural numbers is k-weakly divisible if any k+1 elements
of A are not relatively prime.
def WeaklyDivisible (k : ℕ) (A : Finset ℕ) : Prop :=
∀ s ∈ A.powersetCard (k + 1), ¬ Set.Pairwise s Nat.Coprime@[category API, AMS 11]
lemma weaklyDivisible_empty (k : ℕ): WeaklyDivisible k {} := k:ℕ⊢ WeaklyDivisible k ∅
All goals completed! 🐙
A singleton is k-weakly divisible if k ≠ 0.
@[category API, AMS 11]
lemma weaklyDivisible_singleton {k : ℕ} (hk : k ≠ 0) (l : ℕ) : WeaklyDivisible k {l} := k:ℕhk:k ≠ 0l:ℕ⊢ WeaklyDivisible k {l}
All goals completed! 🐙
No non-empty set is 1-weakly divisible.
@[category API, AMS 11]
lemma not_weaklyDivisible_zero {A : _} (h : A.Nonempty) : ¬WeaklyDivisible 0 A := A:Finset ℕh:A.Nonempty⊢ ¬WeaklyDivisible 0 A
simpa [WeaklyDivisible] using ⟨{_}, A:Finset ℕh:A.Nonempty⊢ {?m.20} ⊆ A ∧ #{?m.20} = 1 ∧ (↑{?m.20}).Pairwise Nat.Coprime All goals completed! 🐙⟩@[category API, AMS 11]
lemma empty_iff_weaklyDivisible_zero {A : _} : WeaklyDivisible 0 A ↔ A = ∅ :=
⟨fun h ↦ Finset.not_nonempty_iff_eq_empty.1 <| mt not_weaklyDivisible_zero (not_not.2 h),
fun h ↦ h ▸ weaklyDivisible_empty _⟩
MaxWeaklyDivisible N k is the size of the largest k-weakly divisible subset of {1,..., N}
noncomputable def MaxWeaklyDivisible (N : ℕ) (k : ℕ) : ℕ :=
sSup {#A | (A : Finset ℕ) (_ : A ⊆ Finset.Icc 1 N) (_ : WeaklyDivisible k A)}@[category test, AMS 11]
theorem maxWeaklyDivisible_zero : ∀ k : ℕ, MaxWeaklyDivisible 0 k = 0 := ⊢ ∀ (k : ℕ), MaxWeaklyDivisible 0 k = 0
k:ℕ⊢ MaxWeaklyDivisible 0 k = 0
All goals completed! 🐙k:ℕhk:k ≠ 0this:{x | ∃ A, WeaklyDivisible k A ∧ (A = ∅ ∨ A = {1}) ∧ #A = x} = {0, 1}⊢ MaxWeaklyDivisible 1 k = 1
simp_all [MaxWeaklyDivisible] All goals completed! 🐙@[category test, AMS 11]
theorem maxWeaklyDivisible_zero_k (N : ℕ) : MaxWeaklyDivisible N 0 = 0 := by N:ℕ⊢ MaxWeaklyDivisible N 0 = 0
simp [empty_iff_weaklyDivisible_zero, MaxWeaklyDivisible] All goals completed! 🐙
FirstPrimesMultiples N k is the set of numbers in {1,..., N} that are
a multiple of one of the first k primes.
noncomputable def FirstPrimesMultiples (N k : ℕ) : Finset ℕ :=
(Finset.Icc 1 N).filter fun i => ∃ j < k, (j.nth Nat.Prime ∣ i)
@[category test, AMS 11]
theorem firstPrimesMultiples_one_card_zero (k : ℕ) : (FirstPrimesMultiples 1 k).card = 0 := by k:ℕ⊢ #(FirstPrimesMultiples 1 k) = 0
simp [FirstPrimesMultiples, Finset.filter_singleton] k:ℕ⊢ ∀ x < k, ¬Nat.nth Nat.Prime x = 1
intro n h k:ℕn:ℕh:n < k⊢ ¬Nat.nth Nat.Prime n = 1
by_contra hprime k:ℕn:ℕh:n < khprime:Nat.nth Nat.Prime n = 1⊢ False
have : Nat.Prime 1 := by k:ℕ⊢ #(FirstPrimesMultiples 1 k) = 0 k:ℕn:ℕh:n < khprime:Nat.nth Nat.Prime n = 1this:Nat.Prime 1⊢ False
convert Nat.prime_nth_prime n k:ℕn:ℕh:n < khprime:Nat.nth Nat.Prime n = 1⊢ 1 = Nat.nth Nat.Prime n k:ℕn:ℕh:n < khprime:Nat.nth Nat.Prime n = 1this:Nat.Prime 1⊢ False
exact hprime.symm k:ℕn:ℕh:n < khprime:Nat.nth Nat.Prime n = 1this:Nat.Prime 1⊢ False k:ℕn:ℕh:n < khprime:Nat.nth Nat.Prime n = 1this:Nat.Prime 1⊢ False
tauto All goals completed! 🐙@[category test, AMS 11]
theorem firstPrimesMultiples_zero_k_card_zero (N : ℕ) : (FirstPrimesMultiples N 0).card = 0 := by N:ℕ⊢ #(FirstPrimesMultiples N 0) = 0
simp [FirstPrimesMultiples] All goals completed! 🐙
An example of a k-weakly divisible set is the subset of {1, ..., N}
containing the multiples of the first k primes.
@[category API, AMS 11]
lemma weaklyDivisible_firstPrimesMultiples (N k : ℕ) :
WeaklyDivisible k (FirstPrimesMultiples N k) := by N:ℕk:ℕ⊢ WeaklyDivisible k (FirstPrimesMultiples N k)
unfold WeaklyDivisible N:ℕk:ℕ⊢ ∀ s ∈ Finset.powersetCard (k + 1) (FirstPrimesMultiples N k), ¬(↑s).Pairwise Nat.Coprime
intro s hs N:ℕk:ℕs:Finset ℕhs:s ∈ Finset.powersetCard (k + 1) (FirstPrimesMultiples N k)⊢ ¬(↑s).Pairwise Nat.Coprime
rw [Finset.mem_powersetCard N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1⊢ ¬(↑s).Pairwise Nat.Coprime N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1⊢ ¬(↑s).Pairwise Nat.Coprime] at hs N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1⊢ ¬(↑s).Pairwise Nat.Coprime
-- Define the map from s to Fin k
set f : s → Fin k := fun ⟨x, hx⟩ =>
have h_exists := (Finset.mem_filter.mp (hs.1 hx)).2
⟨Classical.choose h_exists, (Classical.choose_spec h_exists).1⟩ N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩⊢ ¬(↑s).Pairwise Nat.Coprime
have hcard_s : Fintype.card s = k + 1 := by N:ℕk:ℕ⊢ WeaklyDivisible k (FirstPrimesMultiples N k) N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1⊢ ¬(↑s).Pairwise Nat.Coprime simp [hs.2] N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1⊢ ¬(↑s).Pairwise Nat.Coprime N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1⊢ ¬(↑s).Pairwise Nat.Coprime
have hcard_fink : Fintype.card (Fin k) = k := Fintype.card_fin k N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = k⊢ ¬(↑s).Pairwise Nat.Coprime
obtain ⟨x, y, hne, heq⟩ := Fintype.exists_ne_map_eq_of_card_lt f (by N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = k⊢ Fintype.card (Fin k) < Fintype.card ↥s N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f y⊢ ¬(↑s).Pairwise Nat.Coprime omega All goals completed! 🐙 N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f y⊢ ¬(↑s).Pairwise Nat.Coprime) N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f y⊢ ¬(↑s).Pairwise Nat.Coprime
intro h_pair N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprime⊢ False
have hne_val : x.1 ≠ y.1 := by N:ℕk:ℕ⊢ WeaklyDivisible k (FirstPrimesMultiples N k) N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑y⊢ False
intro h_eq N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimeh_eq:↑x = ↑y⊢ False N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑y⊢ False
exact hne (Subtype.ext h_eq) N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑y⊢ False N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑y⊢ False
have h_coprime := h_pair x.2 y.2 hne_val N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑y⊢ False
set p := (f x).val.nth Nat.Prime N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)⊢ False
have hp_prime : p.Prime := Nat.prime_nth_prime _ N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime p⊢ False
have hp_div_x : p ∣ x.1 := by N:ℕk:ℕ⊢ WeaklyDivisible k (FirstPrimesMultiples N k) N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑x⊢ False
have h_exists := (Finset.mem_filter.mp (hs.1 x.2)).2 N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime ph_exists:∃ j < k, Nat.nth Nat.Prime j ∣ ↑x⊢ p ∣ ↑x N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑x⊢ False
exact (Classical.choose_spec h_exists).2 N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑x⊢ False N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑x⊢ False
have hp_div_y : p ∣ y.1 := by N:ℕk:ℕ⊢ WeaklyDivisible k (FirstPrimesMultiples N k) N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑y⊢ False
have h_exists := (Finset.mem_filter.mp (hs.1 y.2)).2 N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xh_exists:∃ j < k, Nat.nth Nat.Prime j ∣ ↑y⊢ p ∣ ↑y N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑y⊢ False
have h_eq_f : (f x).val = (f y).val := by N:ℕk:ℕ⊢ WeaklyDivisible k (FirstPrimesMultiples N k) N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xh_exists:∃ j < k, Nat.nth Nat.Prime j ∣ ↑yh_eq_f:↑(f x) = ↑(f y)⊢ p ∣ ↑y N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑y⊢ False rw [heq N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xh_exists:∃ j < k, Nat.nth Nat.Prime j ∣ ↑y⊢ ↑(f y) = ↑(f y) N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xh_exists:∃ j < k, Nat.nth Nat.Prime j ∣ ↑yh_eq_f:↑(f x) = ↑(f y)⊢ p ∣ ↑y N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑y⊢ False] N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xh_exists:∃ j < k, Nat.nth Nat.Prime j ∣ ↑yh_eq_f:↑(f x) = ↑(f y)⊢ p ∣ ↑y N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑y⊢ False N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xh_exists:∃ j < k, Nat.nth Nat.Prime j ∣ ↑yh_eq_f:↑(f x) = ↑(f y)⊢ p ∣ ↑y N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑y⊢ False
-- (f y).val is Classical.choose h_exists by definition
have : p = (Classical.choose h_exists).nth Nat.Prime := by N:ℕk:ℕ⊢ WeaklyDivisible k (FirstPrimesMultiples N k) N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xh_exists:∃ j < k, Nat.nth Nat.Prime j ∣ ↑yh_eq_f:↑(f x) = ↑(f y)this:p = Nat.nth Nat.Prime (Classical.choose h_exists)⊢ p ∣ ↑y N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑y⊢ False
dsimp [p] N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xh_exists:∃ j < k, Nat.nth Nat.Prime j ∣ ↑yh_eq_f:↑(f x) = ↑(f y)⊢ Nat.nth Nat.Prime ↑(f x) = Nat.nth Nat.Prime (Classical.choose h_exists) N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xh_exists:∃ j < k, Nat.nth Nat.Prime j ∣ ↑yh_eq_f:↑(f x) = ↑(f y)this:p = Nat.nth Nat.Prime (Classical.choose h_exists)⊢ p ∣ ↑y N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑y⊢ False
rw [h_eq_f N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xh_exists:∃ j < k, Nat.nth Nat.Prime j ∣ ↑yh_eq_f:↑(f x) = ↑(f y)⊢ Nat.nth Nat.Prime ↑(f y) = Nat.nth Nat.Prime (Classical.choose h_exists) N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xh_exists:∃ j < k, Nat.nth Nat.Prime j ∣ ↑yh_eq_f:↑(f x) = ↑(f y)this:p = Nat.nth Nat.Prime (Classical.choose h_exists)⊢ p ∣ ↑y N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑y⊢ False] N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xh_exists:∃ j < k, Nat.nth Nat.Prime j ∣ ↑yh_eq_f:↑(f x) = ↑(f y)this:p = Nat.nth Nat.Prime (Classical.choose h_exists)⊢ p ∣ ↑y N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑y⊢ False N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xh_exists:∃ j < k, Nat.nth Nat.Prime j ∣ ↑yh_eq_f:↑(f x) = ↑(f y)this:p = Nat.nth Nat.Prime (Classical.choose h_exists)⊢ p ∣ ↑y N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑y⊢ False
rw [this N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xh_exists:∃ j < k, Nat.nth Nat.Prime j ∣ ↑yh_eq_f:↑(f x) = ↑(f y)this:p = Nat.nth Nat.Prime (Classical.choose h_exists)⊢ Nat.nth Nat.Prime (Classical.choose h_exists) ∣ ↑y N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xh_exists:∃ j < k, Nat.nth Nat.Prime j ∣ ↑yh_eq_f:↑(f x) = ↑(f y)this:p = Nat.nth Nat.Prime (Classical.choose h_exists)⊢ Nat.nth Nat.Prime (Classical.choose h_exists) ∣ ↑y N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑y⊢ False] N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xh_exists:∃ j < k, Nat.nth Nat.Prime j ∣ ↑yh_eq_f:↑(f x) = ↑(f y)this:p = Nat.nth Nat.Prime (Classical.choose h_exists)⊢ Nat.nth Nat.Prime (Classical.choose h_exists) ∣ ↑y N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑y⊢ False
exact (Classical.choose_spec h_exists).2 N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑y⊢ False N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑y⊢ False
have hp_div_gcd : p ∣ x.1.gcd y.1 := Nat.dvd_gcd hp_div_x hp_div_y N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑yhp_div_gcd:p ∣ (↑x).gcd ↑y⊢ False
have h_gcd_eq_one : x.1.gcd y.1 = 1 := h_coprime N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑yhp_div_gcd:p ∣ (↑x).gcd ↑yh_gcd_eq_one:(↑x).gcd ↑y = 1⊢ False
rw [h_gcd_eq_one N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑yhp_div_gcd:p ∣ 1h_gcd_eq_one:(↑x).gcd ↑y = 1⊢ False N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑yhp_div_gcd:p ∣ 1h_gcd_eq_one:(↑x).gcd ↑y = 1⊢ False] at hp_div_gcd N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑yhp_div_gcd:p ∣ 1h_gcd_eq_one:(↑x).gcd ↑y = 1⊢ False
have hp_le_one : p ≤ 1 := Nat.le_of_dvd (by N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑yhp_div_gcd:p ∣ 1h_gcd_eq_one:(↑x).gcd ↑y = 1⊢ 0 < 1 N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑yhp_div_gcd:p ∣ 1h_gcd_eq_one:(↑x).gcd ↑y = 1hp_le_one:p ≤ 1⊢ False norm_num All goals completed! 🐙 N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑yhp_div_gcd:p ∣ 1h_gcd_eq_one:(↑x).gcd ↑y = 1hp_le_one:p ≤ 1⊢ False) hp_div_gcd N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑yhp_div_gcd:p ∣ 1h_gcd_eq_one:(↑x).gcd ↑y = 1hp_le_one:p ≤ 1⊢ False
have : p > 1 := hp_prime.one_lt N:ℕk:ℕs:Finset ℕhs:s ⊆ FirstPrimesMultiples N k ∧ #s = k + 1f:↥s → Fin k :=
fun x ↦
match x with
| ⟨x, hx⟩ =>
have h_exists := ⋯;
⟨Classical.choose h_exists, ⋯⟩hcard_s:Fintype.card ↥s = k + 1hcard_fink:Fintype.card (Fin k) = kx:↥sy:↥shne:x ≠ yheq:f x = f yh_pair:(↑s).Pairwise Nat.Coprimehne_val:↑x ≠ ↑yh_coprime:(↑x).Coprime ↑yp:ℕ := Nat.nth Nat.Prime ↑(f x)hp_prime:Nat.Prime php_div_x:p ∣ ↑xhp_div_y:p ∣ ↑yhp_div_gcd:p ∣ 1h_gcd_eq_one:(↑x).gcd ↑y = 1hp_le_one:p ≤ 1this:p > 1⊢ False
omega All goals completed! 🐙Suppose $A \subseteq {1,\dots,N}$ is such that there are no $k+1$ elements of $A$ which are relatively prime. An example is the set of all multiples of the first $k$ primes. Is this the largest such set? To avoid trivial counterexamples, we must insist that $N$ be at least the $k$th prime.
@[category research solved, AMS 11, formal_proof using lean4 at "https://github.com/plby/lean-proofs/blob/main/src/v4.24.0/ErdosProblems/Erdos56.lean"]
theorem erdos_56 : answer(False) ↔ ∀ᵉ (k > 0) (N ≥ (k-1).nth Nat.Prime),
(MaxWeaklyDivisible N k = (FirstPrimesMultiples N k).card) := by ⊢ False ↔ ∀ k > 0, ∀ N ≥ Nat.nth Nat.Prime (k - 1), MaxWeaklyDivisible N k = #(FirstPrimesMultiples N k)
sorry All goals completed! 🐙end Erdos56