import Mathlib /-! # Disjoint Golomb Rulers (DGR): Core Theory & Complete Resolution for `J = 3` This file formalizes the core definitions and foundational theorems for **Disjoint Golomb Rulers** (Xiu, Fan, & Liang, arXiv:1405.4535 [2014]; Xu, Xiu, Fan, & Liang, arXiv:2409.14409 [2024]), generalizing the Komlós–Sulyok–Szemerédi (1975) conjecture from `I = 1` to arbitrary `I ≥ 1`. ## Main Results 1. Core invariants: affine invariance (`isGolombRuler_affine`, `hasDGR_affine`), reversal invariance, monotonicity, disjoint union composition, and exact linear-equation characterizations for `J = 3` (`isGolombRuler_triple_iff`) and `J = 4` (`isGolombRuler_quad_iff`). 2. Complete exact determination of `H(I, 3)` for all `I ≥ 1`: - `H(1, 3) = 4` (`isHVal_1_3`, `sInf_dgr_1_3`), - `H(I, 3) = 3 * I` for all `I ≥ 2` (`isHVal_J3_ge_two`, `sInf_dgr_J3_ge_two`). 3. Complete resolution of the Main Open Conjecture of Xiu–Fan–Liang (2014) and Xu–Xiu–Fan–Liang (2024) for `J = 3` and **all** `I ≥ 1`: - `dgr_I1_J3`: every 4-element subset of `ℤ` contains a 3-Golomb ruler. - `dgr_I2_J3`: every 6-element subset of `ℤ` contains 2 disjoint 3-Golomb rulers. - `dgr_J3_ge_two`: every `(3 * I)`-element subset of `ℤ` (`I ≥ 2`) contains `I` pairwise disjoint 3-Golomb rulers. - `dgr_conjecture_J3`: unified statement for all `I ≥ 1` and `|A| = H(I, 3)`. -/ namespace DGR /-- A finite set `R ⊆ ℤ` is a **Golomb ruler** (finite Sidon set) if all positive pairwise differences `b - a` (`a < b` in `R`) are distinct. -/ def IsGolombRuler (R : Finset ℤ) : Prop := ∀ a ∈ R, ∀ b ∈ R, ∀ c ∈ R, ∀ d ∈ R, a < b → c < d → b - a = d - c → a = c ∧ b = d /-- `HasDGR A I J` holds if `A ⊆ ℤ` contains `I` pairwise disjoint `J`-Golomb rulers. -/ def HasDGR (A : Finset ℤ) (I J : ℕ) : Prop := ∃ R : Fin I → Finset ℤ, (∀ i, R i ⊆ A) ∧ (∀ i, (R i).card = J) ∧ (∀ i, IsGolombRuler (R i)) ∧ Pairwise (fun i j => Disjoint (R i) (R j)) /-- Existence of an `(I, J, n)`-DGR inside `{1, 2, ..., n}`. -/ def IsDGRInterval (I J n : ℕ) : Prop := HasDGR (Finset.Icc (1 : ℤ) (n : ℤ)) I J /-- Relational specification of `H(I, J) = n`: the least positive/natural `n` for which `{1, ..., n}` contains `I` pairwise disjoint `J`-Golomb rulers. -/ def IsHVal (I J n : ℕ) : Prop := IsDGRInterval I J n ∧ ∀ m < n, ¬ IsDGRInterval I J m /-- Closed-form value of `H(I, 3)` for `I ≥ 1`. -/ def H3 (I : ℕ) : ℕ := if I = 1 then 4 else 3 * I /-! ### Section 1: Basic Properties & Invariances -/ theorem isGolombRuler_iff_sidon (R : Finset ℤ) : IsGolombRuler R ↔ ∀ a ∈ R, ∀ b ∈ R, ∀ c ∈ R, ∀ d ∈ R, a + b = c + d → (a = c ∧ b = d) ∨ (a = d ∧ b = c) := by constructor · intro h a ha b hb c hc d hd hsum by_cases hab : a = b · subst hab by_cases hcd : c = d · subst hcd; left; omega · exfalso rcases lt_or_gt_of_ne hcd with hlt | hgt · have hca : c < a := by omega have had : a < d := by omega have := h c hc a ha a ha d hd hca had (by omega) omega · have hda : d < a := by omega have hac : a < c := by omega have := h d hd a ha a ha c hc hda hac (by omega) omega · by_cases hac : a = c · left; omega · by_cases had : a = d · right; omega · exfalso rcases lt_or_gt_of_ne hac with hlt | hgt · have hdb : d < b := by omega have := h a ha c hc d hd b hb hlt hdb (by omega) exact had this.1 · have hbd : b < d := by omega have := h c hc a ha b hb d hd hgt hbd (by omega) omega · intro h a ha b hb c hc d hd hab hcd hdiff have hsum : b + c = a + d := by omega rcases h b hb c hc a ha d hd hsum with ⟨h1, h2⟩ | ⟨h1, h2⟩ · omega · exact ⟨h2.symm, h1⟩ theorem isGolombRuler_subset {R S : Finset ℤ} (hRS : R ⊆ S) (hS : IsGolombRuler S) : IsGolombRuler R := by intro a ha b hb c hc d hd hab hcd hdiff exact hS a (hRS ha) b (hRS hb) c (hRS hc) d (hRS hd) hab hcd hdiff theorem isGolombRuler_empty : IsGolombRuler ∅ := by intro a ha; simp at ha theorem isGolombRuler_affine {R : Finset ℤ} (hR : IsGolombRuler R) {c b : ℤ} (hc : c ≠ 0) : IsGolombRuler (R.image (fun x => c * x + b)) := by rw [isGolombRuler_iff_sidon] at hR ⊢ intro x₁ hx₁ x₂ hx₂ x₃ hx₃ x₄ hx₄ hsum rcases Finset.mem_image.mp hx₁ with ⟨a₁, ha₁, rfl⟩ rcases Finset.mem_image.mp hx₂ with ⟨a₂, ha₂, rfl⟩ rcases Finset.mem_image.mp hx₃ with ⟨a₃, ha₃, rfl⟩ rcases Finset.mem_image.mp hx₄ with ⟨a₄, ha₄, rfl⟩ have hmul : c * (a₁ + a₂) = c * (a₃ + a₄) := by linarith have hadd : a₁ + a₂ = a₃ + a₄ := mul_left_cancel₀ hc hmul rcases hR a₁ ha₁ a₂ ha₂ a₃ ha₃ a₄ ha₄ hadd with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ · left; exact ⟨rfl, rfl⟩ · right; exact ⟨rfl, rfl⟩ theorem isGolombRuler_neg {R : Finset ℤ} (hR : IsGolombRuler R) : IsGolombRuler (R.image (fun x => -x)) := by have h := isGolombRuler_affine hR (c := -1) (b := 0) (by decide) convert h using 2 ext x; ring theorem isGolombRuler_translate {R : Finset ℤ} (hR : IsGolombRuler R) (t : ℤ) : IsGolombRuler (R.image (fun x => x + t)) := by have h := isGolombRuler_affine hR (c := 1) (b := t) (by decide) convert h using 2 ext x; ring theorem hasDGR_mono {A B : Finset ℤ} {I J : ℕ} (hAB : A ⊆ B) (h : HasDGR A I J) : HasDGR B I J := by rcases h with ⟨R, hsub, hcard, hgr, hdisj⟩ exact ⟨R, fun i => (hsub i).trans hAB, hcard, hgr, hdisj⟩ theorem hasDGR_affine {A : Finset ℤ} {I J : ℕ} (h : HasDGR A I J) {c b : ℤ} (hc : c ≠ 0) : HasDGR (A.image (fun x => c * x + b)) I J := by rcases h with ⟨R, hsub, hcard, hgr, hdisj⟩ have hinj : Function.Injective (fun x : ℤ => c * x + b) := by intro x y hxy have : c * x = c * y := by linarith exact mul_left_cancel₀ hc this refine ⟨fun i => (R i).image (fun x => c * x + b), ?_, ?_, ?_, ?_⟩ · intro i; exact Finset.image_subset_image (hsub i) · intro i; rw [Finset.card_image_of_injective _ hinj, hcard i] · intro i; exact isGolombRuler_affine (hgr i) hc · intro i j hij rw [Finset.disjoint_left] intro y hyi hyj rcases Finset.mem_image.mp hyi with ⟨x₁, hx₁, rfl⟩ rcases Finset.mem_image.mp hyj with ⟨x₂, hx₂, heq⟩ have hx : x₁ = x₂ := hinj heq.symm subst hx exact Finset.disjoint_left.mp (hdisj hij) hx₁ hx₂ theorem hasDGR_translate {A : Finset ℤ} {I J : ℕ} (h : HasDGR A I J) (t : ℤ) : HasDGR (A.image (fun x => x + t)) I J := by have h' := hasDGR_affine h (c := 1) (b := t) (by decide) convert h' using 2 ext x; ring theorem hasDGR_zero (A : Finset ℤ) (J : ℕ) : HasDGR A 0 J := ⟨Fin.elim0, fun i => i.elim0, fun i => i.elim0, fun i => i.elim0, fun i => i.elim0⟩ theorem hasDGR_union_disjoint {A B : Finset ℤ} {I₁ I₂ J : ℕ} (hdisjAB : Disjoint A B) (hA : HasDGR A I₁ J) (hB : HasDGR B I₂ J) : HasDGR (A ∪ B) (I₁ + I₂) J := by rcases hA with ⟨R₁, hsub₁, hcard₁, hgr₁, hdisj₁⟩ rcases hB with ⟨R₂, hsub₂, hcard₂, hgr₂, hdisj₂⟩ let R : Fin (I₁ + I₂) → Finset ℤ := Fin.addCases R₁ R₂ refine ⟨R, ?_, ?_, ?_, ?_⟩ · intro i refine Fin.addCases ?_ ?_ i · intro i₁; simp only [R, Fin.addCases_left]; exact (hsub₁ i₁).trans Finset.subset_union_left · intro i₂; simp only [R, Fin.addCases_right]; exact (hsub₂ i₂).trans Finset.subset_union_right · intro i refine Fin.addCases ?_ ?_ i · intro i₁; simp only [R, Fin.addCases_left]; exact hcard₁ i₁ · intro i₂; simp only [R, Fin.addCases_right]; exact hcard₂ i₂ · intro i refine Fin.addCases ?_ ?_ i · intro i₁; simp only [R, Fin.addCases_left]; exact hgr₁ i₁ · intro i₂; simp only [R, Fin.addCases_right]; exact hgr₂ i₂ · intro i j hij refine Fin.addCases (motive := fun i => ∀ j, i ≠ j → Disjoint (R i) (R j)) ?_ ?_ i j hij · intro i₁ j refine Fin.addCases (motive := fun j => Fin.castAdd I₂ i₁ ≠ j → Disjoint (R (Fin.castAdd I₂ i₁)) (R j)) ?_ ?_ j · intro j₁ hne simp only [R, Fin.addCases_left] exact hdisj₁ (fun h => hne (congrArg _ h)) · intro j₂ _ simp only [R, Fin.addCases_left, Fin.addCases_right] exact hdisjAB.mono (hsub₁ i₁) (hsub₂ j₂) · intro i₂ j refine Fin.addCases (motive := fun j => Fin.natAdd I₁ i₂ ≠ j → Disjoint (R (Fin.natAdd I₁ i₂)) (R j)) ?_ ?_ j · intro j₁ _ simp only [R, Fin.addCases_left, Fin.addCases_right] exact hdisjAB.symm.mono (hsub₂ i₂) (hsub₁ j₁) · intro j₂ hne simp only [R, Fin.addCases_right] exact hdisj₂ (fun h => hne (congrArg _ h)) theorem hasDGR_card_lower {A : Finset ℤ} {I J : ℕ} (h : HasDGR A I J) : I * J ≤ A.card := by rcases h with ⟨R, hsub, hcard, _, hdisj⟩ have hbi : (Finset.univ.biUnion R) ⊆ A := by intro x hx rcases Finset.mem_biUnion.mp hx with ⟨i, _, hxi⟩ exact hsub i hxi have hle := Finset.card_le_card hbi rw [Finset.card_biUnion (fun i _ j _ hij => hdisj hij)] at hle simp only [hcard, Finset.sum_const, Finset.card_univ, Fintype.card_fin, smul_eq_mul] at hle exact hle theorem isDGRInterval_mono {I J m n : ℕ} (hmn : m ≤ n) (h : IsDGRInterval I J m) : IsDGRInterval I J n := hasDGR_mono (Finset.Icc_subset_Icc_right (Int.ofNat_le.mpr hmn)) h theorem isDGRInterval_add {I₁ I₂ J n₁ n₂ : ℕ} (h₁ : IsDGRInterval I₁ J n₁) (h₂ : IsDGRInterval I₂ J n₂) : IsDGRInterval (I₁ + I₂) J (n₁ + n₂) := by have h₂' := hasDGR_translate h₂ (n₁ : ℤ) have hdisj : Disjoint (Finset.Icc (1 : ℤ) (n₁ : ℤ)) ((Finset.Icc (1 : ℤ) (n₂ : ℤ)).image (fun x => x + (n₁ : ℤ))) := by rw [Finset.disjoint_left] intro x hx₁ hx₂ rw [Finset.mem_Icc] at hx₁ rcases Finset.mem_image.mp hx₂ with ⟨y, hy, rfl⟩ rw [Finset.mem_Icc] at hy omega have hu := hasDGR_union_disjoint hdisj h₁ h₂' refine hasDGR_mono ?_ hu intro x hx rw [Finset.mem_union] at hx rw [Finset.mem_Icc] rcases hx with hx | hx · rw [Finset.mem_Icc] at hx; omega · rcases Finset.mem_image.mp hx with ⟨y, hy, rfl⟩ rw [Finset.mem_Icc] at hy; omega theorem isHVal_sInf {I J n : ℕ} (h : IsHVal I J n) : sInf {m : ℕ | IsDGRInterval I J m} = n := by apply le_antisymm · exact Nat.sInf_le h.1 · exact le_csInf ⟨n, h.1⟩ (fun m hm => by by_contra hlt exact h.2 m (Nat.lt_of_not_ge hlt) hm) /-! ### Section 2: Exact Linear Characterizations for `J = 3` and `J = 4` -/ theorem isGolombRuler_triple_iff {a b c : ℤ} (hab : a < b) (hbc : b < c) : IsGolombRuler ({a, b, c} : Finset ℤ) ↔ b - a ≠ c - b := by constructor · intro h heq have := h a (by simp) b (by simp) b (by simp) c (by simp) hab hbc heq omega · intro hne x hx y hy z hz w hw hxy hzw hdiff simp only [Finset.mem_insert, Finset.mem_singleton] at hx hy hz hw rcases hx with rfl | rfl | rfl <;> rcases hy with rfl | rfl | rfl <;> rcases hz with rfl | rfl | rfl <;> rcases hw with rfl | rfl | rfl <;> omega theorem card_triple_of_lt {a b c : ℤ} (hab : a < b) (hbc : b < c) : ({a, b, c} : Finset ℤ).card = 3 := by rw [Finset.card_insert_of_notMem, Finset.card_insert_of_notMem, Finset.card_singleton] · simp; omega · simp; omega theorem isGolombRuler_quad_iff {a b c d : ℤ} (hab : a < b) (hbc : b < c) (hcd : c < d) : IsGolombRuler ({a, b, c, d} : Finset ℤ) ↔ b - a ≠ c - b ∧ b - a ≠ d - c ∧ c - b ≠ d - c ∧ b - a ≠ d - b ∧ c - a ≠ d - c := by constructor · intro h refine ⟨?_, ?_, ?_, ?_, ?_⟩ · intro heq; have := h a (by simp) b (by simp) b (by simp) c (by simp) hab hbc heq; omega · intro heq; have := h a (by simp) b (by simp) c (by simp) d (by simp) hab hcd heq; omega · intro heq; have := h b (by simp) c (by simp) c (by simp) d (by simp) hbc hcd heq; omega · intro heq; have := h a (by simp) b (by simp) b (by simp) d (by simp) hab (by omega) heq; omega · intro heq; have := h a (by simp) c (by simp) c (by simp) d (by simp) (by omega) hcd heq; omega · rintro ⟨h1, h2, h3, h4, h5⟩ x hx y hy z hz w hw hxy hzw hdiff simp only [Finset.mem_insert, Finset.mem_singleton] at hx hy hz hw rcases hx with rfl | rfl | rfl | rfl <;> rcases hy with rfl | rfl | rfl | rfl <;> rcases hz with rfl | rfl | rfl | rfl <;> rcases hw with rfl | rfl | rfl | rfl <;> omega theorem card_quad_of_lt {a b c d : ℤ} (hab : a < b) (hbc : b < c) (hcd : c < d) : ({a, b, c, d} : Finset ℤ).card = 4 := by rw [Finset.card_insert_of_notMem, Finset.card_insert_of_notMem, Finset.card_insert_of_notMem, Finset.card_singleton] · simp; omega · simp; omega · simp; omega /-! ### Section 3: Sorted Embedding Helper for Finite Subsets of `ℤ` -/ /-- Any `n`-element `Finset ℤ` is the image of a strictly increasing function `Fin n → ℤ`. -/ theorem exists_strictMono_finset {A : Finset ℤ} {n : ℕ} (hcard : A.card = n) : ∃ a : Fin n → ℤ, StrictMono a ∧ Finset.univ.image a = A := by let e : Fin n ≃o A := (A.orderIsoOfFin hcard) refine ⟨fun i => (e i : ℤ), ?_, ?_⟩ · intro i j hij exact e.strictMono hij · ext x simp only [Finset.mem_image, Finset.mem_univ, true_and] constructor · rintro ⟨i, rfl⟩; exact (e i).2 · intro hx refine ⟨e.symm ⟨x, hx⟩, ?_⟩ simp /-! ### Section 4: Complete Resolution of the DGR Conjecture for `J = 3` and All `I ≥ 1` -/ /-- Every 4-element subset of `ℤ` contains a 3-Golomb ruler. -/ theorem dgr_I1_J3_sorted (a : Fin 4 → ℤ) (ha : StrictMono a) : HasDGR (Finset.univ.image a) 1 3 := by have h01 : a 0 < a 1 := ha (by decide) have h12 : a 1 < a 2 := ha (by decide) have h23 : a 2 < a 3 := ha (by decide) have hmem : ∀ i : Fin 4, a i ∈ Finset.univ.image a := fun i => Finset.mem_image_of_mem a (Finset.mem_univ i) by_cases h : a 1 - a 0 = a 3 - a 1 · -- Then {a 0, a 2, a 3} is a 3-Golomb ruler! refine ⟨fun _ => {a 0, a 2, a 3}, ?_, ?_, ?_, ?_⟩ · intro _ x hx simp only [Finset.mem_insert, Finset.mem_singleton] at hx rcases hx with rfl | rfl | rfl <;> exact hmem _ · intro _; exact card_triple_of_lt (by omega) h23 · intro _; rw [isGolombRuler_triple_iff (by omega) h23]; omega · intro i j hij; exact (hij (Subsingleton.elim i j)).elim · refine ⟨fun _ => {a 0, a 1, a 3}, ?_, ?_, ?_, ?_⟩ · intro _ x hx simp only [Finset.mem_insert, Finset.mem_singleton] at hx rcases hx with rfl | rfl | rfl <;> exact hmem _ · intro _; exact card_triple_of_lt h01 (by omega) · intro _; rw [isGolombRuler_triple_iff h01 (by omega)]; exact h · intro i j hij; exact (hij (Subsingleton.elim i j)).elim theorem dgr_I1_J3 {A : Finset ℤ} (hcard : A.card = 4) : HasDGR A 1 3 := by rcases exists_strictMono_finset hcard with ⟨a, ha, rfl⟩ exact dgr_I1_J3_sorted a ha theorem dgr_I1_J3_ge {A : Finset ℤ} (hcard : 4 ≤ A.card) : HasDGR A 1 3 := by rcases Finset.exists_subset_card_eq hcard with ⟨B, hBA, hBcard⟩ exact hasDGR_mono hBA (dgr_I1_J3 hBcard) theorem not_isDGRInterval_1_3_three : ¬ IsDGRInterval 1 3 3 := by rintro ⟨R, hsub, hcard, hgr, _⟩ have hIcc_card : (Finset.Icc (1 : ℤ) 3).card = 3 := by decide have heq : R 0 = Finset.Icc (1 : ℤ) 3 := Finset.eq_of_subset_of_card_le (hsub 0) (by rw [hIcc_card, hcard 0]) have hgr' := hgr 0 rw [heq] at hgr' have h1 : (1 : ℤ) ∈ Finset.Icc (1 : ℤ) 3 := by decide have h2 : (2 : ℤ) ∈ Finset.Icc (1 : ℤ) 3 := by decide have h3 : (3 : ℤ) ∈ Finset.Icc (1 : ℤ) 3 := by decide have := hgr' 1 h1 2 h2 2 h2 3 h3 (by decide) (by decide) (by decide) omega /-- Exact value `H(1, 3) = 4`. -/ theorem isHVal_1_3 : IsHVal 1 3 4 := by refine ⟨?_, ?_⟩ · exact dgr_I1_J3 (by decide) · intro m hm h have hm3 : m ≤ 3 := Nat.lt_succ_iff.mp hm exact not_isDGRInterval_1_3_three (isDGRInterval_mono hm3 h) theorem sInf_dgr_1_3 : sInf {n : ℕ | IsDGRInterval 1 3 n} = 4 := isHVal_sInf isHVal_1_3 /-- Helper to build `HasDGR` for `I = 2, J = 3` from two disjoint strictly increasing triples. -/ private theorem mk_hasDGR_2_3 {A : Finset ℤ} {a₁ b₁ c₁ a₂ b₂ c₂ : ℤ} (h1a : a₁ ∈ A) (h1b : b₁ ∈ A) (h1c : c₁ ∈ A) (h2a : a₂ ∈ A) (h2b : b₂ ∈ A) (h2c : c₂ ∈ A) (h1lt₁ : a₁ < b₁) (h1lt₂ : b₁ < c₁) (h1g : b₁ - a₁ ≠ c₁ - b₁) (h2lt₁ : a₂ < b₂) (h2lt₂ : b₂ < c₂) (h2g : b₂ - a₂ ≠ c₂ - b₂) (hdisj : Disjoint ({a₁, b₁, c₁} : Finset ℤ) ({a₂, b₂, c₂} : Finset ℤ)) : HasDGR A 2 3 := by refine ⟨![{a₁, b₁, c₁}, {a₂, b₂, c₂}], ?_, ?_, ?_, ?_⟩ · intro i; fin_cases i · intro x hx change x ∈ ({a₁, b₁, c₁} : Finset ℤ) at hx simp only [Finset.mem_insert, Finset.mem_singleton] at hx rcases hx with rfl | rfl | rfl <;> assumption · intro x hx change x ∈ ({a₂, b₂, c₂} : Finset ℤ) at hx simp only [Finset.mem_insert, Finset.mem_singleton] at hx rcases hx with rfl | rfl | rfl <;> assumption · intro i; fin_cases i · exact card_triple_of_lt h1lt₁ h1lt₂ · exact card_triple_of_lt h2lt₁ h2lt₂ · intro i; fin_cases i · exact (isGolombRuler_triple_iff h1lt₁ h1lt₂).mpr h1g · exact (isGolombRuler_triple_iff h2lt₁ h2lt₂).mpr h2g · intro i j hij fin_cases i <;> fin_cases j · exact (hij rfl).elim · exact hdisj · exact hdisj.symm · exact (hij rfl).elim /-- **Base Theorem (`I = 2, J = 3`)**: Every 6-element subset of `ℤ` partitions into 2 pairwise disjoint 3-Golomb rulers. Proof: Consider the four partitions `({a₀, aₖ, a₅}, {a₁..a₄} \ {aₖ})` for `k ∈ {1, 2, 3, 4}`. At most one `k` satisfies `2 aₖ = a₀ + a₅`, and among the complementary triples: `{a₂, a₃, a₄}` and `{a₁, a₃, a₄}` cannot both be 3-APs (same right gap, different left gaps), and `{a₁, a₂, a₄}` and `{a₁, a₂, a₃}` cannot both be 3-APs (same left gap, different right gaps). Hence at least `4 - 1 - 2 = 1` of these four partitions works! -/ theorem dgr_I2_J3_sorted (a : Fin 6 → ℤ) (ha : StrictMono a) : HasDGR (Finset.univ.image a) 2 3 := by have h01 : a 0 < a 1 := ha (by decide) have h12 : a 1 < a 2 := ha (by decide) have h23 : a 2 < a 3 := ha (by decide) have h34 : a 3 < a 4 := ha (by decide) have h45 : a 4 < a 5 := ha (by decide) have hmem : ∀ i : Fin 6, a i ∈ Finset.univ.image a := fun i => Finset.mem_image_of_mem a (Finset.mem_univ i) by_cases p1 : a 1 - a 0 ≠ a 5 - a 1 ∧ a 3 - a 2 ≠ a 4 - a 3 · exact mk_hasDGR_2_3 (hmem 0) (hmem 1) (hmem 5) (hmem 2) (hmem 3) (hmem 4) h01 (by omega) p1.1 h23 h34 p1.2 (by rw [Finset.disjoint_left]; intro x hx hy simp only [Finset.mem_insert, Finset.mem_singleton] at hx hy rcases hx with rfl | rfl | rfl <;> rcases hy with h | h | h <;> omega) by_cases p2 : a 2 - a 0 ≠ a 5 - a 2 ∧ a 3 - a 1 ≠ a 4 - a 3 · exact mk_hasDGR_2_3 (hmem 0) (hmem 2) (hmem 5) (hmem 1) (hmem 3) (hmem 4) (by omega) (by omega) p2.1 (by omega) h34 p2.2 (by rw [Finset.disjoint_left]; intro x hx hy simp only [Finset.mem_insert, Finset.mem_singleton] at hx hy rcases hx with rfl | rfl | rfl <;> rcases hy with h | h | h <;> omega) by_cases p3 : a 3 - a 0 ≠ a 5 - a 3 ∧ a 2 - a 1 ≠ a 4 - a 2 · exact mk_hasDGR_2_3 (hmem 0) (hmem 3) (hmem 5) (hmem 1) (hmem 2) (hmem 4) (by omega) (by omega) p3.1 h12 (by omega) p3.2 (by rw [Finset.disjoint_left]; intro x hx hy simp only [Finset.mem_insert, Finset.mem_singleton] at hx hy rcases hx with rfl | rfl | rfl <;> rcases hy with h | h | h <;> omega) by_cases p4 : a 4 - a 0 ≠ a 5 - a 4 ∧ a 2 - a 1 ≠ a 3 - a 2 · exact mk_hasDGR_2_3 (hmem 0) (hmem 4) (hmem 5) (hmem 1) (hmem 2) (hmem 3) (by omega) h45 p4.1 h12 h23 p4.2 (by rw [Finset.disjoint_left]; intro x hx hy simp only [Finset.mem_insert, Finset.mem_singleton] at hx hy rcases hx with rfl | rfl | rfl <;> rcases hy with h | h | h <;> omega) exfalso omega theorem dgr_I2_J3 {A : Finset ℤ} (hcard : A.card = 6) : HasDGR A 2 3 := by rcases exists_strictMono_finset hcard with ⟨a, ha, rfl⟩ exact dgr_I2_J3_sorted a ha /-- **Inductive Resolution (`I ≥ 2, J = 3`)**: Every `(3 * I)`-element subset of `ℤ` (`I ≥ 2`) partitions into `I` pairwise disjoint 3-Golomb rulers. -/ theorem dgr_J3_ge_two : ∀ I : ℕ, 2 ≤ I → ∀ A : Finset ℤ, A.card = 3 * I → HasDGR A I 3 := by intro I hI induction I with | zero => omega | succ k ih => intro A hcard by_cases hk : k = 1 · subst hk; exact dgr_I2_J3 hcard · have hk2 : 2 ≤ k := by omega have hA4 : 4 ≤ A.card := by omega rcases dgr_I1_J3_ge hA4 with ⟨R₁, hsub₁, hcard₁, hgr₁, _⟩ let B := A \ R₁ 0 have hBcard : B.card = 3 * k := by rw [Finset.card_sdiff, Finset.inter_eq_left.mpr (hsub₁ 0), hcard, hcard₁ 0]; omega have hB : HasDGR B k 3 := ih hk2 B hBcard have hR₁_dgr : HasDGR (R₁ 0) 1 3 := by refine ⟨R₁, fun i => by rw [Subsingleton.elim i 0], hcard₁, hgr₁, fun i j hij => (hij (Subsingleton.elim i j)).elim⟩ have hdisj : Disjoint B (R₁ 0) := Finset.sdiff_disjoint have hu := hasDGR_union_disjoint hdisj hB hR₁_dgr have hsub_u : B ∪ R₁ 0 ⊆ A := by intro x hx rw [Finset.mem_union] at hx rcases hx with hx | hx · exact (Finset.mem_sdiff.mp hx).1 · exact hsub₁ 0 hx exact hasDGR_mono hsub_u hu /-- Exact value `H(I, 3) = 3 * I` for all `I ≥ 2`. -/ theorem isHVal_J3_ge_two {I : ℕ} (hI : 2 ≤ I) : IsHVal I 3 (3 * I) := by refine ⟨?_, ?_⟩ · apply dgr_J3_ge_two I hI have h : (Finset.Icc (1 : ℤ) ((3 * I : ℕ) : ℤ)).card = 3 * I := by rw [Int.card_Icc]; omega exact h · intro m hm h have hlow := hasDGR_card_lower h have hcard : (Finset.Icc (1 : ℤ) (m : ℤ)).card = m := by rw [Int.card_Icc]; omega rw [hcard] at hlow omega theorem sInf_dgr_J3_ge_two {I : ℕ} (hI : 2 ≤ I) : sInf {n : ℕ | IsDGRInterval I 3 n} = 3 * I := isHVal_sInf (isHVal_J3_ge_two hI) /-- Unified exact `H(I, 3)` theorem for all `I ≥ 1`. -/ theorem isHVal_H3 {I : ℕ} (hI : 1 ≤ I) : IsHVal I 3 (H3 I) := by unfold H3 split_ifs with h1 · subst h1; exact isHVal_1_3 · exact isHVal_J3_ge_two (by omega) /-- **Main Theorem (Xiu–Fan–Liang 2014 / Xu–Xiu–Fan–Liang 2024 Conjecture for `J = 3`, all `I ≥ 1`)**: For every `I ≥ 1` and every finite set `A ⊆ ℤ` with `|A| = H(I, 3)`, `A` contains `I` pairwise disjoint `3`-Golomb rulers. -/ theorem dgr_conjecture_J3 {I : ℕ} (hI : 1 ≤ I) {A : Finset ℤ} (hcard : A.card = H3 I) : HasDGR A I 3 := by unfold H3 at hcard split_ifs at hcard with h1 · subst h1; exact dgr_I1_J3 hcard · exact dgr_J3_ge_two I (by omega) A hcard #print axioms isHVal_1_3 #print axioms isHVal_J3_ge_two #print axioms dgr_conjecture_J3 end DGR