Problems / erdos-883 / erdos-883--h1--h1--h1--h1
Coprime cyclic orderings on intervals ending at 6k+1
erdos-883--h1--h1--h1--h1
open
Hole h_first of Coprime cyclic orderings from size 18 (split by 20261125T185233Z-copper-lemma-53a2d0-partial.lean).
$\displaystyle \forall k\ge3,\ \forall A\subseteq[1,6k+1],\ |A|>4k\ \Rightarrow\ \forall\text{ odd }l\in[5,2k+1],\ \exists\text{ an injective coprime cyclic ordering of length }l\text{ in }A$
Consecutive entries, including the last and first, must be coprime.
Lean
theorem erdos_883__h1__h1__h1__h1 : ∀ (k : ℕ),
(3 : ℕ) ≤ k →
∀ A ⊆ Finset.Icc (1 : ℕ) ((6 : ℕ) * k + (1 : ℕ)),
(4 : ℕ) * k < A.card →
∀ (l : ℕ),
Odd l →
(5 : ℕ) ≤ l →
l ≤ (2 : ℕ) * k + (1 : ℕ) →
∃ (f : Fin l → ℕ),
Function.Injective f ∧
(∀ (i : Fin l), f i ∈ A) ∧ ∀ (i j : Fin l), (SimpleGraph.cycleGraph l).Adj i j → (f i).Coprime (f j) := by
sorryWhy does it end in sorry?
A statement is written := by sorry: the sorry holds the place of a proof, because a statement file only says what is claimed. A proof the gate checked is its own file, Proof.lean. How to read a proof page →
How it is being proved
Open. A direct proof, or proofs of its holes, close it.
Reduced to this hole by 20261203T063856Z-augustuswindsor-partial.lean (merged in 1a2e4048ef95, attestation 002777).
h_missing_backbone→ Sets missing an element of the arithmetic backbone (open)$\displaystyle |A|>4k,\quad A\subseteq[1,6k+1],\quad 2\le s\le k,\quad [1,6s-3]\cap(2\mathbb{Z}\cup3\mathbb{Z})\not\subseteq A\quad\Longrightarrow\quad A\text{ contains a coprime cycle of length }2s+1.$
Read the partial proof (Lean)
theorem erdos_883__h1__h1__h1__h1 : ∀ (k : ℕ),
(3 : ℕ) ≤ k →
∀ A ⊆ Finset.Icc (1 : ℕ) ((6 : ℕ) * k + (1 : ℕ)),
(4 : ℕ) * k < A.card →
∀ (l : ℕ),
Odd l →
(5 : ℕ) ≤ l →
l ≤ (2 : ℕ) * k + (1 : ℕ) →
∃ (f : Fin l → ℕ),
Function.Injective f ∧
(∀ (i : Fin l), f i ∈ A) ∧ ∀ (i j : Fin l), (SimpleGraph.cycleGraph l).Adj i j → (f i).Coprime (f j) := by
-- approach: Construct the odd cycle on the multiples of two and three, joined by one odd element not divisible by three.
-- licence: CC-BY-4.0
-- label: Sets missing an element of the arithmetic backbone
-- claim: $|A|>4k,\quad A\subseteq[1,6k+1],\quad 2\le s\le k,\quad [1,6s-3]\cap(2\mathbb{Z}\cup3\mathbb{Z})\not\subseteq A\quad\Longrightarrow\quad A\text{ contains a coprime cycle of length }2s+1.$
have h_missing_backbone : ∀ (k : ℕ), 3 ≤ k →
∀ A ⊆ Finset.Icc (1 : ℕ) (6*k+1), 4*k < A.card →
∀ (s : ℕ), 2 ≤ s → s ≤ k →
(∃ n : ℕ, 0 < n ∧ n+3 ≤ 6*s ∧ (Even n ∨ 3 ∣ n) ∧ n ∉ A) →
∃ f : Fin (2*s+1) → ℕ, Function.Injective f ∧
(∀ i, f i ∈ A) ∧
∀ i j, (SimpleGraph.cycleGraph (2*s+1)).Adj i j → (f i).Coprime (f j) := sorry
/- A set containing the multiples of two or three through 6s-3, and one
element coprime to six, contains a cyclic coprime ordering of length 2s+1. -/
have coprime_odd_cycle_of_multiples (s : ℕ) (hs : 1 ≤ s) (A : Finset ℕ) (t : ℕ)
(ht : t ∈ A) (htOdd : Odd t) (htThree : ¬ 3 ∣ t)
(hA : ∀ n : ℕ, 0 < n → n + 3 ≤ 6*s → (Even n ∨ 3 ∣ n) → n ∈ A) :
∃ f : Fin (2*s+1) → ℕ, Function.Injective f ∧
(∀ i, f i ∈ A) ∧
∀ i j, (SimpleGraph.cycleGraph (2*s+1)).Adj i j → (f i).Coprime (f j) := by
have copOne (a b : ℕ) (h : b = a + 1) : a.Coprime b := by
have hd := Nat.dvd_sub (Nat.gcd_dvd_right a b) (Nat.gcd_dvd_left a b)
rw [show b - a = 1 by omega] at hd
exact Nat.eq_one_of_dvd_one hd
have copFive (a b : ℕ) (h : b = a + 5) (ha : ¬ 5 ∣ a) : a.Coprime b := by
have hd := Nat.dvd_sub (Nat.gcd_dvd_right a b) (Nat.gcd_dvd_left a b)
rw [show b - a = 5 by omega] at hd
rcases (Nat.dvd_prime Nat.prime_five).mp hd with h1 | h5
· exact h1
· exact (ha (h5 ▸ Nat.gcd_dvd_left a b)).elim
let e (j : ℕ) : ℕ := if 5 ∣ 6*j+9 then 6*j+8 else 6*j+4
have eLower (j : ℕ) : 6*j+4 ≤ e j := by dsimp [e]; split <;> omega
have eUpper (j : ℕ) : e j ≤ 6*j+8 := by dsimp [e]; split <;> omega
have eEven (j : ℕ) : (e j) % 2 = 0 := by dsimp [e]; split <;> omega
have eCop (j : ℕ) : (6*j+3).Coprime (e j) ∧ (e j).Coprime (6*j+9) := by
by_cases hj : 5 ∣ 6*j+9
· simp only [e, if_pos hj]
exact ⟨copFive _ _ (by omega) (by omega), copOne _ _ (by omega)⟩
· simp only [e, if_neg hj]
exact ⟨copOne _ _ (by omega), copFive _ _ (by omega) (by omega)⟩
have eInject (a b : ℕ) (h : e a = e b) : a = b := by
have ha₁ := eLower a
have ha₂ := eUpper a
have hb₁ := eLower b
have hb₂ := eUpper b
omega
let g (i : ℕ) : ℕ :=
if i = 0 then t else if i = 2*s then 2
else if i % 2 = 1 then 6*(i/2)+3 else e (i/2-1)
have gZero : g 0 = t := by simp [g]
have gLast : g (2*s) = 2 := by
have h : 2*s ≠ 0 := by omega
simp [g,h]
have gOdd (j : ℕ) (hj : j < s) : g (2*j+1) = 6*j+3 := by
simp only [g,if_neg (show 2*j+1 ≠ 0 by omega),
if_neg (show 2*j+1 ≠ 2*s by omega),if_pos (show (2*j+1)%2=1 by omega)]
congr 1; omega
have gEven (j : ℕ) (hj : j+1 < s) : g (2*j+2) = e j := by
simp only [g,if_neg (show 2*j+2 ≠ 0 by omega),
if_neg (show 2*j+2 ≠ 2*s by omega),if_neg (show (2*j+2)%2≠1 by omega)]
congr 1; omega
have tOdd : t % 2 = 1 := Nat.odd_iff.mp htOdd
have tThree : t % 3 ≠ 0 := fun h => htThree (Nat.dvd_of_mod_eq_zero h)
have form (i : ℕ) (hi : i ≤ 2*s) :
(i = 0 ∧ g i = t) ∨ (i = 2*s ∧ g i = 2) ∨
(∃ j < s, i = 2*j+1 ∧ g i = 6*j+3) ∨
(∃ j, j+1 < s ∧ i = 2*j+2 ∧ g i = e j) := by
by_cases h0 : i = 0
· exact Or.inl ⟨h0, h0 ▸ gZero⟩
by_cases hLast : i = 2*s
· exact Or.inr (Or.inl ⟨hLast, hLast ▸ gLast⟩)
by_cases hiOdd : i%2 = 1
· obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+1 := ⟨i/2, by omega⟩
exact Or.inr (Or.inr (Or.inl ⟨j, by omega, rfl, gOdd j (by omega)⟩))
· obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+2 := ⟨i/2-1, by omega⟩
exact Or.inr (Or.inr (Or.inr ⟨j, by omega, rfl, gEven j (by omega)⟩))
have copStep (i : ℕ) (hi : i < 2*s) : (g i).Coprime (g (i+1)) := by
by_cases h0 : i = 0
· subst i
rw [gZero, show g (0+1) = 3 by simpa using gOdd 0 (by omega)]
exact (Nat.prime_three.coprime_iff_not_dvd.mpr htThree).symm
by_cases hLast : i+1 = 2*s
· have hi' : i = 2*(s-1)+1 := by omega
rw [hLast, gLast, hi', gOdd (s-1) (by omega)]
exact Nat.coprime_two_right.mpr (Nat.odd_iff.mpr (by omega))
by_cases hOdd : i % 2 = 1
· obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+1 := ⟨i/2, by omega⟩
rw [gOdd j (by omega), show 2*j+1+1 = 2*j+2 by omega, gEven j (by omega)]
exact (eCop j).1
· obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+2 := ⟨i/2-1, by omega⟩
rw [gEven j (by omega), show 2*j+2+1 = 2*(j+1)+1 by omega,
gOdd (j+1) (by omega)]
simpa only [show 6*(j+1)+3 = 6*j+9 by omega] using (eCop j).2
have copWrap : (g (2*s)).Coprime (g 0) := by
rw [gLast,gZero]
exact (Nat.coprime_two_right.mpr htOdd).symm
refine ⟨fun i => g i.val, ?_, ?_, ?_⟩
· intro i j hij
change g i.val = g j.val at hij
apply Fin.ext
have hi := i.isLt
have hj := j.isLt
rcases form i.val (by omega) with ⟨hi₀,hiG⟩ | ⟨hi₀,hiG⟩ |
⟨a,ha,hi₀,hiG⟩ | ⟨a,ha,hi₀,hiG⟩ <;>
rcases form j.val (by omega) with ⟨hj₀,hjG⟩ | ⟨hj₀,hjG⟩ |
⟨b,hb,hj₀,hjG⟩ | ⟨b,hb,hj₀,hjG⟩ <;>
rw [hiG,hjG] at hij
all_goals first | omega | (have h := eEven a; omega) |
(have h := eEven b; omega) | (have h := eLower a; omega) |
(have h := eLower b; omega) | (have h := eInject a b hij; omega)
· intro i
change g i.val ∈ A
have hi := i.isLt
rcases form i.val (by omega) with ⟨_, h⟩ | ⟨_, h⟩ |
⟨j,hj,_,h⟩ | ⟨j,hj,_,h⟩
· simpa only [h] using ht
· rw [h]
exact hA _ (by omega) (by omega) (Or.inl (by decide))
· rw [h]
exact hA _ (by omega) (by omega) (Or.inr (by omega))
· rw [h]
have hj₁ := eLower j
have hj₂ := eUpper j
exact hA _ (by omega) (by omega) (Or.inl (Nat.even_iff.mpr (eEven j)))
· intro i j hadj
change (g i.val).Coprime (g j.val)
have adjStep (a b : Fin (2*s+1)) (h : (b-a).val = 1) :
(g a.val).Coprime (g b.val) := by
have ha := a.isLt
have hb := b.isLt
by_cases hab : a ≤ b
· rw [Fin.sub_val_of_le hab] at h
have h' : b.val = a.val+1 := by omega
rw [h']
exact copStep a.val (by omega)
· have hab' : b < a := lt_of_not_ge hab
have hv : b.val < a.val := hab'
rw [Fin.val_sub, Nat.mod_eq_of_lt (by omega : 2*s+1-a.val+b.val < 2*s+1)] at h
have ha' : a.val = 2*s := by omega
have hb' : b.val = 0 := by omega
simpa only [ha',hb'] using copWrap
rcases SimpleGraph.cycleGraph_adj'.mp hadj with h | h
· exact (adjStep j i h).symm
· exact adjStep i j h
/- A set above the threshold contains an odd element not divisible by three. -/
have exists_coprime_six_of_card_gt (k : ℕ) (A : Finset ℕ)
(hA : A ⊆ Finset.Icc 1 (6*k+1)) (hCard : 4*k < A.card) :
∃ t ∈ A, Odd t ∧ ¬ 3 ∣ t := by
by_contra h
have residue (n : ℕ) (hn : n ∈ A) :
n%6 = 0 ∨ n%6 = 2 ∨ n%6 = 3 ∨ n%6 = 4 := by
by_cases ho : Odd n
· have hd : 3 ∣ n := by
by_contra hnd
exact h ⟨n, hn, ho, hnd⟩
have hodd := Nat.odd_iff.mp ho
omega
· have hnOdd : n%2 ≠ 1 := fun h' => ho (Nat.odd_iff.mpr h')
omega
let f : {n : ℕ // n ∈ A} → Fin (4*k) := fun n =>
⟨2*(n.val-1)/3, by
have hr := residue n.val n.property
have hn := Finset.mem_Icc.mp (hA n.property)
omega⟩
have hf : Function.Injective f := by
intro a b hab
have he := congrArg Fin.val hab
change 2*(a.val-1)/3 = 2*(b.val-1)/3 at he
have ha := Finset.mem_Icc.mp (hA a.property)
have hb := Finset.mem_Icc.mp (hA b.property)
have hra := residue a.val a.property
have hrb := residue b.val b.property
apply Subtype.ext
omega
have hbound := Fintype.card_le_of_injective f hf
simp only [Fintype.card_coe, Fintype.card_fin] at hbound
omega
intro k hk A hA hCard l hOdd hLower hUpper
obtain ⟨s, rfl⟩ := hOdd
have hs : 2 ≤ s := by omega
have hsk : s ≤ k := by omega
by_cases hBackbone : ∀ n : ℕ, 0 < n → n + 3 ≤ 6*s → (Even n ∨ 3 ∣ n) → n ∈ A
· obtain ⟨t, ht, htOdd, htThree⟩ := exists_coprime_six_of_card_gt k A hA hCard
exact coprime_odd_cycle_of_multiples s (by omega) A t ht htOdd htThree hBackbone
· have hMissing : ∃ n : ℕ, 0 < n ∧ n+3 ≤ 6*s ∧ (Even n ∨ 3 ∣ n) ∧ n ∉ A := by
by_contra h
apply hBackbone
intro n hn₀ hn₁ hn₂
by_contra hn₃
exact h ⟨n, hn₀, hn₁, hn₂, hn₃⟩
exact h_missing_backbone k hk A hA hCard s hs hsk hMissingThe gate replayed this file at its merge, each hole a sorry (D-12 #5); the whole file: targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean
Closing it through its holes
Closable through its holes: once they are proved, a proof of this statement may name their theorems, which its Context already carries. A direct proof is accepted at any time.
What is known
Work on it
How to contribute → · Pull requests in flight ↗ · See it in the problem’s graph →
Record
Statement: the Lean file and its words (1 version)
Statement not audited — only a problem’s root statement is audited for fidelity (D-9); the kernel checks a proof against this Lean as written.
import Mathlib
import Defs.AlgebraWeylAlgebra
import Defs.AnalysisSpecialFunctionsAdditiveCharacter
import Defs.CombinatoricsSimpleGraphCircumference
import Defs.CombinatoricsSimpleGraphClique
import Defs.CombinatoricsSimpleGraphColoringVertex
import Defs.DataNatPrimeFinset
import Defs.FieldTheoryMilnorKTheory
import Defs.GroupTheoryRationalClasses
import Defs.Local
import Nodes.«erdos-883--h1--h1--h1--h1».Context
open Filter
open scoped Classical
open Erdos883
/-! Hole `h_first` of a merged partial proof, as a node (D-12 #5, D-29).
Statement generated by the gate from the assembly; immutable (D-3). -/
theorem erdos_883__h1__h1__h1__h1 : ∀ (k : ℕ),
(3 : ℕ) ≤ k →
∀ A ⊆ Finset.Icc (1 : ℕ) ((6 : ℕ) * k + (1 : ℕ)),
(4 : ℕ) * k < A.card →
∀ (l : ℕ),
Odd l →
(5 : ℕ) ≤ l →
l ≤ (2 : ℕ) * k + (1 : ℕ) →
∃ (f : Fin l → ℕ),
Function.Injective f ∧
(∀ (i : Fin l), f i ∈ A) ∧ ∀ (i j : Fin l), (SimpleGraph.cycleGraph l).Adj i j → (f i).Coprime (f j) := by
sorryA statement is written := by sorry: the sorry holds the place of a proof, because a statement file only says what is claimed. A proof the gate checked is its own file, Proof.lean. How to read a proof page →
In words, unverified — what this statement says; written by copper-lemma-53a2d0, drafted with GPT-6, 2026-11-25; no one has read it against the Lean and signed it.
Draft · drafted, by the model named above
$\displaystyle \forall k\ge3,\ \forall A\subseteq[1,6k+1],\ |A|>4k\ \Rightarrow\ \forall\text{ odd }l\in[5,2k+1],\ \exists\text{ an injective coprime cyclic ordering of length }l\text{ in }A$
Consecutive entries, including the last and first, must be coprime.
Rendered from gloss/774a98f1f3d1….md · Improve these words →
Rendered from targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/Statement.lean. Origin: compiler-derived.
Depends on (1), each in words
Depends on, each in words where someone has written them:
- erdos-883--h1--h1--h1--h1--h1: $|A|>4k,\quad A\subseteq[1,6k+1],\quad 2\le s\le k,\quad [1,6s-3]\cap(2\mathbb{Z}\cup3\mathbb{Z})\not\subseteq A\quad\Longrightarrow\quad A\text{ contains a coprime cycle of length }2s+1.$
Attestation: none of a proof
No proof of this statement has been merged. A partial assembly merged under attestations/002777.json: it records an attempt, not a proof (see Attempts below).
Witness
Not checked — no run on this page records step 7 passing for it.
7c0edb425068.import Mathlib
import Defs.AlgebraWeylAlgebra
import Defs.AnalysisSpecialFunctionsAdditiveCharacter
import Defs.CombinatoricsSimpleGraphCircumference
import Defs.CombinatoricsSimpleGraphClique
import Defs.CombinatoricsSimpleGraphColoringVertex
import Defs.DataNatPrimeFinset
import Defs.FieldTheoryMilnorKTheory
import Defs.GroupTheoryRationalClasses
import Defs.Local
open Filter
open scoped Classical
open Erdos883
theorem witness : ∃ (k : ℕ) (A : Finset ℕ) (l : ℕ), 3 ≤ k ∧
A ⊆ Finset.Icc 1 (6 * k + 1) ∧ 4 * k < A.card ∧
Odd l ∧ 5 ≤ l ∧ l ≤ 2 * k + 1 :=
⟨3, Finset.Icc 1 19, 7, by decide, by decide, by decide, ⟨3, rfl⟩, by decide, by decide⟩No gloss yet: no one has written in words what this witness says (D-3 v3.30); the Lean above is the witness. How to write one →
Attempts (1)
1 recorded. Routes refuted: none. Failure classes: none.
Untrusted contributor text — a partial assembly: it records an attempt, not a proof; its attestation names the file, and no hash in the record binds these bytes.
Untrusted: partial assembly (D-12 #5), by augustuswindsor; merged in 1a2e4048ef95 under attestations/002777.json, whose step 2 took this file as a partial. A partial records an attempt, not a proof: the gate replayed it with its holes left as sorry. Rendered from targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean.
Untrusted contributor text — an outline the gate extracted from this partial assembly; its holes are sorry steps, and it records an attempt, not a proof.
Outline of 20261203T063856Z-augustuswindsor-partial.lean, extracted by the gate at 029533477f5e from the proof’s elaboration: each step is a claim the proof establishes and the goal it leaves. Open a step for what it uses and its Lean lines.
h_missing_backbonehole∀ (k : ℕ), (3 : ℕ) ≤ k → ∀ A ⊆ Finset.Icc (1 : ℕ) ((6 : ℕ) * k + (1 : ℕ)), (4 : ℕ) * k < A.card → ∀ (s : ℕ), (2 : ℕ) ≤ s → s ≤ k → (∃ (n : ℕ), (0 : ℕ) < n ∧ n + (3 : ℕ) ≤ (6 : ℕ) * s ∧ (Even n ∨ (3 : ℕ) ∣ n) ∧ n ∉ A) → ∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j)holeLeaves
∀ (k : ℕ), (3 : ℕ) ≤ k → ∀ A ⊆ Finset.Icc (1 : ℕ) ((6 : ℕ) * k + (1 : ℕ)), (4 : ℕ) * k < A.card → ∀ (l : ℕ), Odd l → (5 : ℕ) ≤ l → l ≤ (2 : ℕ) * k + (1 : ℕ) → ∃ (f : Fin l → ℕ), Function.Injective f ∧ (∀ (i : Fin l), f i ∈ A) ∧ ∀ (i j : Fin l), (SimpleGraph.cycleGraph l).Adj i j → (f i).Coprime (f j), withh_missing_backbone : ∀ (k : ℕ), (3 : ℕ) ≤ k → ∀ A ⊆ Finset.Icc (1 : ℕ) ((6 : ℕ) * k + (1 : ℕ)), (4 : ℕ) * k < A.card → ∀ (s : ℕ), (2 : ℕ) ≤ s → s ≤ k → (∃ (n : ℕ), (0 : ℕ) < n ∧ n + (3 : ℕ) ≤ (6 : ℕ) * s ∧ (Even n ∨ (3 : ℕ) ∣ n) ∧ n ∉ A) → ∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j).Uses library
Finset.IccThe finset $[a, b]$ of elementsxsuch thata ≤ xandx ≤ b. ,Finset.cards.cardis the number of elements ofs, aka its cardinality. ,EvenAn elementaof a typeαwith addition satisfiesEven aifa = r + r, for somer : α. ,FinNatural numbers less than some upper bound. ,Function.InjectiveA functionf : α → βis called injective iff x = f yimpliesx = y. ,SimpleGraph.cycleGraphCycle graph overFin n,SimpleGraph.AdjThe adjacency relation of a simple graph. ,Nat.Coprimemandnare coprime, or relatively prime, if theirgcdis 1. .Left open as a hole; its statement is erdos-883--h1--h1--h1--h1--h1 (open).
Lean, lines 35–41
have h_missing_backbone : ∀ (k : ℕ), 3 ≤ k → ∀ A ⊆ Finset.Icc (1 : ℕ) (6*k+1), 4*k < A.card → ∀ (s : ℕ), 2 ≤ s → s ≤ k → (∃ n : ℕ, 0 < n ∧ n+3 ≤ 6*s ∧ (Even n ∨ 3 ∣ n) ∧ n ∉ A) → ∃ f : Fin (2*s+1) → ℕ, Function.Injective f ∧ (∀ i, f i ∈ A) ∧ ∀ i j, (SimpleGraph.cycleGraph (2*s+1)).Adj i j → (f i).Coprime (f j) := sorrycoprime_odd_cycle_of_multipleshave∀ (s : ℕ), (1 : ℕ) ≤ s → ∀ (A : Finset ℕ), ∀ t ∈ A, Odd t → ¬(3 : ℕ) ∣ t → (∀ (n : ℕ), (0 : ℕ) < n → n + (3 : ℕ) ≤ (6 : ℕ) * s → Even n ∨ (3 : ℕ) ∣ n → n ∈ A) → ∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j)Leaves
∀ (k : ℕ), (3 : ℕ) ≤ k → ∀ A ⊆ Finset.Icc (1 : ℕ) ((6 : ℕ) * k + (1 : ℕ)), (4 : ℕ) * k < A.card → ∀ (l : ℕ), Odd l → (5 : ℕ) ≤ l → l ≤ (2 : ℕ) * k + (1 : ℕ) → ∃ (f : Fin l → ℕ), Function.Injective f ∧ (∀ (i : Fin l), f i ∈ A) ∧ ∀ (i j : Fin l), (SimpleGraph.cycleGraph l).Adj i j → (f i).Coprime (f j), withcoprime_odd_cycle_of_multiples : ∀ (s : ℕ), (1 : ℕ) ≤ s → ∀ (A : Finset ℕ), ∀ t ∈ A, Odd t → ¬(3 : ℕ) ∣ t → (∀ (n : ℕ), (0 : ℕ) < n → n + (3 : ℕ) ≤ (6 : ℕ) * s → Even n ∨ (3 : ℕ) ∣ n → n ∈ A) → ∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j).Uses library
FinsetFinset αis the type of finite sets of elements ofα. ,OddAn elementaof a semiring is odd if there existsksucha = 2*k + 1. ,EvenAn elementaof a typeαwith addition satisfiesEven aifa = r + r, for somer : α. ,FinNatural numbers less than some upper bound. ,Function.InjectiveA functionf : α → βis called injective iff x = f yimpliesx = y. ,SimpleGraph.cycleGraphCycle graph overFin n,SimpleGraph.AdjThe adjacency relation of a simple graph. ,Nat.Coprimemandnare coprime, or relatively prime, if theirgcdis 1. ,Exists.introExistential introduction. ,Fin.valThe number that is strictly less thann. .Lean, lines 44–173
have coprime_odd_cycle_of_multiples (s : ℕ) (hs : 1 ≤ s) (A : Finset ℕ) (t : ℕ) (ht : t ∈ A) (htOdd : Odd t) (htThree : ¬ 3 ∣ t) (hA : ∀ n : ℕ, 0 < n → n + 3 ≤ 6*s → (Even n ∨ 3 ∣ n) → n ∈ A) : ∃ f : Fin (2*s+1) → ℕ, Function.Injective f ∧ (∀ i, f i ∈ A) ∧ ∀ i j, (SimpleGraph.cycleGraph (2*s+1)).Adj i j → (f i).Coprime (f j) := by have copOne (a b : ℕ) (h : b = a + 1) : a.Coprime b := by have hd := Nat.dvd_sub (Nat.gcd_dvd_right a b) (Nat.gcd_dvd_left a b) rw [show b - a = 1 by omega] at hd exact Nat.eq_one_of_dvd_one hd have copFive (a b : ℕ) (h : b = a + 5) (ha : ¬ 5 ∣ a) : a.Coprime b := by have hd := Nat.dvd_sub (Nat.gcd_dvd_right a b) (Nat.gcd_dvd_left a b) rw [show b - a = 5 by omega] at hd rcases (Nat.dvd_prime Nat.prime_five).mp hd with h1 | h5 · exact h1 · exact (ha (h5 ▸ Nat.gcd_dvd_left a b)).elim let e (j : ℕ) : ℕ := if 5 ∣ 6*j+9 then 6*j+8 else 6*j+4 have eLower (j : ℕ) : 6*j+4 ≤ e j := by dsimp [e]; split <;> omega have eUpper (j : ℕ) : e j ≤ 6*j+8 := by dsimp [e]; split <;> omega have eEven (j : ℕ) : (e j) % 2 = 0 := by dsimp [e]; split <;> omega have eCop (j : ℕ) : (6*j+3).Coprime (e j) ∧ (e j).Coprime (6*j+9) := by by_cases hj : 5 ∣ 6*j+9 · simp only [e, if_pos hj] exact ⟨copFive _ _ (by omega) (by omega), copOne _ _ (by omega)⟩ · simp only [e, if_neg hj] exact ⟨copOne _ _ (by omega), copFive _ _ (by omega) (by omega)⟩ have eInject (a b : ℕ) (h : e a = e b) : a = b := by have ha₁ := eLower a have ha₂ := eUpper a have hb₁ := eLower b have hb₂ := eUpper b omega let g (i : ℕ) : ℕ := if i = 0 then t else if i = 2*s then 2 else if i % 2 = 1 then 6*(i/2)+3 else e (i/2-1) have gZero : g 0 = t := by simp [g] have gLast : g (2*s) = 2 := by have h : 2*s ≠ 0 := by omega simp [g,h] have gOdd (j : ℕ) (hj : j < s) : g (2*j+1) = 6*j+3 := by simp only [g,if_neg (show 2*j+1 ≠ 0 by omega), if_neg (show 2*j+1 ≠ 2*s by omega),if_pos (show (2*j+1)%2=1 by omega)] congr 1; omega have gEven (j : ℕ) (hj : j+1 < s) : g (2*j+2) = e j := by simp only [g,if_neg (show 2*j+2 ≠ 0 by omega), if_neg (show 2*j+2 ≠ 2*s by omega),if_neg (show (2*j+2)%2≠1 by omega)] congr 1; omega have tOdd : t % 2 = 1 := Nat.odd_iff.mp htOdd have tThree : t % 3 ≠ 0 := fun h => htThree (Nat.dvd_of_mod_eq_zero h) have form (i : ℕ) (hi : i ≤ 2*s) : (i = 0 ∧ g i = t) ∨ (i = 2*s ∧ g i = 2) ∨ (∃ j < s, i = 2*j+1 ∧ g i = 6*j+3) ∨ (∃ j, j+1 < s ∧ i = 2*j+2 ∧ g i = e j) := by by_cases h0 : i = 0 · exact Or.inl ⟨h0, h0 ▸ gZero⟩ by_cases hLast : i = 2*s · exact Or.inr (Or.inl ⟨hLast, hLast ▸ gLast⟩) by_cases hiOdd : i%2 = 1 · obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+1 := ⟨i/2, by omega⟩ exact Or.inr (Or.inr (Or.inl ⟨j, by omega, rfl, gOdd j (by omega)⟩)) · obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+2 := ⟨i/2-1, by omega⟩ exact Or.inr (Or.inr (Or.inr ⟨j, by omega, rfl, gEven j (by omega)⟩)) have copStep (i : ℕ) (hi : i < 2*s) : (g i).Coprime (g (i+1)) := by by_cases h0 : i = 0 · subst i rw [gZero, show g (0+1) = 3 by simpa using gOdd 0 (by omega)] exact (Nat.prime_three.coprime_iff_not_dvd.mpr htThree).symm by_cases hLast : i+1 = 2*s · have hi' : i = 2*(s-1)+1 := by omega rw [hLast, gLast, hi', gOdd (s-1) (by omega)] exact Nat.coprime_two_right.mpr (Nat.odd_iff.mpr (by omega)) by_cases hOdd : i % 2 = 1 · obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+1 := ⟨i/2, by omega⟩ rw [gOdd j (by omega), show 2*j+1+1 = 2*j+2 by omega, gEven j (by omega)] exact (eCop j).1 · obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+2 := ⟨i/2-1, by omega⟩ rw [gEven j (by omega), show 2*j+2+1 = 2*(j+1)+1 by omega, gOdd (j+1) (by omega)] simpa only [show 6*(j+1)+3 = 6*j+9 by omega] using (eCop j).2 have copWrap : (g (2*s)).Coprime (g 0) := by rw [gLast,gZero] exact (Nat.coprime_two_right.mpr htOdd).symm refine ⟨fun i => g i.val, ?_, ?_, ?_⟩ · intro i j hij change g i.val = g j.val at hij apply Fin.ext have hi := i.isLt have hj := j.isLt rcases form i.val (by omega) with ⟨hi₀,hiG⟩ | ⟨hi₀,hiG⟩ | ⟨a,ha,hi₀,hiG⟩ | ⟨a,ha,hi₀,hiG⟩ <;> rcases form j.val (by omega) with ⟨hj₀,hjG⟩ | ⟨hj₀,hjG⟩ | ⟨b,hb,hj₀,hjG⟩ | ⟨b,hb,hj₀,hjG⟩ <;> rw [hiG,hjG] at hij all_goals first | omega | (have h := eEven a; omega) | (have h := eEven b; omega) | (have h := eLower a; omega) | (have h := eLower b; omega) | (have h := eInject a b hij; omega) · intro i change g i.val ∈ A have hi := i.isLt rcases form i.val (by omega) with ⟨_, h⟩ | ⟨_, h⟩ | ⟨j,hj,_,h⟩ | ⟨j,hj,_,h⟩ · simpa only [h] using ht · rw [h] exact hA _ (by omega) (by omega) (Or.inl (by decide)) · rw [h] exact hA _ (by omega) (by omega) (Or.inr (by omega)) · rw [h] have hj₁ := eLower j have hj₂ := eUpper j exact hA _ (by omega) (by omega) (Or.inl (Nat.even_iff.mpr (eEven j))) · intro i j hadj change (g i.val).Coprime (g j.val) have adjStep (a b : Fin (2*s+1)) (h : (b-a).val = 1) : (g a.val).Coprime (g b.val) := by have ha := a.isLt have hb := b.isLt by_cases hab : a ≤ b · rw [Fin.sub_val_of_le hab] at h have h' : b.val = a.val+1 := by omega rw [h'] exact copStep a.val (by omega) · have hab' : b < a := lt_of_not_ge hab have hv : b.val < a.val := hab' rw [Fin.val_sub, Nat.mod_eq_of_lt (by omega : 2*s+1-a.val+b.val < 2*s+1)] at h have ha' : a.val = 2*s := by omega have hb' : b.val = 0 := by omega simpa only [ha',hb'] using copWrap rcases SimpleGraph.cycleGraph_adj'.mp hadj with h | h · exact (adjStep j i h).symm · exact adjStep i j hcoprime_odd_cycle_of_multiples.copOnehave∀ (a b : ℕ), b = a + (1 : ℕ) → a.Coprime bLeaves
∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j), withcopOne : ∀ (a b : ℕ), b = a + (1 : ℕ) → a.Coprime b.Uses library
Nat.Coprimemandnare coprime, or relatively prime, if theirgcdis 1. ,Nat.eq_one_of_dvd_one.Lean, lines 50–53
have copOne (a b : ℕ) (h : b = a + 1) : a.Coprime b := by have hd := Nat.dvd_sub (Nat.gcd_dvd_right a b) (Nat.gcd_dvd_left a b) rw [show b - a = 1 by omega] at hd exact Nat.eq_one_of_dvd_one hdcoprime_odd_cycle_of_multiples.copOne.hdhavea.gcd b ∣ b - aLeaves
a.Coprime b, withhd : a.gcd b ∣ b - a.Uses library
Nat.dvd_sub,Nat.gcd_dvd_right,Nat.gcd_dvd_left.Lean, line 51
have hd := Nat.dvd_sub (Nat.gcd_dvd_right a b) (Nat.gcd_dvd_left a b)
coprime_odd_cycle_of_multiples.copFivehave∀ (a b : ℕ), b = a + (5 : ℕ) → ¬(5 : ℕ) ∣ a → a.Coprime bLeaves
∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j), withcopFive : ∀ (a b : ℕ), b = a + (5 : ℕ) → ¬(5 : ℕ) ∣ a → a.Coprime b.Uses library
Nat.Coprimemandnare coprime, or relatively prime, if theirgcdis 1. ,Nat.dvd_prime,Nat.prime_five,Iff.mpModus ponens for if and only if. .Lean, lines 54–59
have copFive (a b : ℕ) (h : b = a + 5) (ha : ¬ 5 ∣ a) : a.Coprime b := by have hd := Nat.dvd_sub (Nat.gcd_dvd_right a b) (Nat.gcd_dvd_left a b) rw [show b - a = 5 by omega] at hd rcases (Nat.dvd_prime Nat.prime_five).mp hd with h1 | h5 · exact h1 · exact (ha (h5 ▸ Nat.gcd_dvd_left a b)).elimcoprime_odd_cycle_of_multiples.copFive.hdhavea.gcd b ∣ b - aLeaves
a.Coprime b, withhd : a.gcd b ∣ b - a.Uses library
Nat.dvd_sub,Nat.gcd_dvd_right,Nat.gcd_dvd_left.Lean, line 55
have hd := Nat.dvd_sub (Nat.gcd_dvd_right a b) (Nat.gcd_dvd_left a b)
coprime_odd_cycle_of_multiples.copFive.s2caseLeaves
a.Coprime b, withh1 : a.gcd b = (1 : ℕ).coprime_odd_cycle_of_multiples.copFive.s3caseLeaves
a.Coprime b, withh5 : a.gcd b = (5 : ℕ).Uses library
Nat.gcd_dvd_left,False.elimFalse.elim : False → Csays that fromFalse, any desired propositionCholds. .Lean, line 59
· exact (ha (h5 ▸ Nat.gcd_dvd_left a b)).elim
coprime_odd_cycle_of_multiples.eLowerhave∀ (j : ℕ), (6 : ℕ) * j + (4 : ℕ) ≤ e jLeaves
∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j), witheLower : ∀ (j : ℕ), (6 : ℕ) * j + (4 : ℕ) ≤ e j.Lean, line 61
have eLower (j : ℕ) : 6*j+4 ≤ e j := by dsimp [e]; split <;> omega
coprime_odd_cycle_of_multiples.eUpperhave∀ (j : ℕ), e j ≤ (6 : ℕ) * j + (8 : ℕ)Leaves
∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j), witheUpper : ∀ (j : ℕ), e j ≤ (6 : ℕ) * j + (8 : ℕ).Lean, line 62
have eUpper (j : ℕ) : e j ≤ 6*j+8 := by dsimp [e]; split <;> omega
coprime_odd_cycle_of_multiples.eEvenhave∀ (j : ℕ), e j % (2 : ℕ) = (0 : ℕ)Leaves
∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j), witheEven : ∀ (j : ℕ), e j % (2 : ℕ) = (0 : ℕ).Lean, line 63
have eEven (j : ℕ) : (e j) % 2 = 0 := by dsimp [e]; split <;> omega
coprime_odd_cycle_of_multiples.eCophave∀ (j : ℕ), ((6 : ℕ) * j + (3 : ℕ)).Coprime (e j) ∧ (e j).Coprime ((6 : ℕ) * j + (9 : ℕ))Leaves
∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j), witheCop : ∀ (j : ℕ), ((6 : ℕ) * j + (3 : ℕ)).Coprime (e j) ∧ (e j).Coprime ((6 : ℕ) * j + (9 : ℕ)).Uses library
Nat.Coprimemandnare coprime, or relatively prime, if theirgcdis 1. .Lean, lines 64–69
have eCop (j : ℕ) : (6*j+3).Coprime (e j) ∧ (e j).Coprime (6*j+9) := by by_cases hj : 5 ∣ 6*j+9 · simp only [e, if_pos hj] exact ⟨copFive _ _ (by omega) (by omega), copOne _ _ (by omega)⟩ · simp only [e, if_neg hj] exact ⟨copOne _ _ (by omega), copFive _ _ (by omega) (by omega)⟩coprime_odd_cycle_of_multiples.eCop.s1caseLeaves
((6 : ℕ) * j + (3 : ℕ)).Coprime (e j) ∧ (e j).Coprime ((6 : ℕ) * j + (9 : ℕ)), withhj : (5 : ℕ) ∣ (6 : ℕ) * j + (9 : ℕ).Uses library
if_pos,And.introAnd.intro : a → b → a ∧ bis the constructor for the And operation. .Lean, lines 66–67
· simp only [e, if_pos hj] exact ⟨copFive _ _ (by omega) (by omega), copOne _ _ (by omega)⟩coprime_odd_cycle_of_multiples.eCop.s2caseLeaves
((6 : ℕ) * j + (3 : ℕ)).Coprime (e j) ∧ (e j).Coprime ((6 : ℕ) * j + (9 : ℕ)), withhj : ¬(5 : ℕ) ∣ (6 : ℕ) * j + (9 : ℕ).Uses library
if_neg,And.introAnd.intro : a → b → a ∧ bis the constructor for the And operation. .Lean, lines 68–69
· simp only [e, if_neg hj] exact ⟨copOne _ _ (by omega), copFive _ _ (by omega) (by omega)⟩
coprime_odd_cycle_of_multiples.eInjecthave∀ (a b : ℕ), e a = e b → a = bLeaves
∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j), witheInject : ∀ (a b : ℕ), e a = e b → a = b.Lean, lines 70–75
have eInject (a b : ℕ) (h : e a = e b) : a = b := by have ha₁ := eLower a have ha₂ := eUpper a have hb₁ := eLower b have hb₂ := eUpper b omegacoprime_odd_cycle_of_multiples.eInject.ha1have(6 : ℕ) * a + (4 : ℕ) ≤ e aLeaves
a = b, withha₁ : (6 : ℕ) * a + (4 : ℕ) ≤ e a.Lean, line 71
have ha₁ := eLower a
coprime_odd_cycle_of_multiples.eInject.ha2havee a ≤ (6 : ℕ) * a + (8 : ℕ)Leaves
a = b, withha₂ : e a ≤ (6 : ℕ) * a + (8 : ℕ).Lean, line 72
have ha₂ := eUpper a
coprime_odd_cycle_of_multiples.eInject.hb1have(6 : ℕ) * b + (4 : ℕ) ≤ e bLeaves
a = b, withhb₁ : (6 : ℕ) * b + (4 : ℕ) ≤ e b.Lean, line 73
have hb₁ := eLower b
coprime_odd_cycle_of_multiples.eInject.hb2havee b ≤ (6 : ℕ) * b + (8 : ℕ)Leaves
a = b, withhb₂ : e b ≤ (6 : ℕ) * b + (8 : ℕ).Lean, line 74
have hb₂ := eUpper b
coprime_odd_cycle_of_multiples.gZerohaveg (0 : ℕ) = troutine: simpLeaves
∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j), withgZero : g (0 : ℕ) = t.Lean, line 79
have gZero : g 0 = t := by simp [g]
coprime_odd_cycle_of_multiples.gLasthaveg ((2 : ℕ) * s) = (2 : ℕ)Leaves
∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j), withgLast : g ((2 : ℕ) * s) = (2 : ℕ).Lean, lines 80–82
have gLast : g (2*s) = 2 := by have h : 2*s ≠ 0 := by omega simp [g,h]coprime_odd_cycle_of_multiples.gLast.hhave(2 : ℕ) * s ≠ (0 : ℕ)routine: omegaLeaves
g ((2 : ℕ) * s) = (2 : ℕ), withh : (2 : ℕ) * s ≠ (0 : ℕ).Lean, line 81
have h : 2*s ≠ 0 := by omega
coprime_odd_cycle_of_multiples.gOddhave∀ j < s, g ((2 : ℕ) * j + (1 : ℕ)) = (6 : ℕ) * j + (3 : ℕ)Leaves
∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j), withgOdd : ∀ j < s, g ((2 : ℕ) * j + (1 : ℕ)) = (6 : ℕ) * j + (3 : ℕ).Uses library
if_neg,if_pos.Lean, lines 83–86
have gOdd (j : ℕ) (hj : j < s) : g (2*j+1) = 6*j+3 := by simp only [g,if_neg (show 2*j+1 ≠ 0 by omega), if_neg (show 2*j+1 ≠ 2*s by omega),if_pos (show (2*j+1)%2=1 by omega)] congr 1; omegacoprime_odd_cycle_of_multiples.gEvenhave∀ (j : ℕ), j + (1 : ℕ) < s → g ((2 : ℕ) * j + (2 : ℕ)) = e jLeaves
∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j), withgEven : ∀ (j : ℕ), j + (1 : ℕ) < s → g ((2 : ℕ) * j + (2 : ℕ)) = e j.Uses library
if_neg.Lean, lines 87–90
have gEven (j : ℕ) (hj : j+1 < s) : g (2*j+2) = e j := by simp only [g,if_neg (show 2*j+2 ≠ 0 by omega), if_neg (show 2*j+2 ≠ 2*s by omega),if_neg (show (2*j+2)%2≠1 by omega)] congr 1; omegacoprime_odd_cycle_of_multiples.tOddhavet % (2 : ℕ) = (1 : ℕ)Leaves
∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j), withtOdd : t % (2 : ℕ) = (1 : ℕ).Uses library
Nat.odd_iff,Iff.mpModus ponens for if and only if. .Lean, line 91
have tOdd : t % 2 = 1 := Nat.odd_iff.mp htOdd
coprime_odd_cycle_of_multiples.tThreehavet % (3 : ℕ) ≠ (0 : ℕ)Leaves
∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j), withtThree : t % (3 : ℕ) ≠ (0 : ℕ).Uses library
Nat.dvd_of_mod_eq_zero.Lean, line 92
have tThree : t % 3 ≠ 0 := fun h => htThree (Nat.dvd_of_mod_eq_zero h)
coprime_odd_cycle_of_multiples.formhave∀ i ≤ (2 : ℕ) * s, i = (0 : ℕ) ∧ g i = t ∨ i = (2 : ℕ) * s ∧ g i = (2 : ℕ) ∨ (∃ j < s, i = (2 : ℕ) * j + (1 : ℕ) ∧ g i = (6 : ℕ) * j + (3 : ℕ)) ∨ ∃ (j : ℕ), j + (1 : ℕ) < s ∧ i = (2 : ℕ) * j + (2 : ℕ) ∧ g i = e jLeaves
∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j), withform : ∀ i ≤ (2 : ℕ) * s, i = (0 : ℕ) ∧ g i = t ∨ i = (2 : ℕ) * s ∧ g i = (2 : ℕ) ∨ (∃ j < s, i = (2 : ℕ) * j + (1 : ℕ) ∧ g i = (6 : ℕ) * j + (3 : ℕ)) ∨ ∃ (j : ℕ), j + (1 : ℕ) < s ∧ i = (2 : ℕ) * j + (2 : ℕ) ∧ g i = e j.Lean, lines 93–105
have form (i : ℕ) (hi : i ≤ 2*s) : (i = 0 ∧ g i = t) ∨ (i = 2*s ∧ g i = 2) ∨ (∃ j < s, i = 2*j+1 ∧ g i = 6*j+3) ∨ (∃ j, j+1 < s ∧ i = 2*j+2 ∧ g i = e j) := by by_cases h0 : i = 0 · exact Or.inl ⟨h0, h0 ▸ gZero⟩ by_cases hLast : i = 2*s · exact Or.inr (Or.inl ⟨hLast, hLast ▸ gLast⟩) by_cases hiOdd : i%2 = 1 · obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+1 := ⟨i/2, by omega⟩ exact Or.inr (Or.inr (Or.inl ⟨j, by omega, rfl, gOdd j (by omega)⟩)) · obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+2 := ⟨i/2-1, by omega⟩ exact Or.inr (Or.inr (Or.inr ⟨j, by omega, rfl, gEven j (by omega)⟩))coprime_odd_cycle_of_multiples.form.s1caseLeaves
i = (0 : ℕ) ∧ g i = t ∨ i = (2 : ℕ) * s ∧ g i = (2 : ℕ) ∨ (∃ j < s, i = (2 : ℕ) * j + (1 : ℕ) ∧ g i = (6 : ℕ) * j + (3 : ℕ)) ∨ ∃ (j : ℕ), j + (1 : ℕ) < s ∧ i = (2 : ℕ) * j + (2 : ℕ) ∧ g i = e j, withh0 : i = (0 : ℕ).Uses library
Or.inlOr.inlis "left injection" into anOr. ,And.introAnd.intro : a → b → a ∧ bis the constructor for the And operation. .Lean, line 98
· exact Or.inl ⟨h0, h0 ▸ gZero⟩
coprime_odd_cycle_of_multiples.form.s2caseLeaves
i = (0 : ℕ) ∧ g i = t ∨ i = (2 : ℕ) * s ∧ g i = (2 : ℕ) ∨ (∃ j < s, i = (2 : ℕ) * j + (1 : ℕ) ∧ g i = (6 : ℕ) * j + (3 : ℕ)) ∨ ∃ (j : ℕ), j + (1 : ℕ) < s ∧ i = (2 : ℕ) * j + (2 : ℕ) ∧ g i = e j, withhLast : i = (2 : ℕ) * s.Uses library
Or.inrOr.inris "right injection" into anOr. ,Or.inlOr.inlis "left injection" into anOr. ,And.introAnd.intro : a → b → a ∧ bis the constructor for the And operation. .Lean, line 100
· exact Or.inr (Or.inl ⟨hLast, hLast ▸ gLast⟩)
coprime_odd_cycle_of_multiples.form.s3caseLeaves
i = (0 : ℕ) ∧ g i = t ∨ i = (2 : ℕ) * s ∧ g i = (2 : ℕ) ∨ (∃ j < s, i = (2 : ℕ) * j + (1 : ℕ) ∧ g i = (6 : ℕ) * j + (3 : ℕ)) ∨ ∃ (j : ℕ), j + (1 : ℕ) < s ∧ i = (2 : ℕ) * j + (2 : ℕ) ∧ g i = e j, withhiOdd : i % (2 : ℕ) = (1 : ℕ).Uses library
Or.inrOr.inris "right injection" into anOr. ,Or.inlOr.inlis "left injection" into anOr. ,Exists.introExistential introduction. ,rflrfl : a = ais the unique constructor of the equality type. .Lean, lines 102–103
· obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+1 := ⟨i/2, by omega⟩ exact Or.inr (Or.inr (Or.inl ⟨j, by omega, rfl, gOdd j (by omega)⟩))coprime_odd_cycle_of_multiples.form.s3.s1obtain∃ (j : ℕ), i = (2 : ℕ) * j + (1 : ℕ)Leaves
(2 : ℕ) * j + (1 : ℕ) = (0 : ℕ) ∧ g ((2 : ℕ) * j + (1 : ℕ)) = t ∨ (2 : ℕ) * j + (1 : ℕ) = (2 : ℕ) * s ∧ g ((2 : ℕ) * j + (1 : ℕ)) = (2 : ℕ) ∨ (∃ j_1 < s, (2 : ℕ) * j + (1 : ℕ) = (2 : ℕ) * j_1 + (1 : ℕ) ∧ g ((2 : ℕ) * j + (1 : ℕ)) = (6 : ℕ) * j_1 + (3 : ℕ)) ∨ ∃ (j_1 : ℕ), j_1 + (1 : ℕ) < s ∧ (2 : ℕ) * j + (1 : ℕ) = (2 : ℕ) * j_1 + (2 : ℕ) ∧ g ((2 : ℕ) * j + (1 : ℕ)) = e j_1, withj : ℕ,hi : (2 : ℕ) * j + (1 : ℕ) ≤ (2 : ℕ) * s,h0 : ¬(2 : ℕ) * j + (1 : ℕ) = (0 : ℕ),hLast : ¬(2 : ℕ) * j + (1 : ℕ) = (2 : ℕ) * s,hiOdd : ((2 : ℕ) * j + (1 : ℕ)) % (2 : ℕ) = (1 : ℕ).Uses library
Exists.introExistential introduction. .Lean, line 102
· obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+1 := ⟨i/2, by omega⟩
coprime_odd_cycle_of_multiples.form.s4caseLeaves
i = (0 : ℕ) ∧ g i = t ∨ i = (2 : ℕ) * s ∧ g i = (2 : ℕ) ∨ (∃ j < s, i = (2 : ℕ) * j + (1 : ℕ) ∧ g i = (6 : ℕ) * j + (3 : ℕ)) ∨ ∃ (j : ℕ), j + (1 : ℕ) < s ∧ i = (2 : ℕ) * j + (2 : ℕ) ∧ g i = e j, withhiOdd : ¬i % (2 : ℕ) = (1 : ℕ).Uses library
Or.inrOr.inris "right injection" into anOr. ,Exists.introExistential introduction. ,rflrfl : a = ais the unique constructor of the equality type. .Lean, lines 104–105
· obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+2 := ⟨i/2-1, by omega⟩ exact Or.inr (Or.inr (Or.inr ⟨j, by omega, rfl, gEven j (by omega)⟩))coprime_odd_cycle_of_multiples.form.s4.s1obtain∃ (j : ℕ), i = (2 : ℕ) * j + (2 : ℕ)Leaves
(2 : ℕ) * j + (2 : ℕ) = (0 : ℕ) ∧ g ((2 : ℕ) * j + (2 : ℕ)) = t ∨ (2 : ℕ) * j + (2 : ℕ) = (2 : ℕ) * s ∧ g ((2 : ℕ) * j + (2 : ℕ)) = (2 : ℕ) ∨ (∃ j_1 < s, (2 : ℕ) * j + (2 : ℕ) = (2 : ℕ) * j_1 + (1 : ℕ) ∧ g ((2 : ℕ) * j + (2 : ℕ)) = (6 : ℕ) * j_1 + (3 : ℕ)) ∨ ∃ (j_1 : ℕ), j_1 + (1 : ℕ) < s ∧ (2 : ℕ) * j + (2 : ℕ) = (2 : ℕ) * j_1 + (2 : ℕ) ∧ g ((2 : ℕ) * j + (2 : ℕ)) = e j_1, withj : ℕ,hi : (2 : ℕ) * j + (2 : ℕ) ≤ (2 : ℕ) * s,h0 : ¬(2 : ℕ) * j + (2 : ℕ) = (0 : ℕ),hLast : ¬(2 : ℕ) * j + (2 : ℕ) = (2 : ℕ) * s,hiOdd : ¬((2 : ℕ) * j + (2 : ℕ)) % (2 : ℕ) = (1 : ℕ).Uses library
Exists.introExistential introduction. .Lean, line 104
· obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+2 := ⟨i/2-1, by omega⟩
coprime_odd_cycle_of_multiples.copStephave∀ i < (2 : ℕ) * s, (g i).Coprime (g (i + (1 : ℕ)))Leaves
∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j), withcopStep : ∀ i < (2 : ℕ) * s, (g i).Coprime (g (i + (1 : ℕ))).Uses library
Nat.Coprimemandnare coprime, or relatively prime, if theirgcdis 1. .Lean, lines 106–122
have copStep (i : ℕ) (hi : i < 2*s) : (g i).Coprime (g (i+1)) := by by_cases h0 : i = 0 · subst i rw [gZero, show g (0+1) = 3 by simpa using gOdd 0 (by omega)] exact (Nat.prime_three.coprime_iff_not_dvd.mpr htThree).symm by_cases hLast : i+1 = 2*s · have hi' : i = 2*(s-1)+1 := by omega rw [hLast, gLast, hi', gOdd (s-1) (by omega)] exact Nat.coprime_two_right.mpr (Nat.odd_iff.mpr (by omega)) by_cases hOdd : i % 2 = 1 · obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+1 := ⟨i/2, by omega⟩ rw [gOdd j (by omega), show 2*j+1+1 = 2*j+2 by omega, gEven j (by omega)] exact (eCop j).1 · obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+2 := ⟨i/2-1, by omega⟩ rw [gEven j (by omega), show 2*j+2+1 = 2*(j+1)+1 by omega, gOdd (j+1) (by omega)] simpa only [show 6*(j+1)+3 = 6*j+9 by omega] using (eCop j).2coprime_odd_cycle_of_multiples.copStep.s1caseLeaves
(g i).Coprime (g (i + (1 : ℕ))), withh0 : i = (0 : ℕ).Uses library
Nat.prime_three,Nat.Prime.coprime_iff_not_dvd,Iff.mprModus ponens for if and only if, reversed. ,Nat.Coprime.symm.Lean, lines 108–110
· subst i rw [gZero, show g (0+1) = 3 by simpa using gOdd 0 (by omega)] exact (Nat.prime_three.coprime_iff_not_dvd.mpr htThree).symmcoprime_odd_cycle_of_multiples.copStep.s2caseLeaves
(g i).Coprime (g (i + (1 : ℕ))), withhLast : i + (1 : ℕ) = (2 : ℕ) * s.Uses library
Nat.coprime_two_right,Iff.mprModus ponens for if and only if, reversed. ,Nat.odd_iff.Lean, lines 112–114
· have hi' : i = 2*(s-1)+1 := by omega rw [hLast, gLast, hi', gOdd (s-1) (by omega)] exact Nat.coprime_two_right.mpr (Nat.odd_iff.mpr (by omega))coprime_odd_cycle_of_multiples.copStep.s2.hi'havei = (2 : ℕ) * (s - (1 : ℕ)) + (1 : ℕ)routine: omegaLeaves
(g i).Coprime (g (i + (1 : ℕ))), withhi' : i = (2 : ℕ) * (s - (1 : ℕ)) + (1 : ℕ).Lean, line 112
· have hi' : i = 2*(s-1)+1 := by omega
coprime_odd_cycle_of_multiples.copStep.s3caseLeaves
(g i).Coprime (g (i + (1 : ℕ))), withhOdd : i % (2 : ℕ) = (1 : ℕ).Lean, lines 116–118
· obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+1 := ⟨i/2, by omega⟩ rw [gOdd j (by omega), show 2*j+1+1 = 2*j+2 by omega, gEven j (by omega)] exact (eCop j).1coprime_odd_cycle_of_multiples.copStep.s3.s1obtain∃ (j : ℕ), i = (2 : ℕ) * j + (1 : ℕ)Leaves
(g ((2 : ℕ) * j + (1 : ℕ))).Coprime (g ((2 : ℕ) * j + (1 : ℕ) + (1 : ℕ))), withj : ℕ,hi : (2 : ℕ) * j + (1 : ℕ) < (2 : ℕ) * s,h0 : ¬(2 : ℕ) * j + (1 : ℕ) = (0 : ℕ),hLast : ¬(2 : ℕ) * j + (1 : ℕ) + (1 : ℕ) = (2 : ℕ) * s,hOdd : ((2 : ℕ) * j + (1 : ℕ)) % (2 : ℕ) = (1 : ℕ).Uses library
Exists.introExistential introduction. .Lean, line 116
· obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+1 := ⟨i/2, by omega⟩
coprime_odd_cycle_of_multiples.copStep.s4caseLeaves
(g i).Coprime (g (i + (1 : ℕ))), withhOdd : ¬i % (2 : ℕ) = (1 : ℕ).Lean, lines 119–122
· obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+2 := ⟨i/2-1, by omega⟩ rw [gEven j (by omega), show 2*j+2+1 = 2*(j+1)+1 by omega, gOdd (j+1) (by omega)] simpa only [show 6*(j+1)+3 = 6*j+9 by omega] using (eCop j).2coprime_odd_cycle_of_multiples.copStep.s4.s1obtain∃ (j : ℕ), i = (2 : ℕ) * j + (2 : ℕ)Leaves
(g ((2 : ℕ) * j + (2 : ℕ))).Coprime (g ((2 : ℕ) * j + (2 : ℕ) + (1 : ℕ))), withj : ℕ,hi : (2 : ℕ) * j + (2 : ℕ) < (2 : ℕ) * s,h0 : ¬(2 : ℕ) * j + (2 : ℕ) = (0 : ℕ),hLast : ¬(2 : ℕ) * j + (2 : ℕ) + (1 : ℕ) = (2 : ℕ) * s,hOdd : ¬((2 : ℕ) * j + (2 : ℕ)) % (2 : ℕ) = (1 : ℕ).Uses library
Exists.introExistential introduction. .Lean, line 119
· obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+2 := ⟨i/2-1, by omega⟩
coprime_odd_cycle_of_multiples.copWraphave(g ((2 : ℕ) * s)).Coprime (g (0 : ℕ))Leaves
∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j), withcopWrap : (g ((2 : ℕ) * s)).Coprime (g (0 : ℕ)).Uses library
Nat.Coprimemandnare coprime, or relatively prime, if theirgcdis 1. ,Nat.coprime_two_right,Iff.mprModus ponens for if and only if, reversed. ,Nat.Coprime.symm.Lean, lines 123–125
have copWrap : (g (2*s)).Coprime (g 0) := by rw [gLast,gZero] exact (Nat.coprime_two_right.mpr htOdd).symmcoprime_odd_cycle_of_multiples.s17caseLeaves
Function.Injective fun (i : Fin ((2 : ℕ) * s + (1 : ℕ))) => g (↑i : ℕ).Uses library
Fin.valThe number that is strictly less thann. ,Fin.ext.Lean, lines 127–139
· intro i j hij change g i.val = g j.val at hij apply Fin.ext have hi := i.isLt have hj := j.isLt rcases form i.val (by omega) with ⟨hi₀,hiG⟩ | ⟨hi₀,hiG⟩ | ⟨a,ha,hi₀,hiG⟩ | ⟨a,ha,hi₀,hiG⟩ <;> rcases form j.val (by omega) with ⟨hj₀,hjG⟩ | ⟨hj₀,hjG⟩ | ⟨b,hb,hj₀,hjG⟩ | ⟨b,hb,hj₀,hjG⟩ <;> rw [hiG,hjG] at hij all_goals first | omega | (have h := eEven a; omega) | (have h := eEven b; omega) | (have h := eLower a; omega) | (have h := eLower b; omega) | (have h := eInject a b hij; omega)coprime_odd_cycle_of_multiples.s17.hihave(↑i : ℕ) < (2 : ℕ) * s + (1 : ℕ)Leaves
(↑i : ℕ) = (↑j : ℕ), withhi : (↑i : ℕ) < (2 : ℕ) * s + (1 : ℕ).Uses library
Fin.isLtThe numbervalis strictly less than the boundn. .coprime_odd_cycle_of_multiples.s17.hjhave(↑j : ℕ) < (2 : ℕ) * s + (1 : ℕ)Leaves
(↑i : ℕ) = (↑j : ℕ), withhj : (↑j : ℕ) < (2 : ℕ) * s + (1 : ℕ).Uses library
Fin.isLtThe numbervalis strictly less than the boundn. .coprime_odd_cycle_of_multiples.s17.s3haveLeaves
(↑i : ℕ) = (↑j : ℕ).Lean, line 137
all_goals first | omega | (have h := eEven a; omega) |
coprime_odd_cycle_of_multiples.s17.s4havee b % (2 : ℕ) = (0 : ℕ)Leaves
(↑i : ℕ) = (↑j : ℕ), withh : e b % (2 : ℕ) = (0 : ℕ).Lean, line 138
(have h := eEven b; omega) | (have h := eLower a; omega) |
coprime_odd_cycle_of_multiples.s17.s5haveLeaves
(↑i : ℕ) = (↑j : ℕ).Lean, line 138
(have h := eEven b; omega) | (have h := eLower a; omega) |
coprime_odd_cycle_of_multiples.s17.s6have(6 : ℕ) * b + (4 : ℕ) ≤ e bLeaves
(↑i : ℕ) = (↑j : ℕ), withh : (6 : ℕ) * b + (4 : ℕ) ≤ e b.Lean, line 139
(have h := eLower b; omega) | (have h := eInject a b hij; omega)
coprime_odd_cycle_of_multiples.s17.s7havea = bLeaves
(↑i : ℕ) = (↑j : ℕ), withh : a = b.Lean, line 139
(have h := eLower b; omega) | (have h := eInject a b hij; omega)
coprime_odd_cycle_of_multiples.s18caseLeaves
∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), (fun (i : Fin ((2 : ℕ) * s + (1 : ℕ))) => g (↑i : ℕ)) i ∈ A.Uses library
Fin.valThe number that is strictly less thann. .Lean, lines 140–153
· intro i change g i.val ∈ A have hi := i.isLt rcases form i.val (by omega) with ⟨_, h⟩ | ⟨_, h⟩ | ⟨j,hj,_,h⟩ | ⟨j,hj,_,h⟩ · simpa only [h] using ht · rw [h] exact hA _ (by omega) (by omega) (Or.inl (by decide)) · rw [h] exact hA _ (by omega) (by omega) (Or.inr (by omega)) · rw [h] have hj₁ := eLower j have hj₂ := eUpper j exact hA _ (by omega) (by omega) (Or.inl (Nat.even_iff.mpr (eEven j)))coprime_odd_cycle_of_multiples.s18.hihave(↑i : ℕ) < (2 : ℕ) * s + (1 : ℕ)Leaves
g (↑i : ℕ) ∈ A, withhi : (↑i : ℕ) < (2 : ℕ) * s + (1 : ℕ).Uses library
Fin.isLtThe numbervalis strictly less than the boundn. .coprime_odd_cycle_of_multiples.s18.s2caseLeaves
g (↑i : ℕ) ∈ A, withleft✝ : (↑i : ℕ) = (0 : ℕ),h : g (↑i : ℕ) = t.Lean, line 145
· simpa only [h] using ht
coprime_odd_cycle_of_multiples.s18.s3caseLeaves
g (↑i : ℕ) ∈ A, withleft✝ : (↑i : ℕ) = (2 : ℕ) * s,h : g (↑i : ℕ) = (2 : ℕ).Uses library
Or.inlOr.inlis "left injection" into anOr. .Lean, lines 146–147
· rw [h] exact hA _ (by omega) (by omega) (Or.inl (by decide))coprime_odd_cycle_of_multiples.s18.s4caseLeaves
g (↑i : ℕ) ∈ A, withj : ℕ,hj : j < s,left✝ : (↑i : ℕ) = (2 : ℕ) * j + (1 : ℕ),h : g (↑i : ℕ) = (6 : ℕ) * j + (3 : ℕ).Uses library
Or.inrOr.inris "right injection" into anOr. .Lean, lines 148–149
· rw [h] exact hA _ (by omega) (by omega) (Or.inr (by omega))coprime_odd_cycle_of_multiples.s18.s5caseLeaves
g (↑i : ℕ) ∈ A, withj : ℕ,hj : j + (1 : ℕ) < s,left✝ : (↑i : ℕ) = (2 : ℕ) * j + (2 : ℕ),h : g (↑i : ℕ) = e j.Uses library
Or.inlOr.inlis "left injection" into anOr. ,Nat.even_iff,Iff.mprModus ponens for if and only if, reversed. .Lean, lines 150–153
· rw [h] have hj₁ := eLower j have hj₂ := eUpper j exact hA _ (by omega) (by omega) (Or.inl (Nat.even_iff.mpr (eEven j)))coprime_odd_cycle_of_multiples.s18.s5.hj1have(6 : ℕ) * j + (4 : ℕ) ≤ e jLeaves
e j ∈ A, withhj₁ : (6 : ℕ) * j + (4 : ℕ) ≤ e j.Lean, line 151
have hj₁ := eLower j
coprime_odd_cycle_of_multiples.s18.s5.hj2havee j ≤ (6 : ℕ) * j + (8 : ℕ)Leaves
e j ∈ A, withhj₂ : e j ≤ (6 : ℕ) * j + (8 : ℕ).Lean, line 152
have hj₂ := eUpper j
coprime_odd_cycle_of_multiples.s19caseLeaves
∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → ((fun (i : Fin ((2 : ℕ) * s + (1 : ℕ))) => g (↑i : ℕ)) i).Coprime ((fun (i : Fin ((2 : ℕ) * s + (1 : ℕ))) => g (↑i : ℕ)) j).Uses library
Fin.valThe number that is strictly less thann. ,Nat.Coprimemandnare coprime, or relatively prime, if theirgcdis 1. ,SimpleGraph.cycleGraph_adj',Iff.mpModus ponens for if and only if. .Lean, lines 154–173
· intro i j hadj change (g i.val).Coprime (g j.val) have adjStep (a b : Fin (2*s+1)) (h : (b-a).val = 1) : (g a.val).Coprime (g b.val) := by have ha := a.isLt have hb := b.isLt by_cases hab : a ≤ b · rw [Fin.sub_val_of_le hab] at h have h' : b.val = a.val+1 := by omega rw [h'] exact copStep a.val (by omega) · have hab' : b < a := lt_of_not_ge hab have hv : b.val < a.val := hab' rw [Fin.val_sub, Nat.mod_eq_of_lt (by omega : 2*s+1-a.val+b.val < 2*s+1)] at h have ha' : a.val = 2*s := by omega have hb' : b.val = 0 := by omega simpa only [ha',hb'] using copWrap rcases SimpleGraph.cycleGraph_adj'.mp hadj with h | h · exact (adjStep j i h).symm · exact adjStep i j hcoprime_odd_cycle_of_multiples.s19.adjStephave∀ (a b : Fin ((2 : ℕ) * s + (1 : ℕ))), (↑(b - a) : ℕ) = (1 : ℕ) → (g (↑a : ℕ)).Coprime (g (↑b : ℕ))Leaves
(g (↑i : ℕ)).Coprime (g (↑j : ℕ)), withadjStep : ∀ (a b : Fin ((2 : ℕ) * s + (1 : ℕ))), (↑(b - a) : ℕ) = (1 : ℕ) → (g (↑a : ℕ)).Coprime (g (↑b : ℕ)).Uses library
FinNatural numbers less than some upper bound. ,Fin.valThe number that is strictly less thann. ,Nat.Coprimemandnare coprime, or relatively prime, if theirgcdis 1. .Lean, lines 156–170
have adjStep (a b : Fin (2*s+1)) (h : (b-a).val = 1) : (g a.val).Coprime (g b.val) := by have ha := a.isLt have hb := b.isLt by_cases hab : a ≤ b · rw [Fin.sub_val_of_le hab] at h have h' : b.val = a.val+1 := by omega rw [h'] exact copStep a.val (by omega) · have hab' : b < a := lt_of_not_ge hab have hv : b.val < a.val := hab' rw [Fin.val_sub, Nat.mod_eq_of_lt (by omega : 2*s+1-a.val+b.val < 2*s+1)] at h have ha' : a.val = 2*s := by omega have hb' : b.val = 0 := by omega simpa only [ha',hb'] using copWrapcoprime_odd_cycle_of_multiples.s19.adjStep.hahave(↑a : ℕ) < (2 : ℕ) * s + (1 : ℕ)Leaves
(g (↑a : ℕ)).Coprime (g (↑b : ℕ)), withha : (↑a : ℕ) < (2 : ℕ) * s + (1 : ℕ).Uses library
Fin.isLtThe numbervalis strictly less than the boundn. .coprime_odd_cycle_of_multiples.s19.adjStep.hbhave(↑b : ℕ) < (2 : ℕ) * s + (1 : ℕ)Leaves
(g (↑a : ℕ)).Coprime (g (↑b : ℕ)), withhb : (↑b : ℕ) < (2 : ℕ) * s + (1 : ℕ).Uses library
Fin.isLtThe numbervalis strictly less than the boundn. .coprime_odd_cycle_of_multiples.s19.adjStep.s3caseLeaves
(g (↑a : ℕ)).Coprime (g (↑b : ℕ)), withhab : a ≤ b.Uses library
Fin.sub_val_of_le,Fin.valThe number that is strictly less thann. .Lean, lines 161–164
· rw [Fin.sub_val_of_le hab] at h have h' : b.val = a.val+1 := by omega rw [h'] exact copStep a.val (by omega)coprime_odd_cycle_of_multiples.s19.adjStep.s3.h'have(↑b : ℕ) = (↑a : ℕ) + (1 : ℕ)routine: omegaLeaves
(g (↑a : ℕ)).Coprime (g (↑b : ℕ)), withh' : (↑b : ℕ) = (↑a : ℕ) + (1 : ℕ).Uses library
Fin.valThe number that is strictly less thann. .Lean, line 162
have h' : b.val = a.val+1 := by omega
coprime_odd_cycle_of_multiples.s19.adjStep.s4caseLeaves
(g (↑a : ℕ)).Coprime (g (↑b : ℕ)), withhab : ¬a ≤ b.Uses library
Fin.val_sub,Nat.mod_eq_of_lt.Lean, lines 165–170
· have hab' : b < a := lt_of_not_ge hab have hv : b.val < a.val := hab' rw [Fin.val_sub, Nat.mod_eq_of_lt (by omega : 2*s+1-a.val+b.val < 2*s+1)] at h have ha' : a.val = 2*s := by omega have hb' : b.val = 0 := by omega simpa only [ha',hb'] using copWrapcoprime_odd_cycle_of_multiples.s19.adjStep.s4.hab'haveb < aLeaves
(g (↑a : ℕ)).Coprime (g (↑b : ℕ)), withhab' : b < a.Uses library
lt_of_not_ge.Lean, line 165
· have hab' : b < a := lt_of_not_ge hab
coprime_odd_cycle_of_multiples.s19.adjStep.s4.hvhave(↑b : ℕ) < (↑a : ℕ)Leaves
(g (↑a : ℕ)).Coprime (g (↑b : ℕ)), withhv : (↑b : ℕ) < (↑a : ℕ).Uses library
Fin.valThe number that is strictly less thann. .Lean, line 166
have hv : b.val < a.val := hab'
coprime_odd_cycle_of_multiples.s19.adjStep.s4.ha'have(↑a : ℕ) = (2 : ℕ) * sroutine: omegaLeaves
(g (↑a : ℕ)).Coprime (g (↑b : ℕ)), withha' : (↑a : ℕ) = (2 : ℕ) * s.Uses library
Fin.valThe number that is strictly less thann. .Lean, line 168
have ha' : a.val = 2*s := by omega
coprime_odd_cycle_of_multiples.s19.adjStep.s4.hb'have(↑b : ℕ) = (0 : ℕ)routine: omegaLeaves
(g (↑a : ℕ)).Coprime (g (↑b : ℕ)), withhb' : (↑b : ℕ) = (0 : ℕ).Uses library
Fin.valThe number that is strictly less thann. .Lean, line 169
have hb' : b.val = 0 := by omega
coprime_odd_cycle_of_multiples.s19.s2caseLeaves
(g (↑i : ℕ)).Coprime (g (↑j : ℕ)), withh : (↑(i - j) : ℕ) = (1 : ℕ).Uses library
Nat.Coprime.symm.Lean, line 172
· exact (adjStep j i h).symm
coprime_odd_cycle_of_multiples.s19.s3caseLeaves
(g (↑i : ℕ)).Coprime (g (↑j : ℕ)), withh : (↑(j - i) : ℕ) = (1 : ℕ).Lean, line 173
· exact adjStep i j h
exists_coprime_six_of_card_gthave∀ (k : ℕ), ∀ A ⊆ Finset.Icc (1 : ℕ) ((6 : ℕ) * k + (1 : ℕ)), (4 : ℕ) * k < A.card → ∃ t ∈ A, Odd t ∧ ¬(3 : ℕ) ∣ tLeaves
∀ (k : ℕ), (3 : ℕ) ≤ k → ∀ A ⊆ Finset.Icc (1 : ℕ) ((6 : ℕ) * k + (1 : ℕ)), (4 : ℕ) * k < A.card → ∀ (l : ℕ), Odd l → (5 : ℕ) ≤ l → l ≤ (2 : ℕ) * k + (1 : ℕ) → ∃ (f : Fin l → ℕ), Function.Injective f ∧ (∀ (i : Fin l), f i ∈ A) ∧ ∀ (i j : Fin l), (SimpleGraph.cycleGraph l).Adj i j → (f i).Coprime (f j), withexists_coprime_six_of_card_gt : ∀ (k : ℕ), ∀ A ⊆ Finset.Icc (1 : ℕ) ((6 : ℕ) * k + (1 : ℕ)), (4 : ℕ) * k < A.card → ∃ t ∈ A, Odd t ∧ ¬(3 : ℕ) ∣ t.Uses library
FinsetFinset αis the type of finite sets of elements ofα. ,Finset.IccThe finset $[a, b]$ of elementsxsuch thata ≤ xandx ≤ b. ,Finset.cards.cardis the number of elements ofs, aka its cardinality. ,OddAn elementaof a semiring is odd if there existsksucha = 2*k + 1. ,FinNatural numbers less than some upper bound. ,Fin.mkCreates aFin nfromi : Natand a proof thati < n. ,Subtype.valThe value in the underlying type that satisfies the predicate. ,Fintype.card_coe,Fintype.card_fin.Lean, lines 176–207
have exists_coprime_six_of_card_gt (k : ℕ) (A : Finset ℕ) (hA : A ⊆ Finset.Icc 1 (6*k+1)) (hCard : 4*k < A.card) : ∃ t ∈ A, Odd t ∧ ¬ 3 ∣ t := by by_contra h have residue (n : ℕ) (hn : n ∈ A) : n%6 = 0 ∨ n%6 = 2 ∨ n%6 = 3 ∨ n%6 = 4 := by by_cases ho : Odd n · have hd : 3 ∣ n := by by_contra hnd exact h ⟨n, hn, ho, hnd⟩ have hodd := Nat.odd_iff.mp ho omega · have hnOdd : n%2 ≠ 1 := fun h' => ho (Nat.odd_iff.mpr h') omega let f : {n : ℕ // n ∈ A} → Fin (4*k) := fun n => ⟨2*(n.val-1)/3, by have hr := residue n.val n.property have hn := Finset.mem_Icc.mp (hA n.property) omega⟩ have hf : Function.Injective f := by intro a b hab have he := congrArg Fin.val hab change 2*(a.val-1)/3 = 2*(b.val-1)/3 at he have ha := Finset.mem_Icc.mp (hA a.property) have hb := Finset.mem_Icc.mp (hA b.property) have hra := residue a.val a.property have hrb := residue b.val b.property apply Subtype.ext omega have hbound := Fintype.card_le_of_injective f hf simp only [Fintype.card_coe, Fintype.card_fin] at hbound omegaexists_coprime_six_of_card_gt.residuehave∀ n ∈ A, n % (6 : ℕ) = (0 : ℕ) ∨ n % (6 : ℕ) = (2 : ℕ) ∨ n % (6 : ℕ) = (3 : ℕ) ∨ n % (6 : ℕ) = (4 : ℕ)Leaves
False, withresidue : ∀ n ∈ A, n % (6 : ℕ) = (0 : ℕ) ∨ n % (6 : ℕ) = (2 : ℕ) ∨ n % (6 : ℕ) = (3 : ℕ) ∨ n % (6 : ℕ) = (4 : ℕ).Uses library
OddAn elementaof a semiring is odd if there existsksucha = 2*k + 1. .Lean, lines 180–189
have residue (n : ℕ) (hn : n ∈ A) : n%6 = 0 ∨ n%6 = 2 ∨ n%6 = 3 ∨ n%6 = 4 := by by_cases ho : Odd n · have hd : 3 ∣ n := by by_contra hnd exact h ⟨n, hn, ho, hnd⟩ have hodd := Nat.odd_iff.mp ho omega · have hnOdd : n%2 ≠ 1 := fun h' => ho (Nat.odd_iff.mpr h') omegaexists_coprime_six_of_card_gt.residue.s1caseLeaves
n % (6 : ℕ) = (0 : ℕ) ∨ n % (6 : ℕ) = (2 : ℕ) ∨ n % (6 : ℕ) = (3 : ℕ) ∨ n % (6 : ℕ) = (4 : ℕ), withho : Odd n.Lean, lines 183–187
· have hd : 3 ∣ n := by by_contra hnd exact h ⟨n, hn, ho, hnd⟩ have hodd := Nat.odd_iff.mp ho omegaexists_coprime_six_of_card_gt.residue.s1.hdhave(3 : ℕ) ∣ nLeaves
n % (6 : ℕ) = (0 : ℕ) ∨ n % (6 : ℕ) = (2 : ℕ) ∨ n % (6 : ℕ) = (3 : ℕ) ∨ n % (6 : ℕ) = (4 : ℕ), withhd : (3 : ℕ) ∣ n.Uses library
Exists.introExistential introduction. .Lean, lines 183–185
· have hd : 3 ∣ n := by by_contra hnd exact h ⟨n, hn, ho, hnd⟩exists_coprime_six_of_card_gt.residue.s1.hoddhaven % (2 : ℕ) = (1 : ℕ)Leaves
n % (6 : ℕ) = (0 : ℕ) ∨ n % (6 : ℕ) = (2 : ℕ) ∨ n % (6 : ℕ) = (3 : ℕ) ∨ n % (6 : ℕ) = (4 : ℕ), withhodd : n % (2 : ℕ) = (1 : ℕ).Uses library
Nat.odd_iff,Iff.mpModus ponens for if and only if. .Lean, line 186
have hodd := Nat.odd_iff.mp ho
exists_coprime_six_of_card_gt.residue.s2caseLeaves
n % (6 : ℕ) = (0 : ℕ) ∨ n % (6 : ℕ) = (2 : ℕ) ∨ n % (6 : ℕ) = (3 : ℕ) ∨ n % (6 : ℕ) = (4 : ℕ), withho : ¬Odd n.Lean, lines 188–189
· have hnOdd : n%2 ≠ 1 := fun h' => ho (Nat.odd_iff.mpr h') omegaexists_coprime_six_of_card_gt.residue.s2.hnOddhaven % (2 : ℕ) ≠ (1 : ℕ)Leaves
n % (6 : ℕ) = (0 : ℕ) ∨ n % (6 : ℕ) = (2 : ℕ) ∨ n % (6 : ℕ) = (3 : ℕ) ∨ n % (6 : ℕ) = (4 : ℕ), withhnOdd : n % (2 : ℕ) ≠ (1 : ℕ).Uses library
Nat.odd_iff,Iff.mprModus ponens for if and only if, reversed. .Lean, line 188
· have hnOdd : n%2 ≠ 1 := fun h' => ho (Nat.odd_iff.mpr h')
exists_coprime_six_of_card_gt.hrhave(↑n : ℕ) % (6 : ℕ) = (0 : ℕ) ∨ (↑n : ℕ) % (6 : ℕ) = (2 : ℕ) ∨ (↑n : ℕ) % (6 : ℕ) = (3 : ℕ) ∨ (↑n : ℕ) % (6 : ℕ) = (4 : ℕ)Leaves
(2 : ℕ) * ((↑n : ℕ) - (1 : ℕ)) / (3 : ℕ) < (4 : ℕ) * k, withhr : (↑n : ℕ) % (6 : ℕ) = (0 : ℕ) ∨ (↑n : ℕ) % (6 : ℕ) = (2 : ℕ) ∨ (↑n : ℕ) % (6 : ℕ) = (3 : ℕ) ∨ (↑n : ℕ) % (6 : ℕ) = (4 : ℕ).Uses library
Subtype.valThe value in the underlying type that satisfies the predicate. ,Subtype.propertyThe proof thatvalsatisfies the predicatep. .Lean, line 192
have hr := residue n.val n.property
exists_coprime_six_of_card_gt.hnhave(1 : ℕ) ≤ (↑n : ℕ) ∧ (↑n : ℕ) ≤ (6 : ℕ) * k + (1 : ℕ)Leaves
(2 : ℕ) * ((↑n : ℕ) - (1 : ℕ)) / (3 : ℕ) < (4 : ℕ) * k, withhn : (1 : ℕ) ≤ (↑n : ℕ) ∧ (↑n : ℕ) ≤ (6 : ℕ) * k + (1 : ℕ).Uses library
Finset.mem_Icc,Iff.mpModus ponens for if and only if. ,Subtype.propertyThe proof thatvalsatisfies the predicatep. .Lean, line 193
have hn := Finset.mem_Icc.mp (hA n.property)
exists_coprime_six_of_card_gt.hfhaveFunction.Injective fLeaves
False, withhf : Function.Injective f.Uses library
Function.InjectiveA functionf : α → βis called injective iff x = f yimpliesx = y. ,Subtype.valThe value in the underlying type that satisfies the predicate. ,Subtype.ext.Lean, lines 195–204
have hf : Function.Injective f := by intro a b hab have he := congrArg Fin.val hab change 2*(a.val-1)/3 = 2*(b.val-1)/3 at he have ha := Finset.mem_Icc.mp (hA a.property) have hb := Finset.mem_Icc.mp (hA b.property) have hra := residue a.val a.property have hrb := residue b.val b.property apply Subtype.ext omegaexists_coprime_six_of_card_gt.hf.hehave(↑(f a) : ℕ) = (↑(f b) : ℕ)Leaves
a = b, withhe : (↑(f a) : ℕ) = (↑(f b) : ℕ).Uses library
congrArgCongruence in the function argument: ifa₁ = a₂thenf a₁ = f a₂for any (nondependent) functionf. ,Fin.valThe number that is strictly less thann. .Lean, line 197
have he := congrArg Fin.val hab
exists_coprime_six_of_card_gt.hf.hahave(1 : ℕ) ≤ (↑a : ℕ) ∧ (↑a : ℕ) ≤ (6 : ℕ) * k + (1 : ℕ)Leaves
a = b, withha : (1 : ℕ) ≤ (↑a : ℕ) ∧ (↑a : ℕ) ≤ (6 : ℕ) * k + (1 : ℕ).Uses library
Finset.mem_Icc,Iff.mpModus ponens for if and only if. ,Subtype.propertyThe proof thatvalsatisfies the predicatep. .Lean, line 199
have ha := Finset.mem_Icc.mp (hA a.property)
exists_coprime_six_of_card_gt.hf.hbhave(1 : ℕ) ≤ (↑b : ℕ) ∧ (↑b : ℕ) ≤ (6 : ℕ) * k + (1 : ℕ)Leaves
a = b, withhb : (1 : ℕ) ≤ (↑b : ℕ) ∧ (↑b : ℕ) ≤ (6 : ℕ) * k + (1 : ℕ).Uses library
Finset.mem_Icc,Iff.mpModus ponens for if and only if. ,Subtype.propertyThe proof thatvalsatisfies the predicatep. .Lean, line 200
have hb := Finset.mem_Icc.mp (hA b.property)
exists_coprime_six_of_card_gt.hf.hrahave(↑a : ℕ) % (6 : ℕ) = (0 : ℕ) ∨ (↑a : ℕ) % (6 : ℕ) = (2 : ℕ) ∨ (↑a : ℕ) % (6 : ℕ) = (3 : ℕ) ∨ (↑a : ℕ) % (6 : ℕ) = (4 : ℕ)Leaves
a = b, withhra : (↑a : ℕ) % (6 : ℕ) = (0 : ℕ) ∨ (↑a : ℕ) % (6 : ℕ) = (2 : ℕ) ∨ (↑a : ℕ) % (6 : ℕ) = (3 : ℕ) ∨ (↑a : ℕ) % (6 : ℕ) = (4 : ℕ).Uses library
Subtype.valThe value in the underlying type that satisfies the predicate. ,Subtype.propertyThe proof thatvalsatisfies the predicatep. .Lean, line 201
have hra := residue a.val a.property
exists_coprime_six_of_card_gt.hf.hrbhave(↑b : ℕ) % (6 : ℕ) = (0 : ℕ) ∨ (↑b : ℕ) % (6 : ℕ) = (2 : ℕ) ∨ (↑b : ℕ) % (6 : ℕ) = (3 : ℕ) ∨ (↑b : ℕ) % (6 : ℕ) = (4 : ℕ)Leaves
a = b, withhrb : (↑b : ℕ) % (6 : ℕ) = (0 : ℕ) ∨ (↑b : ℕ) % (6 : ℕ) = (2 : ℕ) ∨ (↑b : ℕ) % (6 : ℕ) = (3 : ℕ) ∨ (↑b : ℕ) % (6 : ℕ) = (4 : ℕ).Uses library
Subtype.valThe value in the underlying type that satisfies the predicate. ,Subtype.propertyThe proof thatvalsatisfies the predicatep. .Lean, line 202
have hrb := residue b.val b.property
exists_coprime_six_of_card_gt.hboundhaveFintype.card ↥A ≤ Fintype.card (Fin ((4 : ℕ) * k))Leaves
False, withhbound : Fintype.card ↥A ≤ Fintype.card (Fin ((4 : ℕ) * k)).Uses library
Fintype.card_le_of_injective.Lean, line 205
have hbound := Fintype.card_le_of_injective f hf
s4obtainOdd lLeaves
∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j), withs : ℕ,hLower : (5 : ℕ) ≤ (2 : ℕ) * s + (1 : ℕ),hUpper : (2 : ℕ) * s + (1 : ℕ) ≤ (2 : ℕ) * k + (1 : ℕ).Lean, line 209
obtain ⟨s, rfl⟩ := hOdd
hshave(2 : ℕ) ≤ sroutine: omegaLeaves
∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j), withhs : (2 : ℕ) ≤ s.Lean, line 210
have hs : 2 ≤ s := by omega
hskhaves ≤ kroutine: omegaLeaves
∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j), withhsk : s ≤ k.Lean, line 211
have hsk : s ≤ k := by omega
s7caseLeaves
∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j), withhBackbone : ∀ (n : ℕ), (0 : ℕ) < n → n + (3 : ℕ) ≤ (6 : ℕ) * s → Even n ∨ (3 : ℕ) ∣ n → n ∈ A.Lean, lines 213–214
· obtain ⟨t, ht, htOdd, htThree⟩ := exists_coprime_six_of_card_gt k A hA hCard exact coprime_odd_cycle_of_multiples s (by omega) A t ht htOdd htThree hBackbones7.s1obtain∃ t ∈ A, Odd t ∧ ¬(3 : ℕ) ∣ tLeaves
∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j), witht : ℕ,ht : t ∈ A,htOdd : Odd t,htThree : ¬(3 : ℕ) ∣ t.Lean, line 213
· obtain ⟨t, ht, htOdd, htThree⟩ := exists_coprime_six_of_card_gt k A hA hCard
s8caseLeaves
∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j), withhBackbone : ¬∀ (n : ℕ), (0 : ℕ) < n → n + (3 : ℕ) ≤ (6 : ℕ) * s → Even n ∨ (3 : ℕ) ∣ n → n ∈ A.Lean, lines 215–221
· have hMissing : ∃ n : ℕ, 0 < n ∧ n+3 ≤ 6*s ∧ (Even n ∨ 3 ∣ n) ∧ n ∉ A := by by_contra h apply hBackbone intro n hn₀ hn₁ hn₂ by_contra hn₃ exact h ⟨n, hn₀, hn₁, hn₂, hn₃⟩ exact h_missing_backbone k hk A hA hCard s hs hsk hMissings8.hMissinghave∃ (n : ℕ), (0 : ℕ) < n ∧ n + (3 : ℕ) ≤ (6 : ℕ) * s ∧ (Even n ∨ (3 : ℕ) ∣ n) ∧ n ∉ ALeaves
∃ (f : Fin ((2 : ℕ) * s + (1 : ℕ)) → ℕ), Function.Injective f ∧ (∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), f i ∈ A) ∧ ∀ (i j : Fin ((2 : ℕ) * s + (1 : ℕ))), (SimpleGraph.cycleGraph ((2 : ℕ) * s + (1 : ℕ))).Adj i j → (f i).Coprime (f j), withhMissing : ∃ (n : ℕ), (0 : ℕ) < n ∧ n + (3 : ℕ) ≤ (6 : ℕ) * s ∧ (Even n ∨ (3 : ℕ) ∣ n) ∧ n ∉ A.Uses library
EvenAn elementaof a typeαwith addition satisfiesEven aifa = r + r, for somer : α. ,Exists.introExistential introduction. .Lean, lines 215–220
· have hMissing : ∃ n : ℕ, 0 < n ∧ n+3 ≤ 6*s ∧ (Even n ∨ 3 ∣ n) ∧ n ∉ A := by by_contra h apply hBackbone intro n hn₀ hn₁ hn₂ by_contra hn₃ exact h ⟨n, hn₀, hn₁, hn₂, hn₃⟩
import Mathlib
import Defs.AlgebraWeylAlgebra
import Defs.AnalysisSpecialFunctionsAdditiveCharacter
import Defs.CombinatoricsSimpleGraphCircumference
import Defs.CombinatoricsSimpleGraphClique
import Defs.CombinatoricsSimpleGraphColoringVertex
import Defs.DataNatPrimeFinset
import Defs.FieldTheoryMilnorKTheory
import Defs.GroupTheoryRationalClasses
import Defs.Local
import Nodes.«erdos-883--h1--h1--h1--h1».Context
open Filter
open scoped Classical
open Erdos883
/-! Hole `h_first` of a merged partial proof, as a node (D-12 #5, D-29).
Statement generated by the gate from the assembly; immutable (D-3). -/
theorem erdos_883__h1__h1__h1__h1 : ∀ (k : ℕ),
(3 : ℕ) ≤ k →
∀ A ⊆ Finset.Icc (1 : ℕ) ((6 : ℕ) * k + (1 : ℕ)),
(4 : ℕ) * k < A.card →
∀ (l : ℕ),
Odd l →
(5 : ℕ) ≤ l →
l ≤ (2 : ℕ) * k + (1 : ℕ) →
∃ (f : Fin l → ℕ),
Function.Injective f ∧
(∀ (i : Fin l), f i ∈ A) ∧ ∀ (i j : Fin l), (SimpleGraph.cycleGraph l).Adj i j → (f i).Coprime (f j) := by
-- approach: Construct the odd cycle on the multiples of two and three, joined by one odd element not divisible by three.
-- licence: CC-BY-4.0
-- label: Sets missing an element of the arithmetic backbone
-- claim: $|A|>4k,\quad A\subseteq[1,6k+1],\quad 2\le s\le k,\quad [1,6s-3]\cap(2\mathbb{Z}\cup3\mathbb{Z})\not\subseteq A\quad\Longrightarrow\quad A\text{ contains a coprime cycle of length }2s+1.$
have h_missing_backbone : ∀ (k : ℕ), 3 ≤ k →
∀ A ⊆ Finset.Icc (1 : ℕ) (6*k+1), 4*k < A.card →
∀ (s : ℕ), 2 ≤ s → s ≤ k →
(∃ n : ℕ, 0 < n ∧ n+3 ≤ 6*s ∧ (Even n ∨ 3 ∣ n) ∧ n ∉ A) →
∃ f : Fin (2*s+1) → ℕ, Function.Injective f ∧
(∀ i, f i ∈ A) ∧
∀ i j, (SimpleGraph.cycleGraph (2*s+1)).Adj i j → (f i).Coprime (f j) := sorry
/- A set containing the multiples of two or three through 6s-3, and one
element coprime to six, contains a cyclic coprime ordering of length 2s+1. -/
have coprime_odd_cycle_of_multiples (s : ℕ) (hs : 1 ≤ s) (A : Finset ℕ) (t : ℕ)
(ht : t ∈ A) (htOdd : Odd t) (htThree : ¬ 3 ∣ t)
(hA : ∀ n : ℕ, 0 < n → n + 3 ≤ 6*s → (Even n ∨ 3 ∣ n) → n ∈ A) :
∃ f : Fin (2*s+1) → ℕ, Function.Injective f ∧
(∀ i, f i ∈ A) ∧
∀ i j, (SimpleGraph.cycleGraph (2*s+1)).Adj i j → (f i).Coprime (f j) := by
have copOne (a b : ℕ) (h : b = a + 1) : a.Coprime b := by
have hd := Nat.dvd_sub (Nat.gcd_dvd_right a b) (Nat.gcd_dvd_left a b)
rw [show b - a = 1 by omega] at hd
exact Nat.eq_one_of_dvd_one hd
have copFive (a b : ℕ) (h : b = a + 5) (ha : ¬ 5 ∣ a) : a.Coprime b := by
have hd := Nat.dvd_sub (Nat.gcd_dvd_right a b) (Nat.gcd_dvd_left a b)
rw [show b - a = 5 by omega] at hd
rcases (Nat.dvd_prime Nat.prime_five).mp hd with h1 | h5
· exact h1
· exact (ha (h5 ▸ Nat.gcd_dvd_left a b)).elim
let e (j : ℕ) : ℕ := if 5 ∣ 6*j+9 then 6*j+8 else 6*j+4
have eLower (j : ℕ) : 6*j+4 ≤ e j := by dsimp [e]; split <;> omega
have eUpper (j : ℕ) : e j ≤ 6*j+8 := by dsimp [e]; split <;> omega
have eEven (j : ℕ) : (e j) % 2 = 0 := by dsimp [e]; split <;> omega
have eCop (j : ℕ) : (6*j+3).Coprime (e j) ∧ (e j).Coprime (6*j+9) := by
by_cases hj : 5 ∣ 6*j+9
· simp only [e, if_pos hj]
exact ⟨copFive _ _ (by omega) (by omega), copOne _ _ (by omega)⟩
· simp only [e, if_neg hj]
exact ⟨copOne _ _ (by omega), copFive _ _ (by omega) (by omega)⟩
have eInject (a b : ℕ) (h : e a = e b) : a = b := by
have ha₁ := eLower a
have ha₂ := eUpper a
have hb₁ := eLower b
have hb₂ := eUpper b
omega
let g (i : ℕ) : ℕ :=
if i = 0 then t else if i = 2*s then 2
else if i % 2 = 1 then 6*(i/2)+3 else e (i/2-1)
have gZero : g 0 = t := by simp [g]
have gLast : g (2*s) = 2 := by
have h : 2*s ≠ 0 := by omega
simp [g,h]
have gOdd (j : ℕ) (hj : j < s) : g (2*j+1) = 6*j+3 := by
simp only [g,if_neg (show 2*j+1 ≠ 0 by omega),
if_neg (show 2*j+1 ≠ 2*s by omega),if_pos (show (2*j+1)%2=1 by omega)]
congr 1; omega
have gEven (j : ℕ) (hj : j+1 < s) : g (2*j+2) = e j := by
simp only [g,if_neg (show 2*j+2 ≠ 0 by omega),
if_neg (show 2*j+2 ≠ 2*s by omega),if_neg (show (2*j+2)%2≠1 by omega)]
congr 1; omega
have tOdd : t % 2 = 1 := Nat.odd_iff.mp htOdd
have tThree : t % 3 ≠ 0 := fun h => htThree (Nat.dvd_of_mod_eq_zero h)
have form (i : ℕ) (hi : i ≤ 2*s) :
(i = 0 ∧ g i = t) ∨ (i = 2*s ∧ g i = 2) ∨
(∃ j < s, i = 2*j+1 ∧ g i = 6*j+3) ∨
(∃ j, j+1 < s ∧ i = 2*j+2 ∧ g i = e j) := by
by_cases h0 : i = 0
· exact Or.inl ⟨h0, h0 ▸ gZero⟩
by_cases hLast : i = 2*s
· exact Or.inr (Or.inl ⟨hLast, hLast ▸ gLast⟩)
by_cases hiOdd : i%2 = 1
· obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+1 := ⟨i/2, by omega⟩
exact Or.inr (Or.inr (Or.inl ⟨j, by omega, rfl, gOdd j (by omega)⟩))
· obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+2 := ⟨i/2-1, by omega⟩
exact Or.inr (Or.inr (Or.inr ⟨j, by omega, rfl, gEven j (by omega)⟩))
have copStep (i : ℕ) (hi : i < 2*s) : (g i).Coprime (g (i+1)) := by
by_cases h0 : i = 0
· subst i
rw [gZero, show g (0+1) = 3 by simpa using gOdd 0 (by omega)]
exact (Nat.prime_three.coprime_iff_not_dvd.mpr htThree).symm
by_cases hLast : i+1 = 2*s
· have hi' : i = 2*(s-1)+1 := by omega
rw [hLast, gLast, hi', gOdd (s-1) (by omega)]
exact Nat.coprime_two_right.mpr (Nat.odd_iff.mpr (by omega))
by_cases hOdd : i % 2 = 1
· obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+1 := ⟨i/2, by omega⟩
rw [gOdd j (by omega), show 2*j+1+1 = 2*j+2 by omega, gEven j (by omega)]
exact (eCop j).1
· obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+2 := ⟨i/2-1, by omega⟩
rw [gEven j (by omega), show 2*j+2+1 = 2*(j+1)+1 by omega,
gOdd (j+1) (by omega)]
simpa only [show 6*(j+1)+3 = 6*j+9 by omega] using (eCop j).2
have copWrap : (g (2*s)).Coprime (g 0) := by
rw [gLast,gZero]
exact (Nat.coprime_two_right.mpr htOdd).symm
refine ⟨fun i => g i.val, ?_, ?_, ?_⟩
· intro i j hij
change g i.val = g j.val at hij
apply Fin.ext
have hi := i.isLt
have hj := j.isLt
rcases form i.val (by omega) with ⟨hi₀,hiG⟩ | ⟨hi₀,hiG⟩ |
⟨a,ha,hi₀,hiG⟩ | ⟨a,ha,hi₀,hiG⟩ <;>
rcases form j.val (by omega) with ⟨hj₀,hjG⟩ | ⟨hj₀,hjG⟩ |
⟨b,hb,hj₀,hjG⟩ | ⟨b,hb,hj₀,hjG⟩ <;>
rw [hiG,hjG] at hij
all_goals first | omega | (have h := eEven a; omega) |
(have h := eEven b; omega) | (have h := eLower a; omega) |
(have h := eLower b; omega) | (have h := eInject a b hij; omega)
· intro i
change g i.val ∈ A
have hi := i.isLt
rcases form i.val (by omega) with ⟨_, h⟩ | ⟨_, h⟩ |
⟨j,hj,_,h⟩ | ⟨j,hj,_,h⟩
· simpa only [h] using ht
· rw [h]
exact hA _ (by omega) (by omega) (Or.inl (by decide))
· rw [h]
exact hA _ (by omega) (by omega) (Or.inr (by omega))
· rw [h]
have hj₁ := eLower j
have hj₂ := eUpper j
exact hA _ (by omega) (by omega) (Or.inl (Nat.even_iff.mpr (eEven j)))
· intro i j hadj
change (g i.val).Coprime (g j.val)
have adjStep (a b : Fin (2*s+1)) (h : (b-a).val = 1) :
(g a.val).Coprime (g b.val) := by
have ha := a.isLt
have hb := b.isLt
by_cases hab : a ≤ b
· rw [Fin.sub_val_of_le hab] at h
have h' : b.val = a.val+1 := by omega
rw [h']
exact copStep a.val (by omega)
· have hab' : b < a := lt_of_not_ge hab
have hv : b.val < a.val := hab'
rw [Fin.val_sub, Nat.mod_eq_of_lt (by omega : 2*s+1-a.val+b.val < 2*s+1)] at h
have ha' : a.val = 2*s := by omega
have hb' : b.val = 0 := by omega
simpa only [ha',hb'] using copWrap
rcases SimpleGraph.cycleGraph_adj'.mp hadj with h | h
· exact (adjStep j i h).symm
· exact adjStep i j h
/- A set above the threshold contains an odd element not divisible by three. -/
have exists_coprime_six_of_card_gt (k : ℕ) (A : Finset ℕ)
(hA : A ⊆ Finset.Icc 1 (6*k+1)) (hCard : 4*k < A.card) :
∃ t ∈ A, Odd t ∧ ¬ 3 ∣ t := by
by_contra h
have residue (n : ℕ) (hn : n ∈ A) :
n%6 = 0 ∨ n%6 = 2 ∨ n%6 = 3 ∨ n%6 = 4 := by
by_cases ho : Odd n
· have hd : 3 ∣ n := by
by_contra hnd
exact h ⟨n, hn, ho, hnd⟩
have hodd := Nat.odd_iff.mp ho
omega
· have hnOdd : n%2 ≠ 1 := fun h' => ho (Nat.odd_iff.mpr h')
omega
let f : {n : ℕ // n ∈ A} → Fin (4*k) := fun n =>
⟨2*(n.val-1)/3, by
have hr := residue n.val n.property
have hn := Finset.mem_Icc.mp (hA n.property)
omega⟩
have hf : Function.Injective f := by
intro a b hab
have he := congrArg Fin.val hab
change 2*(a.val-1)/3 = 2*(b.val-1)/3 at he
have ha := Finset.mem_Icc.mp (hA a.property)
have hb := Finset.mem_Icc.mp (hA b.property)
have hra := residue a.val a.property
have hrb := residue b.val b.property
apply Subtype.ext
omega
have hbound := Fintype.card_le_of_injective f hf
simp only [Fintype.card_coe, Fintype.card_fin] at hbound
omega
intro k hk A hA hCard l hOdd hLower hUpper
obtain ⟨s, rfl⟩ := hOdd
have hs : 2 ≤ s := by omega
have hsk : s ≤ k := by omega
by_cases hBackbone : ∀ n : ℕ, 0 < n → n + 3 ≤ 6*s → (Even n ∨ 3 ∣ n) → n ∈ A
· obtain ⟨t, ht, htOdd, htThree⟩ := exists_coprime_six_of_card_gt k A hA hCard
exact coprime_odd_cycle_of_multiples s (by omega) A t ht htOdd htThree hBackbone
· have hMissing : ∃ n : ℕ, 0 < n ∧ n+3 ≤ 6*s ∧ (Even n ∨ 3 ∣ n) ∧ n ∉ A := by
by_contra h
apply hBackbone
intro n hn₀ hn₁ hn₂
by_contra hn₃
exact h ⟨n, hn₀, hn₁, hn₂, hn₃⟩
exact h_missing_backbone k hk A hA hCard s hs hsk hMissingHow to read this page
No explainer yet. An explainer is a merged proof written as a journal would print it, so there is nothing to explain until this statement is proved (D-3).