| | @@ -0,0 +1,85 @@ |
| 1 | +import ErdosSwarm.Erdos627 |
| 2 | +import FormalConjectures.Wikipedia.RamseyNumbers |
| 3 | + |
| 4 | +/-! |
| 5 | +# Finite Ramsey thresholds for Erdős Problem 627 |
| 6 | + |
| 7 | +At and above `R(s,t)`, every graph has a clique of size `s` or an independent |
| 8 | +set of size `t`. Below `R(k+1,k+1)`, a graph avoiding both gives the lower |
| 9 | +bound `f(n) ≥ n/k²` for the maximum chromatic-to-clique ratio. |
| 10 | +-/ |
| 11 | + |
| 12 | +namespace ErdosSwarm.Erdos627 |
| 13 | + |
| 14 | +open SimpleGraph RamseyNumbers |
| 15 | + |
| 16 | +/-- A finite graph contains a clique of size `k` exactly when its clique number is at least `k`. -/ |
| 17 | +theorem not_cliqueFree_iff_le_cliqueNum {V : Type*} [Finite V] (G : SimpleGraph V) (k : ℕ) : |
| 18 | + ¬ G.CliqueFree k ↔ k ≤ G.cliqueNum := by |
| 19 | + classical |
| 20 | + constructor |
| 21 | + · intro h |
| 22 | + obtain ⟨u, hu⟩ : ∃ u, G.IsNClique k u := by simpa [CliqueFree] using h |
| 23 | + exact hu.card_eq ▸ hu.isClique.card_le_cliqueNum |
| 24 | + · intro hk hfree |
| 25 | + obtain ⟨u, hu⟩ := G.exists_isNClique_cliqueNum |
| 26 | + exact (hfree.mono hk) u hu |
| 27 | + |
| 28 | +private theorem isGraphRamsey_iff (s t n : ℕ) : |
| 29 | + IsGraphRamsey n s t ↔ |
| 30 | + ∀ G : SimpleGraph (Fin n), s ≤ G.cliqueNum ∨ t ≤ G.indepNum := by |
| 31 | + classical |
| 32 | + simp only [IsGraphRamsey, not_and_or, not_cliqueFree_iff_le_cliqueNum, cliqueNum_compl] |
| 33 | + |
| 34 | +/-- The classical Ramsey number is the threshold for the clique and independence numbers. -/ |
| 35 | +theorem classicalRamsey_le_iff (s t n : ℕ) : |
| 36 | + classicalRamsey s t ≤ n ↔ |
| 37 | + ∀ G : SimpleGraph (Fin n), s ≤ G.cliqueNum ∨ t ≤ G.indepNum := by |
| 38 | + have hne : {m : ℕ | IsGraphRamsey m s t}.Nonempty := by |
| 39 | + refine ⟨(s + t).choose s, (isGraphRamsey_iff s t _).2 fun G => ?_⟩ |
| 40 | + by_cases hs : s ≤ G.cliqueNum |
| 41 | + · exact Or.inl hs |
| 42 | + · exact Or.inr ((Nat.le_succ t).trans |
| 43 | + (indepNum_ge_of_cliqueNum_le G (by omega : G.cliqueNum ≤ s) (by simp))) |
| 44 | + rw [classicalRamsey_eq_sInf, ← isGraphRamsey_iff] |
| 45 | + constructor |
| 46 | + · intro h |
| 47 | + induction n, h using Nat.le_induction with |
| 48 | + | base => exact Nat.sInf_mem hne |
| 49 | + | succ m _ ih => exact IsGraphRamsey.succ m s t ih |
| 50 | + · intro hn |
| 51 | + exact Nat.sInf_le (s := {m : ℕ | IsGraphRamsey m s t}) hn |
| 52 | + |
| 53 | +/-- A graph whose clique and independence numbers are at most `K` gives `f(n) ≥ n/K²`. -/ |
| 54 | +theorem div_sq_le_maxChromaticCliqueRatio_of_graph {n : ℕ} (G : SimpleGraph (Fin n)) {K : ℝ} |
| 55 | + (hω : (G.cliqueNum : ℝ) ≤ K) (hα : (G.indepNum : ℝ) ≤ K) : |
| 56 | + (n : ℝ) / K ^ 2 ≤ _root_.Erdos627.maxChromaticCliqueRatio n := by |
| 57 | + classical |
| 58 | + refine le_trans ?_ (le_ciSup (f := fun H : SimpleGraph (Fin n) ↦ |
| 59 | + (H.chromaticNumber.toNat : ℝ) / H.cliqueNum) (Set.finite_range _).bddAbove G) |
| 60 | + rcases Nat.eq_zero_or_pos n with rfl | hn |
| 61 | + · simp only [Nat.cast_zero, zero_div] |
| 62 | + positivity |
| 63 | + have hωnat : 1 ≤ G.cliqueNum := (not_cliqueFree_iff_le_cliqueNum G 1).1 fun h => |
| 64 | + (cliqueFree_one.mp h).false (⟨0, hn⟩ : Fin n) |
| 65 | + have hωpos : 0 < (G.cliqueNum : ℝ) := by exact_mod_cast hωnat |
| 66 | + have hK : 0 < K := hωpos.trans_le hω |
| 67 | + have hcard : (n : ℝ) ≤ (G.chromaticNumber.toNat : ℝ) * G.indepNum := by |
| 68 | + exact_mod_cast (show n ≤ G.chromaticNumber.toNat * G.indepNum by |
| 69 | + simpa using card_le_chromaticNumber_mul_indepNum G) |
| 70 | + apply (div_le_div_iff₀ (sq_pos_of_pos hK) hωpos).2 |
| 71 | + calc (n : ℝ) * G.cliqueNum ≤ ((G.chromaticNumber.toNat : ℝ) * G.indepNum) * G.cliqueNum := by |
| 72 | + gcongr |
| 73 | + _ ≤ (G.chromaticNumber.toNat : ℝ) * K * K := by gcongr |
| 74 | + _ = _ := by ring |
| 75 | + |
| 76 | +/-- Below the diagonal Ramsey threshold there is a graph with both parameters at most `k`. -/ |
| 77 | +theorem div_sq_le_maxChromaticCliqueRatio_of_lt_diagonalRamsey {n k : ℕ} |
| 78 | + (hn : n < diagonalRamsey (k + 1)) : |
| 79 | + (n : ℝ) / (k : ℝ) ^ 2 ≤ _root_.Erdos627.maxChromaticCliqueRatio n := by |
| 80 | + have h := mt (classicalRamsey_le_iff (k + 1) (k + 1) n).2 (not_le_of_gt hn) |
| 81 | + simp only [not_forall, not_or, not_le, Nat.lt_succ_iff] at h |
| 82 | + obtain ⟨G, hω, hα⟩ := h |
| 83 | + exact div_sq_le_maxChromaticCliqueRatio_of_graph G (by exact_mod_cast hω) (by exact_mod_cast hα) |
| 84 | + |
| 85 | +end ErdosSwarm.Erdos627 |