Open Proof Network

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.

unverified · history

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
  sorry
Why 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.

Split into

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 hMissing
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

Work on this statement →

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
  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 →

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.

Witness.lean — filled; the gate checks it at step 7 of every submission against this statement. Rendered from targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/Witness.lean, sha256 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.

  1. h_missing_backbone hole ∀ (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) hole

    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), with 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 : 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.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Finset.card s.card is the number of elements of s, aka its cardinality. , Even An element a of a type α with addition satisfies Even a if a = r + r, for some r : α. , Fin Natural numbers less than some upper bound. , Function.Injective A function f : α → β is called injective if f x = f y implies x = y. , SimpleGraph.cycleGraph Cycle graph over Fin n , SimpleGraph.Adj The adjacency relation of a simple graph. , Nat.Coprime m and n are coprime, or relatively prime, if their gcd is 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) := sorry

    targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 35–41 at 95be5d21dd3d ↗

  2. coprime_odd_cycle_of_multiples have ∀ (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), with coprime_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 Finset Finset α is the type of finite sets of elements of α. , Odd An element a of a semiring is odd if there exists k such a = 2*k + 1. , Even An element a of a type α with addition satisfies Even a if a = r + r, for some r : α. , Fin Natural numbers less than some upper bound. , Function.Injective A function f : α → β is called injective if f x = f y implies x = y. , SimpleGraph.cycleGraph Cycle graph over Fin n , SimpleGraph.Adj The adjacency relation of a simple graph. , Nat.Coprime m and n are coprime, or relatively prime, if their gcd is 1. , Exists.intro Existential introduction. , Fin.val The number that is strictly less than n. .

    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 h

    targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 44–173 at 95be5d21dd3d ↗

    1. coprime_odd_cycle_of_multiples.copOne have ∀ (a b : ℕ), b = a + (1 : ℕ) → a.Coprime b

      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), with copOne : ∀ (a b : ℕ), b = a + (1 : ℕ) → a.Coprime b.

      Uses library Nat.Coprime m and n are coprime, or relatively prime, if their gcd is 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 hd

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 50–53 at 95be5d21dd3d ↗

      1. coprime_odd_cycle_of_multiples.copOne.hd have a.gcd b ∣ b - a

        Leaves a.Coprime b, with hd : 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)

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 51 at 95be5d21dd3d ↗

    2. coprime_odd_cycle_of_multiples.copFive have ∀ (a b : ℕ), b = a + (5 : ℕ) → ¬(5 : ℕ) ∣ a → a.Coprime b

      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), with copFive : ∀ (a b : ℕ), b = a + (5 : ℕ) → ¬(5 : ℕ) ∣ a → a.Coprime b.

      Uses library Nat.Coprime m and n are coprime, or relatively prime, if their gcd is 1. , Nat.dvd_prime, Nat.prime_five, Iff.mp Modus 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)).elim

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 54–59 at 95be5d21dd3d ↗

      1. coprime_odd_cycle_of_multiples.copFive.hd have a.gcd b ∣ b - a

        Leaves a.Coprime b, with hd : 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)

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 55 at 95be5d21dd3d ↗

      2. coprime_odd_cycle_of_multiples.copFive.s2 case
      3. coprime_odd_cycle_of_multiples.copFive.s3 case

        Leaves a.Coprime b, with h5 : a.gcd b = (5 : ℕ).

        Uses library Nat.gcd_dvd_left, False.elim False.elim : False → C says that from False, any desired proposition C holds. .

        Lean, line 59
              · exact (ha (h5 ▸ Nat.gcd_dvd_left a b)).elim

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 59 at 95be5d21dd3d ↗

    3. coprime_odd_cycle_of_multiples.eLower have ∀ (j : ℕ), (6 : ℕ) * j + (4 : ℕ) ≤ e j

      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), with eLower : ∀ (j : ℕ), (6 : ℕ) * j + (4 : ℕ) ≤ e j.

      Lean, line 61
          have eLower (j : ℕ) : 6*j+4 ≤ e j := by dsimp [e]; split <;> omega

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 61 at 95be5d21dd3d ↗

    4. coprime_odd_cycle_of_multiples.eUpper have ∀ (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), with eUpper : ∀ (j : ℕ), e j ≤ (6 : ℕ) * j + (8 : ℕ).

      Lean, line 62
          have eUpper (j : ℕ) : e j ≤ 6*j+8 := by dsimp [e]; split <;> omega

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 62 at 95be5d21dd3d ↗

    5. coprime_odd_cycle_of_multiples.eEven have ∀ (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), with eEven : ∀ (j : ℕ), e j % (2 : ℕ) = (0 : ℕ).

      Lean, line 63
          have eEven (j : ℕ) : (e j) % 2 = 0 := by dsimp [e]; split <;> omega

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 63 at 95be5d21dd3d ↗

    6. coprime_odd_cycle_of_multiples.eCop have ∀ (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), with eCop : ∀ (j : ℕ), ((6 : ℕ) * j + (3 : ℕ)).Coprime (e j) ∧ (e j).Coprime ((6 : ℕ) * j + (9 : ℕ)).

      Uses library Nat.Coprime m and n are coprime, or relatively prime, if their gcd is 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)⟩

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 64–69 at 95be5d21dd3d ↗

      1. coprime_odd_cycle_of_multiples.eCop.s1 case

        Leaves ((6 : ℕ) * j + (3 : ℕ)).Coprime (e j) ∧ (e j).Coprime ((6 : ℕ) * j + (9 : ℕ)), with hj : (5 : ℕ) ∣ (6 : ℕ) * j + (9 : ℕ).

        Uses library if_pos, And.intro And.intro : a → b → a ∧ b is 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)⟩

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 66–67 at 95be5d21dd3d ↗

      2. coprime_odd_cycle_of_multiples.eCop.s2 case

        Leaves ((6 : ℕ) * j + (3 : ℕ)).Coprime (e j) ∧ (e j).Coprime ((6 : ℕ) * j + (9 : ℕ)), with hj : ¬(5 : ℕ) ∣ (6 : ℕ) * j + (9 : ℕ).

        Uses library if_neg, And.intro And.intro : a → b → a ∧ b is 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)⟩

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 68–69 at 95be5d21dd3d ↗

    7. coprime_odd_cycle_of_multiples.eInject have ∀ (a b : ℕ), e a = e b → a = b

      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), with eInject : ∀ (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
            omega

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 70–75 at 95be5d21dd3d ↗

      1. coprime_odd_cycle_of_multiples.eInject.ha1 have (6 : ℕ) * a + (4 : ℕ) ≤ e a

        Leaves a = b, with ha₁ : (6 : ℕ) * a + (4 : ℕ) ≤ e a.

        Lean, line 71
              have ha₁ := eLower a

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 71 at 95be5d21dd3d ↗

      2. coprime_odd_cycle_of_multiples.eInject.ha2 have e a ≤ (6 : ℕ) * a + (8 : ℕ)

        Leaves a = b, with ha₂ : e a ≤ (6 : ℕ) * a + (8 : ℕ).

        Lean, line 72
              have ha₂ := eUpper a

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 72 at 95be5d21dd3d ↗

      3. coprime_odd_cycle_of_multiples.eInject.hb1 have (6 : ℕ) * b + (4 : ℕ) ≤ e b

        Leaves a = b, with hb₁ : (6 : ℕ) * b + (4 : ℕ) ≤ e b.

        Lean, line 73
              have hb₁ := eLower b

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 73 at 95be5d21dd3d ↗

      4. coprime_odd_cycle_of_multiples.eInject.hb2 have e b ≤ (6 : ℕ) * b + (8 : ℕ)

        Leaves a = b, with hb₂ : e b ≤ (6 : ℕ) * b + (8 : ℕ).

        Lean, line 74
              have hb₂ := eUpper b

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 74 at 95be5d21dd3d ↗

    8. coprime_odd_cycle_of_multiples.gZero have g (0 : ℕ) = t routine: simp

      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), with gZero : g (0 : ℕ) = t.

      Lean, line 79
          have gZero : g 0 = t := by simp [g]

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 79 at 95be5d21dd3d ↗

    9. coprime_odd_cycle_of_multiples.gLast have g ((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), with gLast : 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]

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 80–82 at 95be5d21dd3d ↗

      1. coprime_odd_cycle_of_multiples.gLast.h have (2 : ℕ) * s ≠ (0 : ℕ) routine: omega

        Leaves g ((2 : ℕ) * s) = (2 : ℕ), with h : (2 : ℕ) * s ≠ (0 : ℕ).

        Lean, line 81
              have h : 2*s ≠ 0 := by omega

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 81 at 95be5d21dd3d ↗

    10. coprime_odd_cycle_of_multiples.gOdd have ∀ 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), with gOdd : ∀ 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; omega

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 83–86 at 95be5d21dd3d ↗

    11. coprime_odd_cycle_of_multiples.gEven have ∀ (j : ℕ), j + (1 : ℕ) < s → g ((2 : ℕ) * j + (2 : ℕ)) = e j

      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), with gEven : ∀ (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; omega

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 87–90 at 95be5d21dd3d ↗

    12. coprime_odd_cycle_of_multiples.tOdd have t % (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), with tOdd : t % (2 : ℕ) = (1 : ℕ).

      Uses library Nat.odd_iff, Iff.mp Modus ponens for if and only if. .

      Lean, line 91
          have tOdd : t % 2 = 1 := Nat.odd_iff.mp htOdd

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 91 at 95be5d21dd3d ↗

    13. coprime_odd_cycle_of_multiples.tThree have t % (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), with tThree : 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)

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 92 at 95be5d21dd3d ↗

    14. coprime_odd_cycle_of_multiples.form have ∀ 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

      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), with form : ∀ 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)⟩))

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 93–105 at 95be5d21dd3d ↗

      1. coprime_odd_cycle_of_multiples.form.s1 case

        Leaves 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, with h0 : i = (0 : ℕ).

        Uses library Or.inl Or.inl is "left injection" into an Or. , And.intro And.intro : a → b → a ∧ b is the constructor for the And operation. .

        Lean, line 98
              · exact Or.inl ⟨h0, h0 ▸ gZero⟩

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 98 at 95be5d21dd3d ↗

      2. coprime_odd_cycle_of_multiples.form.s2 case

        Leaves 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, with hLast : i = (2 : ℕ) * s.

        Uses library Or.inr Or.inr is "right injection" into an Or. , Or.inl Or.inl is "left injection" into an Or. , And.intro And.intro : a → b → a ∧ b is the constructor for the And operation. .

        Lean, line 100
              · exact Or.inr (Or.inl ⟨hLast, hLast ▸ gLast⟩)

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 100 at 95be5d21dd3d ↗

      3. coprime_odd_cycle_of_multiples.form.s3 case

        Leaves 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, with hiOdd : i % (2 : ℕ) = (1 : ℕ).

        Uses library Or.inr Or.inr is "right injection" into an Or. , Or.inl Or.inl is "left injection" into an Or. , Exists.intro Existential introduction. , rfl rfl : a = a is 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)⟩))

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 102–103 at 95be5d21dd3d ↗

        1. coprime_odd_cycle_of_multiples.form.s3.s1 obtain ∃ (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, with j : ℕ, 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.intro Existential introduction. .

          Lean, line 102
                · obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+1 := ⟨i/2, by omega⟩

          targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 102 at 95be5d21dd3d ↗

      4. coprime_odd_cycle_of_multiples.form.s4 case

        Leaves 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, with hiOdd : ¬i % (2 : ℕ) = (1 : ℕ).

        Uses library Or.inr Or.inr is "right injection" into an Or. , Exists.intro Existential introduction. , rfl rfl : a = a is 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)⟩))

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 104–105 at 95be5d21dd3d ↗

        1. coprime_odd_cycle_of_multiples.form.s4.s1 obtain ∃ (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, with j : ℕ, 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.intro Existential introduction. .

          Lean, line 104
                · obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+2 := ⟨i/2-1, by omega⟩

          targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 104 at 95be5d21dd3d ↗

    15. coprime_odd_cycle_of_multiples.copStep have ∀ 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), with copStep : ∀ i < (2 : ℕ) * s, (g i).Coprime (g (i + (1 : ℕ))).

      Uses library Nat.Coprime m and n are coprime, or relatively prime, if their gcd is 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).2

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 106–122 at 95be5d21dd3d ↗

      1. coprime_odd_cycle_of_multiples.copStep.s1 case

        Leaves (g i).Coprime (g (i + (1 : ℕ))), with h0 : i = (0 : ℕ).

        Uses library Nat.prime_three, Nat.Prime.coprime_iff_not_dvd, Iff.mpr Modus 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).symm

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 108–110 at 95be5d21dd3d ↗

      2. coprime_odd_cycle_of_multiples.copStep.s2 case

        Leaves (g i).Coprime (g (i + (1 : ℕ))), with hLast : i + (1 : ℕ) = (2 : ℕ) * s.

        Uses library Nat.coprime_two_right, Iff.mpr Modus 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))

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 112–114 at 95be5d21dd3d ↗

        1. coprime_odd_cycle_of_multiples.copStep.s2.hi' have i = (2 : ℕ) * (s - (1 : ℕ)) + (1 : ℕ) routine: omega

          Leaves (g i).Coprime (g (i + (1 : ℕ))), with hi' : i = (2 : ℕ) * (s - (1 : ℕ)) + (1 : ℕ).

          Lean, line 112
                · have hi' : i = 2*(s-1)+1 := by omega

          targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 112 at 95be5d21dd3d ↗

      3. coprime_odd_cycle_of_multiples.copStep.s3 case

        Leaves (g i).Coprime (g (i + (1 : ℕ))), with hOdd : 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).1

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 116–118 at 95be5d21dd3d ↗

        1. coprime_odd_cycle_of_multiples.copStep.s3.s1 obtain ∃ (j : ℕ), i = (2 : ℕ) * j + (1 : ℕ)

          Leaves (g ((2 : ℕ) * j + (1 : ℕ))).Coprime (g ((2 : ℕ) * j + (1 : ℕ) + (1 : ℕ))), with j : ℕ, 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.intro Existential introduction. .

          Lean, line 116
                · obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+1 := ⟨i/2, by omega⟩

          targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 116 at 95be5d21dd3d ↗

      4. coprime_odd_cycle_of_multiples.copStep.s4 case

        Leaves (g i).Coprime (g (i + (1 : ℕ))), with hOdd : ¬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).2

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 119–122 at 95be5d21dd3d ↗

        1. coprime_odd_cycle_of_multiples.copStep.s4.s1 obtain ∃ (j : ℕ), i = (2 : ℕ) * j + (2 : ℕ)

          Leaves (g ((2 : ℕ) * j + (2 : ℕ))).Coprime (g ((2 : ℕ) * j + (2 : ℕ) + (1 : ℕ))), with j : ℕ, 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.intro Existential introduction. .

          Lean, line 119
                · obtain ⟨j, rfl⟩ : ∃ j : ℕ, i = 2*j+2 := ⟨i/2-1, by omega⟩

          targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 119 at 95be5d21dd3d ↗

    16. coprime_odd_cycle_of_multiples.copWrap have (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), with copWrap : (g ((2 : ℕ) * s)).Coprime (g (0 : ℕ)).

      Uses library Nat.Coprime m and n are coprime, or relatively prime, if their gcd is 1. , Nat.coprime_two_right, Iff.mpr Modus 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).symm

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 123–125 at 95be5d21dd3d ↗

    17. coprime_odd_cycle_of_multiples.s17 case

      Leaves Function.Injective fun (i : Fin ((2 : ℕ) * s + (1 : ℕ))) => g (↑i : ℕ).

      Uses library Fin.val The number that is strictly less than n. , 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)

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 127–139 at 95be5d21dd3d ↗

      1. coprime_odd_cycle_of_multiples.s17.hi have (↑i : ℕ) < (2 : ℕ) * s + (1 : ℕ)

        Leaves (↑i : ℕ) = (↑j : ℕ), with hi : (↑i : ℕ) < (2 : ℕ) * s + (1 : ℕ).

        Uses library Fin.isLt The number val is strictly less than the bound n. .

        Lean, line 130
              have hi := i.isLt

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 130 at 95be5d21dd3d ↗

      2. coprime_odd_cycle_of_multiples.s17.hj have (↑j : ℕ) < (2 : ℕ) * s + (1 : ℕ)

        Leaves (↑i : ℕ) = (↑j : ℕ), with hj : (↑j : ℕ) < (2 : ℕ) * s + (1 : ℕ).

        Uses library Fin.isLt The number val is strictly less than the bound n. .

        Lean, line 131
              have hj := j.isLt

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 131 at 95be5d21dd3d ↗

      3. coprime_odd_cycle_of_multiples.s17.s3 have

        Leaves (↑i : ℕ) = (↑j : ℕ).

        Lean, line 137
              all_goals first | omega | (have h := eEven a; omega) |

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 137 at 95be5d21dd3d ↗

      4. coprime_odd_cycle_of_multiples.s17.s4 have e b % (2 : ℕ) = (0 : ℕ)

        Leaves (↑i : ℕ) = (↑j : ℕ), with h : e b % (2 : ℕ) = (0 : ℕ).

        Lean, line 138
                (have h := eEven b; omega) | (have h := eLower a; omega) |

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 138 at 95be5d21dd3d ↗

      5. coprime_odd_cycle_of_multiples.s17.s5 have

        Leaves (↑i : ℕ) = (↑j : ℕ).

        Lean, line 138
                (have h := eEven b; omega) | (have h := eLower a; omega) |

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 138 at 95be5d21dd3d ↗

      6. coprime_odd_cycle_of_multiples.s17.s6 have (6 : ℕ) * b + (4 : ℕ) ≤ e b

        Leaves (↑i : ℕ) = (↑j : ℕ), with h : (6 : ℕ) * b + (4 : ℕ) ≤ e b.

        Lean, line 139
                (have h := eLower b; omega) | (have h := eInject a b hij; omega)

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 139 at 95be5d21dd3d ↗

      7. coprime_odd_cycle_of_multiples.s17.s7 have a = b

        Leaves (↑i : ℕ) = (↑j : ℕ), with h : a = b.

        Lean, line 139
                (have h := eLower b; omega) | (have h := eInject a b hij; omega)

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 139 at 95be5d21dd3d ↗

    18. coprime_odd_cycle_of_multiples.s18 case

      Leaves ∀ (i : Fin ((2 : ℕ) * s + (1 : ℕ))), (fun (i : Fin ((2 : ℕ) * s + (1 : ℕ))) => g (↑i : ℕ)) i ∈ A.

      Uses library Fin.val The number that is strictly less than n. .

      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)))

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 140–153 at 95be5d21dd3d ↗

      1. coprime_odd_cycle_of_multiples.s18.hi have (↑i : ℕ) < (2 : ℕ) * s + (1 : ℕ)

        Leaves g (↑i : ℕ) ∈ A, with hi : (↑i : ℕ) < (2 : ℕ) * s + (1 : ℕ).

        Uses library Fin.isLt The number val is strictly less than the bound n. .

        Lean, line 142
              have hi := i.isLt

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 142 at 95be5d21dd3d ↗

      2. coprime_odd_cycle_of_multiples.s18.s2 case

        Leaves g (↑i : ℕ) ∈ A, with left✝ : (↑i : ℕ) = (0 : ℕ), h : g (↑i : ℕ) = t.

        Lean, line 145
              · simpa only [h] using ht

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 145 at 95be5d21dd3d ↗

      3. coprime_odd_cycle_of_multiples.s18.s3 case

        Leaves g (↑i : ℕ) ∈ A, with left✝ : (↑i : ℕ) = (2 : ℕ) * s, h : g (↑i : ℕ) = (2 : ℕ).

        Uses library Or.inl Or.inl is "left injection" into an Or. .

        Lean, lines 146–147
              · rw [h]
                exact hA _ (by omega) (by omega) (Or.inl (by decide))

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 146–147 at 95be5d21dd3d ↗

      4. coprime_odd_cycle_of_multiples.s18.s4 case

        Leaves g (↑i : ℕ) ∈ A, with j : ℕ, hj : j < s, left✝ : (↑i : ℕ) = (2 : ℕ) * j + (1 : ℕ), h : g (↑i : ℕ) = (6 : ℕ) * j + (3 : ℕ).

        Uses library Or.inr Or.inr is "right injection" into an Or. .

        Lean, lines 148–149
              · rw [h]
                exact hA _ (by omega) (by omega) (Or.inr (by omega))

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 148–149 at 95be5d21dd3d ↗

      5. coprime_odd_cycle_of_multiples.s18.s5 case

        Leaves g (↑i : ℕ) ∈ A, with j : ℕ, hj : j + (1 : ℕ) < s, left✝ : (↑i : ℕ) = (2 : ℕ) * j + (2 : ℕ), h : g (↑i : ℕ) = e j.

        Uses library Or.inl Or.inl is "left injection" into an Or. , Nat.even_iff, Iff.mpr Modus 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)))

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 150–153 at 95be5d21dd3d ↗

        1. coprime_odd_cycle_of_multiples.s18.s5.hj1 have (6 : ℕ) * j + (4 : ℕ) ≤ e j

          Leaves e j ∈ A, with hj₁ : (6 : ℕ) * j + (4 : ℕ) ≤ e j.

          Lean, line 151
                  have hj₁ := eLower j

          targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 151 at 95be5d21dd3d ↗

        2. coprime_odd_cycle_of_multiples.s18.s5.hj2 have e j ≤ (6 : ℕ) * j + (8 : ℕ)

          Leaves e j ∈ A, with hj₂ : e j ≤ (6 : ℕ) * j + (8 : ℕ).

          Lean, line 152
                  have hj₂ := eUpper j

          targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 152 at 95be5d21dd3d ↗

    19. coprime_odd_cycle_of_multiples.s19 case

      Leaves ∀ (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.val The number that is strictly less than n. , Nat.Coprime m and n are coprime, or relatively prime, if their gcd is 1. , SimpleGraph.cycleGraph_adj', Iff.mp Modus 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 h

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 154–173 at 95be5d21dd3d ↗

      1. coprime_odd_cycle_of_multiples.s19.adjStep have ∀ (a b : Fin ((2 : ℕ) * s + (1 : ℕ))), (↑(b - a) : ℕ) = (1 : ℕ) → (g (↑a : ℕ)).Coprime (g (↑b : ℕ))

        Leaves (g (↑i : ℕ)).Coprime (g (↑j : ℕ)), with adjStep : ∀ (a b : Fin ((2 : ℕ) * s + (1 : ℕ))), (↑(b - a) : ℕ) = (1 : ℕ) → (g (↑a : ℕ)).Coprime (g (↑b : ℕ)).

        Uses library Fin Natural numbers less than some upper bound. , Fin.val The number that is strictly less than n. , Nat.Coprime m and n are coprime, or relatively prime, if their gcd is 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 copWrap

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 156–170 at 95be5d21dd3d ↗

        1. coprime_odd_cycle_of_multiples.s19.adjStep.ha have (↑a : ℕ) < (2 : ℕ) * s + (1 : ℕ)

          Leaves (g (↑a : ℕ)).Coprime (g (↑b : ℕ)), with ha : (↑a : ℕ) < (2 : ℕ) * s + (1 : ℕ).

          Uses library Fin.isLt The number val is strictly less than the bound n. .

          Lean, line 158
                  have ha := a.isLt

          targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 158 at 95be5d21dd3d ↗

        2. coprime_odd_cycle_of_multiples.s19.adjStep.hb have (↑b : ℕ) < (2 : ℕ) * s + (1 : ℕ)

          Leaves (g (↑a : ℕ)).Coprime (g (↑b : ℕ)), with hb : (↑b : ℕ) < (2 : ℕ) * s + (1 : ℕ).

          Uses library Fin.isLt The number val is strictly less than the bound n. .

          Lean, line 159
                  have hb := b.isLt

          targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 159 at 95be5d21dd3d ↗

        3. coprime_odd_cycle_of_multiples.s19.adjStep.s3 case

          Leaves (g (↑a : ℕ)).Coprime (g (↑b : ℕ)), with hab : a ≤ b.

          Uses library Fin.sub_val_of_le, Fin.val The number that is strictly less than n. .

          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)

          targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 161–164 at 95be5d21dd3d ↗

          1. coprime_odd_cycle_of_multiples.s19.adjStep.s3.h' have (↑b : ℕ) = (↑a : ℕ) + (1 : ℕ) routine: omega

            Leaves (g (↑a : ℕ)).Coprime (g (↑b : ℕ)), with h' : (↑b : ℕ) = (↑a : ℕ) + (1 : ℕ).

            Uses library Fin.val The number that is strictly less than n. .

            Lean, line 162
                      have h' : b.val = a.val+1 := by omega

            targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 162 at 95be5d21dd3d ↗

        4. coprime_odd_cycle_of_multiples.s19.adjStep.s4 case

          Leaves (g (↑a : ℕ)).Coprime (g (↑b : ℕ)), with hab : ¬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 copWrap

          targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 165–170 at 95be5d21dd3d ↗

          1. coprime_odd_cycle_of_multiples.s19.adjStep.s4.hab' have b < a

            Leaves (g (↑a : ℕ)).Coprime (g (↑b : ℕ)), with hab' : b < a.

            Uses library lt_of_not_ge.

            Lean, line 165
                    · have hab' : b < a := lt_of_not_ge hab

            targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 165 at 95be5d21dd3d ↗

          2. coprime_odd_cycle_of_multiples.s19.adjStep.s4.hv have (↑b : ℕ) < (↑a : ℕ)

            Leaves (g (↑a : ℕ)).Coprime (g (↑b : ℕ)), with hv : (↑b : ℕ) < (↑a : ℕ).

            Uses library Fin.val The number that is strictly less than n. .

            Lean, line 166
                      have hv : b.val < a.val := hab'

            targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 166 at 95be5d21dd3d ↗

          3. coprime_odd_cycle_of_multiples.s19.adjStep.s4.ha' have (↑a : ℕ) = (2 : ℕ) * s routine: omega

            Leaves (g (↑a : ℕ)).Coprime (g (↑b : ℕ)), with ha' : (↑a : ℕ) = (2 : ℕ) * s.

            Uses library Fin.val The number that is strictly less than n. .

            Lean, line 168
                      have ha' : a.val = 2*s := by omega

            targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 168 at 95be5d21dd3d ↗

          4. coprime_odd_cycle_of_multiples.s19.adjStep.s4.hb' have (↑b : ℕ) = (0 : ℕ) routine: omega

            Leaves (g (↑a : ℕ)).Coprime (g (↑b : ℕ)), with hb' : (↑b : ℕ) = (0 : ℕ).

            Uses library Fin.val The number that is strictly less than n. .

            Lean, line 169
                      have hb' : b.val = 0 := by omega

            targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 169 at 95be5d21dd3d ↗

      2. coprime_odd_cycle_of_multiples.s19.s2 case

        Leaves (g (↑i : ℕ)).Coprime (g (↑j : ℕ)), with h : (↑(i - j) : ℕ) = (1 : ℕ).

        Uses library Nat.Coprime.symm.

        Lean, line 172
              · exact (adjStep j i h).symm

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 172 at 95be5d21dd3d ↗

      3. coprime_odd_cycle_of_multiples.s19.s3 case

        Leaves (g (↑i : ℕ)).Coprime (g (↑j : ℕ)), with h : (↑(j - i) : ℕ) = (1 : ℕ).

        Lean, line 173
              · exact adjStep i j h

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 173 at 95be5d21dd3d ↗

  3. exists_coprime_six_of_card_gt have ∀ (k : ℕ), ∀ A ⊆ Finset.Icc (1 : ℕ) ((6 : ℕ) * k + (1 : ℕ)), (4 : ℕ) * k < A.card → ∃ t ∈ A, Odd t ∧ ¬(3 : ℕ) ∣ t

    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), with exists_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 Finset Finset α is the type of finite sets of elements of α. , Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Finset.card s.card is the number of elements of s, aka its cardinality. , Odd An element a of a semiring is odd if there exists k such a = 2*k + 1. , Fin Natural numbers less than some upper bound. , Fin.mk Creates a Fin n from i : Nat and a proof that i < n. , Subtype.val The 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
        omega

    targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 176–207 at 95be5d21dd3d ↗

    1. exists_coprime_six_of_card_gt.residue have ∀ n ∈ A, n % (6 : ℕ) = (0 : ℕ) ∨ n % (6 : ℕ) = (2 : ℕ) ∨ n % (6 : ℕ) = (3 : ℕ) ∨ n % (6 : ℕ) = (4 : ℕ)

      Leaves False, with residue : ∀ n ∈ A, n % (6 : ℕ) = (0 : ℕ) ∨ n % (6 : ℕ) = (2 : ℕ) ∨ n % (6 : ℕ) = (3 : ℕ) ∨ n % (6 : ℕ) = (4 : ℕ).

      Uses library Odd An element a of a semiring is odd if there exists k such a = 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')
              omega

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 180–189 at 95be5d21dd3d ↗

      1. exists_coprime_six_of_card_gt.residue.s1 case

        Leaves n % (6 : ℕ) = (0 : ℕ) ∨ n % (6 : ℕ) = (2 : ℕ) ∨ n % (6 : ℕ) = (3 : ℕ) ∨ n % (6 : ℕ) = (4 : ℕ), with ho : 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
                omega

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 183–187 at 95be5d21dd3d ↗

        1. exists_coprime_six_of_card_gt.residue.s1.hd have (3 : ℕ) ∣ n

          Leaves n % (6 : ℕ) = (0 : ℕ) ∨ n % (6 : ℕ) = (2 : ℕ) ∨ n % (6 : ℕ) = (3 : ℕ) ∨ n % (6 : ℕ) = (4 : ℕ), with hd : (3 : ℕ) ∣ n.

          Uses library Exists.intro Existential introduction. .

          Lean, lines 183–185
                · have hd : 3 ∣ n := by
                    by_contra hnd
                    exact h ⟨n, hn, ho, hnd⟩

          targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 183–185 at 95be5d21dd3d ↗

        2. exists_coprime_six_of_card_gt.residue.s1.hodd have n % (2 : ℕ) = (1 : ℕ)

          Leaves n % (6 : ℕ) = (0 : ℕ) ∨ n % (6 : ℕ) = (2 : ℕ) ∨ n % (6 : ℕ) = (3 : ℕ) ∨ n % (6 : ℕ) = (4 : ℕ), with hodd : n % (2 : ℕ) = (1 : ℕ).

          Uses library Nat.odd_iff, Iff.mp Modus ponens for if and only if. .

          Lean, line 186
                  have hodd := Nat.odd_iff.mp ho

          targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 186 at 95be5d21dd3d ↗

      2. exists_coprime_six_of_card_gt.residue.s2 case

        Leaves n % (6 : ℕ) = (0 : ℕ) ∨ n % (6 : ℕ) = (2 : ℕ) ∨ n % (6 : ℕ) = (3 : ℕ) ∨ n % (6 : ℕ) = (4 : ℕ), with ho : ¬Odd n.

        Lean, lines 188–189
              · have hnOdd : n%2 ≠ 1 := fun h' => ho (Nat.odd_iff.mpr h')
                omega

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 188–189 at 95be5d21dd3d ↗

        1. exists_coprime_six_of_card_gt.residue.s2.hnOdd have n % (2 : ℕ) ≠ (1 : ℕ)

          Leaves n % (6 : ℕ) = (0 : ℕ) ∨ n % (6 : ℕ) = (2 : ℕ) ∨ n % (6 : ℕ) = (3 : ℕ) ∨ n % (6 : ℕ) = (4 : ℕ), with hnOdd : n % (2 : ℕ) ≠ (1 : ℕ).

          Uses library Nat.odd_iff, Iff.mpr Modus ponens for if and only if, reversed. .

          Lean, line 188
                · have hnOdd : n%2 ≠ 1 := fun h' => ho (Nat.odd_iff.mpr h')

          targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 188 at 95be5d21dd3d ↗

    2. exists_coprime_six_of_card_gt.hr have (↑n : ℕ) % (6 : ℕ) = (0 : ℕ) ∨ (↑n : ℕ) % (6 : ℕ) = (2 : ℕ) ∨ (↑n : ℕ) % (6 : ℕ) = (3 : ℕ) ∨ (↑n : ℕ) % (6 : ℕ) = (4 : ℕ)

      Leaves (2 : ℕ) * ((↑n : ℕ) - (1 : ℕ)) / (3 : ℕ) < (4 : ℕ) * k, with hr : (↑n : ℕ) % (6 : ℕ) = (0 : ℕ) ∨ (↑n : ℕ) % (6 : ℕ) = (2 : ℕ) ∨ (↑n : ℕ) % (6 : ℕ) = (3 : ℕ) ∨ (↑n : ℕ) % (6 : ℕ) = (4 : ℕ).

      Uses library Subtype.val The value in the underlying type that satisfies the predicate. , Subtype.property The proof that val satisfies the predicate p. .

      Lean, line 192
              have hr := residue n.val n.property

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 192 at 95be5d21dd3d ↗

    3. exists_coprime_six_of_card_gt.hn have (1 : ℕ) ≤ (↑n : ℕ) ∧ (↑n : ℕ) ≤ (6 : ℕ) * k + (1 : ℕ)

      Leaves (2 : ℕ) * ((↑n : ℕ) - (1 : ℕ)) / (3 : ℕ) < (4 : ℕ) * k, with hn : (1 : ℕ) ≤ (↑n : ℕ) ∧ (↑n : ℕ) ≤ (6 : ℕ) * k + (1 : ℕ).

      Uses library Finset.mem_Icc, Iff.mp Modus ponens for if and only if. , Subtype.property The proof that val satisfies the predicate p. .

      Lean, line 193
              have hn := Finset.mem_Icc.mp (hA n.property)

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 193 at 95be5d21dd3d ↗

    4. exists_coprime_six_of_card_gt.hf have Function.Injective f

      Leaves False, with hf : Function.Injective f.

      Uses library Function.Injective A function f : α → β is called injective if f x = f y implies x = y. , Subtype.val The 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
            omega

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 195–204 at 95be5d21dd3d ↗

      1. exists_coprime_six_of_card_gt.hf.he have (↑(f a) : ℕ) = (↑(f b) : ℕ)

        Leaves a = b, with he : (↑(f a) : ℕ) = (↑(f b) : ℕ).

        Uses library congrArg Congruence in the function argument: if a₁ = a₂ then f a₁ = f a₂ for any (nondependent) function f. , Fin.val The number that is strictly less than n. .

        Lean, line 197
              have he := congrArg Fin.val hab

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 197 at 95be5d21dd3d ↗

      2. exists_coprime_six_of_card_gt.hf.ha have (1 : ℕ) ≤ (↑a : ℕ) ∧ (↑a : ℕ) ≤ (6 : ℕ) * k + (1 : ℕ)

        Leaves a = b, with ha : (1 : ℕ) ≤ (↑a : ℕ) ∧ (↑a : ℕ) ≤ (6 : ℕ) * k + (1 : ℕ).

        Uses library Finset.mem_Icc, Iff.mp Modus ponens for if and only if. , Subtype.property The proof that val satisfies the predicate p. .

        Lean, line 199
              have ha := Finset.mem_Icc.mp (hA a.property)

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 199 at 95be5d21dd3d ↗

      3. exists_coprime_six_of_card_gt.hf.hb have (1 : ℕ) ≤ (↑b : ℕ) ∧ (↑b : ℕ) ≤ (6 : ℕ) * k + (1 : ℕ)

        Leaves a = b, with hb : (1 : ℕ) ≤ (↑b : ℕ) ∧ (↑b : ℕ) ≤ (6 : ℕ) * k + (1 : ℕ).

        Uses library Finset.mem_Icc, Iff.mp Modus ponens for if and only if. , Subtype.property The proof that val satisfies the predicate p. .

        Lean, line 200
              have hb := Finset.mem_Icc.mp (hA b.property)

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 200 at 95be5d21dd3d ↗

      4. exists_coprime_six_of_card_gt.hf.hra have (↑a : ℕ) % (6 : ℕ) = (0 : ℕ) ∨ (↑a : ℕ) % (6 : ℕ) = (2 : ℕ) ∨ (↑a : ℕ) % (6 : ℕ) = (3 : ℕ) ∨ (↑a : ℕ) % (6 : ℕ) = (4 : ℕ)

        Leaves a = b, with hra : (↑a : ℕ) % (6 : ℕ) = (0 : ℕ) ∨ (↑a : ℕ) % (6 : ℕ) = (2 : ℕ) ∨ (↑a : ℕ) % (6 : ℕ) = (3 : ℕ) ∨ (↑a : ℕ) % (6 : ℕ) = (4 : ℕ).

        Uses library Subtype.val The value in the underlying type that satisfies the predicate. , Subtype.property The proof that val satisfies the predicate p. .

        Lean, line 201
              have hra := residue a.val a.property

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 201 at 95be5d21dd3d ↗

      5. exists_coprime_six_of_card_gt.hf.hrb have (↑b : ℕ) % (6 : ℕ) = (0 : ℕ) ∨ (↑b : ℕ) % (6 : ℕ) = (2 : ℕ) ∨ (↑b : ℕ) % (6 : ℕ) = (3 : ℕ) ∨ (↑b : ℕ) % (6 : ℕ) = (4 : ℕ)

        Leaves a = b, with hrb : (↑b : ℕ) % (6 : ℕ) = (0 : ℕ) ∨ (↑b : ℕ) % (6 : ℕ) = (2 : ℕ) ∨ (↑b : ℕ) % (6 : ℕ) = (3 : ℕ) ∨ (↑b : ℕ) % (6 : ℕ) = (4 : ℕ).

        Uses library Subtype.val The value in the underlying type that satisfies the predicate. , Subtype.property The proof that val satisfies the predicate p. .

        Lean, line 202
              have hrb := residue b.val b.property

        targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 202 at 95be5d21dd3d ↗

    5. exists_coprime_six_of_card_gt.hbound have Fintype.card ↥A ≤ Fintype.card (Fin ((4 : ℕ) * k))

      Leaves False, with hbound : 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

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 205 at 95be5d21dd3d ↗

  4. s4 obtain Odd l

    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), with s : ℕ, hLower : (5 : ℕ) ≤ (2 : ℕ) * s + (1 : ℕ), hUpper : (2 : ℕ) * s + (1 : ℕ) ≤ (2 : ℕ) * k + (1 : ℕ).

    Lean, line 209
      obtain ⟨s, rfl⟩ := hOdd

    targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 209 at 95be5d21dd3d ↗

  5. hs have (2 : ℕ) ≤ s routine: omega

    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), with hs : (2 : ℕ) ≤ s.

    Lean, line 210
      have hs : 2 ≤ s := by omega

    targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 210 at 95be5d21dd3d ↗

  6. hsk have s ≤ k routine: omega

    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), with hsk : s ≤ k.

    Lean, line 211
      have hsk : s ≤ k := by omega

    targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 211 at 95be5d21dd3d ↗

  7. s7 case

    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), with hBackbone : ∀ (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 hBackbone

    targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 213–214 at 95be5d21dd3d ↗

    1. s7.s1 obtain ∃ t ∈ A, Odd t ∧ ¬(3 : ℕ) ∣ t

      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), with t : ℕ, 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

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, line 213 at 95be5d21dd3d ↗

  8. s8 case

    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), with hBackbone : ¬∀ (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 hMissing

    targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 215–221 at 95be5d21dd3d ↗

    1. s8.hMissing have ∃ (n : ℕ), (0 : ℕ) < n ∧ n + (3 : ℕ) ≤ (6 : ℕ) * s ∧ (Even n ∨ (3 : ℕ) ∣ n) ∧ n ∉ A

      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), with hMissing : ∃ (n : ℕ), (0 : ℕ) < n ∧ n + (3 : ℕ) ≤ (6 : ℕ) * s ∧ (Even n ∨ (3 : ℕ) ∣ n) ∧ n ∉ A.

      Uses library Even An element a of a type α with addition satisfies Even a if a = r + r, for some r : α. , Exists.intro Existential 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₃⟩

      targets/erdos-883/nodes/erdos-883--h1--h1--h1--h1/attempts/20261203T063856Z-augustuswindsor-partial.lean, lines 215–220 at 95be5d21dd3d ↗

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 hMissing
How 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).

How to read a statement’s page →