import Mathlib /-! # Shattering the `O(d³ log Δ)` Barrier for Injective Edge Coloring of `d`-Degenerate Graphs ## Main Results An **injective edge coloring** of a simple graph `G` is an edge coloring `c : E(G) → α` (not necessarily proper) such that any two edges joined by a third edge receive distinct colors — equivalently, no 3-edge path `P₄` has the same color on its first and last edges, and no triangle `K₃` has two edges of the same color. The **injective chromatic index** `χ'_{inj}(G)` is the minimum number of colors required. The standing world record for general `d`-degenerate graphs with maximum degree `Δ` is due to **Bradshaw, Clow, and Xu** (*European Journal of Combinatorics*, 2025; `arXiv:2308.15654`): $$\chi'_{inj}(G) \;\le\; \lceil 4 e d \ln \Delta \rceil \cdot (2d + 1) \cdot \chi(G) \;\le\; \lceil 4 e d \ln \Delta \rceil (2d + 1)(d + 1) \;=\; O(d^3 \log \Delta).$$ In this file we **shatter Bradshaw–Clow–Xu (2025) by a full factor of `d`**, establishing: 1. **Main World-Record Theorem (`injective_edge_coloring_of_degenerate`)**: For every finite `d`-degenerate graph `G` (`d ≥ 1`) with maximum degree `Δ = maxDeg G ≥ 2`, $$\chi'_{inj}(G) \;\le\; (2d^2 + d) \cdot \left\lceil \frac{1 + (d - 1)\ln 3 + \ln\!\big(3(d + 1)^3 \Delta^3\big)} {-\ln\!\left(1 - \frac{2}{3e}\right)} \right\rceil \;=\; O(d^2 \log \Delta + d^3).$$ In particular, for fixed `d` as `Δ → ∞` (or whenever `Δ ≥ 2^d`), this reduces the bound from `O(d³ log Δ)` down to **`O(d² log Δ)`** — a full factor of `d` asymptotic improvement. 2. **Pure `O(d² log Δ)` Bound for Triangle-Free `d`-Degenerate Graphs (`injective_edge_coloring_of_triangleFree_degenerate`)**: When `G` is triangle-free (e.g., bipartite `d`-degenerate graphs), the `+ d³` term vanishes completely, yielding pure **`O(d² log Δ)`**: $$\chi'_{inj}(G) \;\le\; (2d^2 + d) \cdot \left\lceil \frac{1 + \ln\!\big(3(d + 1)^3 \Delta^3\big)} {-\ln\!\left(1 - \frac{2}{3e}\right)} \right\rceil.$$ 3. **Strict Improvement over Bradshaw–Clow–Xu (2025) for ALL `d ≥ 2, Δ ≥ 2`**: - `injective_edge_coloring_worldRecord_beats_bcx`: `worldRecordBound d Δ` *by itself* strictly beats `bradshawClowXuBound d Δ` for **all** `d ≥ 3, Δ ≥ 3` and **all** `d = 2, Δ ≥ 4`. - `injective_edge_coloring_strictly_beats_bcx_all`: combined with our universal greedy bound `2(Δ - 1)² + 1`, we strictly beat Bradshaw–Clow–Xu (2025) for **every** `d ≥ 2` and **every** `Δ ≥ 2` without a single exception. 4. **Self-Contained Foundations & Tight Lower Bound**: - `symmetric_lll_finite_product` & `symmetric_lll_exp`: completely self-contained finite product-space Symmetric Lovász Local Lemma (zero measure-theory imports). - `isInjectiveEdgeColoring_iff_no_P4_no_K3`: exact equivalence with the classical separate `P₄`-end and `K₃` conditions. - `injective_edge_coloring_completeGraph_lower_bound`: `n * (n - 1) / 2 ≤ M` for `K_n` (giving `χ'_{inj}(K_{d+1}) ≥ d(d + 1)/2 = Ω(d²)`). - `injective_edge_coloring_greedy_bound`: universal bound `χ'_{inj}(G) ≤ 2(Δ - 1)² + 1`. -/ open Finset SimpleGraph namespace DegenerateInjectiveEdgeColoring /-! ## Section 0: Definitions, Equivalence, Lower Bound & Greedy Upper Bound -/ section Definitions variable {V : Type*} /-- A graph `G` is `d`-degenerate if every nonempty finite vertex subset `S` contains a vertex with at most `d` neighbors inside `S`. -/ def IsDegenerate (G : SimpleGraph V) (d : ℕ) : Prop := ∀ S : Finset V, S.Nonempty → ∃ v ∈ S, ∀ [DecidablePred (G.Adj v)], (S.filter (G.Adj v)).card ≤ d /-- Classical vertex degree helper (avoids `DecidableRel` instance mismatches in `maxDeg`). -/ noncomputable def degCl [Fintype V] (G : SimpleGraph V) (v : V) : ℕ := by classical exact G.degree v lemma degree_eq_degCl [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj] (v : V) : G.degree v = degCl G v := by classical simp only [degCl, SimpleGraph.degree] exact Finset.card_bij (fun x _ => x) (fun x hx => by simpa [SimpleGraph.mem_neighborFinset] using hx) (fun _ _ _ _ h => h) (fun x hx => ⟨x, by simpa [SimpleGraph.mem_neighborFinset] using hx, rfl⟩) /-- Maximum degree of a finite simple graph `G` (`0` on an empty vertex set). -/ noncomputable def maxDeg [Fintype V] (G : SimpleGraph V) : ℕ := Finset.univ.sup (degCl G) lemma degree_le_maxDeg [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj] (v : V) : G.degree v ≤ maxDeg G := by rw [degree_eq_degCl G v] exact Finset.le_sup (f := degCl G) (Finset.mem_univ v) /-- A graph `G` is triangle-free if no three vertices are mutually adjacent. -/ def IsTriangleFree (G : SimpleGraph V) : Prop := ∀ a b c : V, G.Adj a b → G.Adj b c → ¬G.Adj a c /-- An **injective edge coloring** of `G` with colors in `α`: for every bridge edge `uv`, no edge `xu` (`x ≠ v`) at `u` receives the same color as any edge `vy` (`y ≠ u`) at `v`. This simultaneously forbids same-colored end edges of every 3-edge path `P₄` and any two same-colored edges in a triangle `K₃`. -/ def IsInjectiveEdgeColoring {α : Type*} (G : SimpleGraph V) (c : Sym2 V → α) : Prop := ∀ u v x y : V, G.Adj u v → G.Adj x u → G.Adj v y → x ≠ v → y ≠ u → c s(x, u) ≠ c s(v, y) /-- Classical separate condition 1: in every 3-edge path `x - u - v - y` on 4 distinct vertices, the two end edges `xu` and `vy` receive distinct colors. -/ def NoSameColorP4Ends {α : Type*} (G : SimpleGraph V) (c : Sym2 V → α) : Prop := ∀ x u v y : V, G.Adj x u → G.Adj u v → G.Adj v y → x ≠ u → x ≠ v → x ≠ y → u ≠ v → u ≠ y → v ≠ y → c s(x, u) ≠ c s(v, y) /-- Classical separate condition 2: in every triangle `u - v - x - u`, the two edges `xu` and `vx` receive distinct colors (hence all 3 edges of every triangle receive pairwise distinct colors). -/ def NoSameColorTriangle {α : Type*} (G : SimpleGraph V) (c : Sym2 V → α) : Prop := ∀ u v x : V, G.Adj u v → G.Adj v x → G.Adj x u → c s(x, u) ≠ c s(v, x) /-- Exact equivalence between our unified bridge definition of injective edge coloring and the classical separate `P₄`-end and `K₃` conditions. -/ theorem isInjectiveEdgeColoring_iff_no_P4_no_K3 {α : Type*} (G : SimpleGraph V) (c : Sym2 V → α) : IsInjectiveEdgeColoring G c ↔ NoSameColorP4Ends G c ∧ NoSameColorTriangle G c := by constructor · intro hinj refine ⟨?_, ?_⟩ · intro x u v y hxu huv hvy _ hxv _ _ huy _ exact hinj u v x y huv hxu hvy hxv huy.symm · intro u v x huv hvx hxu exact hinj u v x x huv hxu hvx (G.ne_of_adj hvx.symm) (G.ne_of_adj hxu) · rintro ⟨hP4, hK3⟩ u v x y huv hxu hvy hxv hyu by_cases hxy : x = y · subst hxy exact hK3 u v x huv hvy hxu · exact hP4 x u v y hxu huv hvy (G.ne_of_adj hxu) hxv hxy (G.ne_of_adj huv) hyu.symm (G.ne_of_adj hvy) /-- `G` is **injectively `M`-edge-colorable** (`χ'_{inj}(G) ≤ M`). -/ def IsInjectiveEdgeColorable (G : SimpleGraph V) (M : ℕ) : Prop := ∃ c : Sym2 V → Fin M, IsInjectiveEdgeColoring G c lemma IsInjectiveEdgeColorable.mono {G : SimpleGraph V} {M₁ M₂ : ℕ} (h : IsInjectiveEdgeColorable G M₁) (hle : M₁ ≤ M₂) : IsInjectiveEdgeColorable G M₂ := by rcases h with ⟨c, hc⟩ refine ⟨fun e => Fin.castLE hle (c e), fun u v x y huv hxu hvy hxv hyu heq => ?_⟩ exact hc u v x y huv hxu hvy hxv hyu (Fin.castLE_injective hle heq) /-- **Tight Clique Lower Bound (`Ω(d²)`)**: any injective edge coloring of `K_n` requires at least `n * (n - 1) / 2` colors (every pair of distinct edges in `K_n` is joined by a third edge!). -/ theorem injective_edge_coloring_completeGraph_lower_bound (n M : ℕ) (hcol : IsInjectiveEdgeColorable (⊤ : SimpleGraph (Fin n)) M) : n * (n - 1) / 2 ≤ M := by classical rcases hcol with ⟨c, hc⟩ -- Every two distinct edges of `K_n` receive distinct colors! have hinj : Set.InjOn c ((⊤ : SimpleGraph (Fin n)).edgeFinset : Set (Sym2 (Fin n))) := by intro e₁ he₁ e₂ he₂ heq by_contra hne induction e₁ using Sym2.ind with | _ a b => induction e₂ using Sym2.ind with | _ p q => have hab : a ≠ b := SimpleGraph.mem_edgeFinset.1 he₁ have hpq : p ≠ q := SimpleGraph.mem_edgeFinset.1 he₂ -- Case split on whether `{a, b}` and `{p, q}` share a vertex by_cases hap : a = p · subst hap have hbq : b ≠ q := fun h => hne (by rw [h]) exact hc b q a a hbq hab hpq.symm hpq hab (by simpa [Sym2.eq_swap] using heq) · by_cases haq : a = q · subst haq have hbp : b ≠ p := fun h => hne (by rw [h, Sym2.eq_swap]) exact hc b p a a hbp hab hpq hpq.symm hab (by simpa [Sym2.eq_swap] using heq) · by_cases hbp : b = p · subst hbp have haq' : a ≠ q := haq exact hc a q b b haq' hab.symm hpq.symm hpq hab.symm (by simpa [Sym2.eq_swap] using heq) · by_cases hbq : b = q · subst hbq have hap' : a ≠ p := hap exact hc a p b b hap' hab.symm hpq hpq.symm hab.symm (by simpa [Sym2.eq_swap] using heq) · -- Completely disjoint endpoints: bridge edge `s(b, p)` joins `s(a, b)` and `s(p, q)`! exact hc b p a q hbp hab hpq hap (Ne.symm hbq) heq have hcard_edges : ((⊤ : SimpleGraph (Fin n)).edgeFinset).card = n * (n - 1) / 2 := by have h1 := SimpleGraph.card_edgeFinset_top_eq_card_choose_two (V := Fin n) rw [Fintype.card_fin, Nat.choose_two_right] at h1 exact h1 calc n * (n - 1) / 2 = ((⊤ : SimpleGraph (Fin n)).edgeFinset).card := hcard_edges.symm _ = (((⊤ : SimpleGraph (Fin n)).edgeFinset).image c).card := (Finset.card_image_of_injOn hinj).symm _ ≤ M := by simpa [Fintype.card_fin] using Finset.card_le_univ (((⊤ : SimpleGraph (Fin n)).edgeFinset).image c) /-- **Universal Greedy Upper Bound**: every finite simple graph `G` with maximum degree `Δ` admits an injective edge coloring with at most `2 * (Δ - 1) ^ 2 + 1` colors. -/ theorem injective_edge_coloring_greedy_bound [Fintype V] (G : SimpleGraph V) : IsInjectiveEdgeColorable G (2 * (maxDeg G - 1) ^ 2 + 1) := by classical let Δ := maxDeg G let M := 2 * (Δ - 1) ^ 2 + 1 have hMpos : 0 < M := by omega -- Induct on subsets `E ⊆ G.edgeFinset`! have hbuild : ∀ E : Finset (Sym2 V), E ⊆ G.edgeFinset → ∃ c : Sym2 V → Fin M, ∀ u v x y : V, G.Adj u v → s(x, u) ∈ E → s(v, y) ∈ E → x ≠ v → y ≠ u → c s(x, u) ≠ c s(v, y) := by intro E induction E using Finset.induction_on with | empty => intro _ exact ⟨fun _ => ⟨0, hMpos⟩, fun _ _ _ _ _ h1 => by simp at h1⟩ | @insert e₀ E' he₀ ih => intro hsub obtain ⟨c, hc⟩ := ih (Finset.Subset.trans (Finset.subset_insert e₀ E') hsub) have he₀_G : e₀ ∈ G.edgeFinset := hsub (Finset.mem_insert_self e₀ E') induction e₀ using Sym2.ind with | _ a b => have hab : G.Adj a b := SimpleGraph.mem_edgeFinset.1 he₀_G -- Forbidden colors for `s(a, b)`: edges `s(x, y) ∈ E'` bridged to `s(a, b)` via `a` or `b`! let ForbA : Finset (Fin M) := ((G.neighborFinset a).erase b).biUnion fun u => ((G.neighborFinset u).erase a).image fun y => c s(u, y) let ForbB : Finset (Fin M) := ((G.neighborFinset b).erase a).biUnion fun u => ((G.neighborFinset u).erase b).image fun y => c s(u, y) have hForbA_card : ForbA.card ≤ (Δ - 1) ^ 2 := by calc ForbA.card ≤ ∑ u ∈ (G.neighborFinset a).erase b, (((G.neighborFinset u).erase a).image fun y => c s(u, y)).card := Finset.card_biUnion_le _ ≤ ∑ _u ∈ (G.neighborFinset a).erase b, (Δ - 1) := by apply Finset.sum_le_sum intro u hu have hau : G.Adj a u := (SimpleGraph.mem_neighborFinset G a u).1 (Finset.mem_of_mem_erase hu) have ha_in : a ∈ G.neighborFinset u := (SimpleGraph.mem_neighborFinset G u a).2 hau.symm calc (((G.neighborFinset u).erase a).image fun y => c s(u, y)).card ≤ ((G.neighborFinset u).erase a).card := Finset.card_image_le _ = G.degree u - 1 := by rw [Finset.card_erase_of_mem ha_in, SimpleGraph.degree] _ ≤ Δ - 1 := Nat.sub_le_sub_right (degree_le_maxDeg G u) 1 _ = ((G.neighborFinset a).erase b).card * (Δ - 1) := by simp _ ≤ (Δ - 1) * (Δ - 1) := by apply Nat.mul_le_mul_right have hb_in : b ∈ G.neighborFinset a := (SimpleGraph.mem_neighborFinset G a b).2 hab rw [Finset.card_erase_of_mem hb_in, ← SimpleGraph.degree] exact Nat.sub_le_sub_right (degree_le_maxDeg G a) 1 _ = (Δ - 1) ^ 2 := by ring have hForbB_card : ForbB.card ≤ (Δ - 1) ^ 2 := by calc ForbB.card ≤ ∑ u ∈ (G.neighborFinset b).erase a, (((G.neighborFinset u).erase b).image fun y => c s(u, y)).card := Finset.card_biUnion_le _ ≤ ∑ _u ∈ (G.neighborFinset b).erase a, (Δ - 1) := by apply Finset.sum_le_sum intro u hu have hbu : G.Adj b u := (SimpleGraph.mem_neighborFinset G b u).1 (Finset.mem_of_mem_erase hu) have hb_in : b ∈ G.neighborFinset u := (SimpleGraph.mem_neighborFinset G u b).2 hbu.symm calc (((G.neighborFinset u).erase b).image fun y => c s(u, y)).card ≤ ((G.neighborFinset u).erase b).card := Finset.card_image_le _ = G.degree u - 1 := by rw [Finset.card_erase_of_mem hb_in, SimpleGraph.degree] _ ≤ Δ - 1 := Nat.sub_le_sub_right (degree_le_maxDeg G u) 1 _ = ((G.neighborFinset b).erase a).card * (Δ - 1) := by simp _ ≤ (Δ - 1) * (Δ - 1) := by apply Nat.mul_le_mul_right have ha_in : a ∈ G.neighborFinset b := (SimpleGraph.mem_neighborFinset G b a).2 hab.symm rw [Finset.card_erase_of_mem ha_in, ← SimpleGraph.degree] exact Nat.sub_le_sub_right (degree_le_maxDeg G b) 1 _ = (Δ - 1) ^ 2 := by ring have hlt : (ForbA ∪ ForbB).card < (Finset.univ : Finset (Fin M)).card := by rw [Finset.card_univ, Fintype.card_fin] have hcu := Finset.card_union_le ForbA ForbB dsimp only [M] omega obtain ⟨col, hcol⟩ := Finset.exists_mem_notMem_of_card_lt_card hlt have hnotA : col ∉ ForbA := fun h => hcol.2 (Finset.mem_union_left _ h) have hnotB : col ∉ ForbB := fun h => hcol.2 (Finset.mem_union_right _ h) let c' : Sym2 V → Fin M := fun e => if e = s(a, b) then col else c e have hc'_old : ∀ e ∈ E', c' e = c e := by intro e he; dsimp only [c']; rw [if_neg]; intro h; subst h; exact he₀ he have hc'_new : c' s(a, b) = col := if_pos rfl refine ⟨c', fun u v x y huv h1 h2 hxv hyu => ?_⟩ rcases Finset.mem_insert.1 h1 with h1s | h1o <;> rcases Finset.mem_insert.1 h2 with h2s | h2o · -- `s(x, u) = s(a, b) = s(v, y)`: impossible since `x ≠ v`, `y ≠ u`, `u ≠ v`! have heq : s(x, u) = s(v, y) := h1s.trans h2s.symm rcases Sym2.eq_iff.1 heq with ⟨h1', _⟩ | ⟨_, h2'⟩ · exact absurd h1' hxv · exact absurd h2' (G.ne_of_adj huv) · -- `s(x, u) = s(a, b)`, `s(v, y) ∈ E'` rw [h1s, hc'_new, hc'_old _ h2o] have hvy : G.Adj v y := SimpleGraph.mem_edgeFinset.1 (hsub (Finset.mem_insert_of_mem h2o)) rcases Sym2.eq_iff.1 h1s.symm with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ · -- `x = a, u = b`: `v ∈ (neighborFinset b).erase a`, `y ∈ (neighborFinset v).erase b` intro heq exact hnotB (heq ▸ Finset.mem_biUnion.2 ⟨v, Finset.mem_erase.2 ⟨hxv.symm, (SimpleGraph.mem_neighborFinset G b v).2 huv⟩, Finset.mem_image_of_mem (fun y => c s(v, y)) (Finset.mem_erase.2 ⟨hyu, (SimpleGraph.mem_neighborFinset G v y).2 hvy⟩)⟩) · -- `x = b, u = a`: `v ∈ (neighborFinset a).erase b`, `y ∈ (neighborFinset v).erase a` intro heq exact hnotA (heq ▸ Finset.mem_biUnion.2 ⟨v, Finset.mem_erase.2 ⟨hxv.symm, (SimpleGraph.mem_neighborFinset G a v).2 huv⟩, Finset.mem_image_of_mem (fun y => c s(v, y)) (Finset.mem_erase.2 ⟨hyu, (SimpleGraph.mem_neighborFinset G v y).2 hvy⟩)⟩) · -- `s(x, u) ∈ E'`, `s(v, y) = s(a, b)` rw [h2s, hc'_new, hc'_old _ h1o] have hxu : G.Adj x u := SimpleGraph.mem_edgeFinset.1 (hsub (Finset.mem_insert_of_mem h1o)) rcases Sym2.eq_iff.1 h2s.symm with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ · -- `v = a, y = b`: `u ∈ (neighborFinset a).erase b`, `x ∈ (neighborFinset u).erase a` intro heq have hswap : c s(x, u) = c s(u, x) := by rw [Sym2.eq_swap] rw [hswap] at heq exact hnotA (heq.symm ▸ Finset.mem_biUnion.2 ⟨u, Finset.mem_erase.2 ⟨hyu.symm, (SimpleGraph.mem_neighborFinset G a u).2 huv.symm⟩, Finset.mem_image_of_mem (fun x => c s(u, x)) (Finset.mem_erase.2 ⟨hxv, (SimpleGraph.mem_neighborFinset G u x).2 hxu.symm⟩)⟩) · -- `v = b, y = a`: `u ∈ (neighborFinset b).erase a`, `x ∈ (neighborFinset u).erase b` intro heq have hswap : c s(x, u) = c s(u, x) := by rw [Sym2.eq_swap] rw [hswap] at heq exact hnotB (heq.symm ▸ Finset.mem_biUnion.2 ⟨u, Finset.mem_erase.2 ⟨hyu.symm, (SimpleGraph.mem_neighborFinset G b u).2 huv.symm⟩, Finset.mem_image_of_mem (fun x => c s(u, x)) (Finset.mem_erase.2 ⟨hxv, (SimpleGraph.mem_neighborFinset G u x).2 hxu.symm⟩)⟩) · -- Both in `E'` rw [hc'_old _ h1o, hc'_old _ h2o] exact hc u v x y huv h1o h2o hxv hyu obtain ⟨c, hc⟩ := hbuild G.edgeFinset Subset.rfl exact ⟨c, fun u v x y huv hxu hvy hxv hyu => hc u v x y huv (SimpleGraph.mem_edgeFinset.2 hxu) (SimpleGraph.mem_edgeFinset.2 hvy) hxv hyu⟩ end Definitions /-! ## Section 1: Forward `d`-Degeneracy Ordering -/ section DegeneracyOrdering /-- Every finite `d`-degenerate graph admits a bijection `ord : Fin n ≃ V` such that every vertex `ord i` has at most `d` neighbors `ord j` with `j < i`. -/ lemma exists_forward_degeneracy_ordering.{u} {V : Type u} [Fintype V] (G : SimpleGraph V) (d : ℕ) (hdeg : IsDegenerate G d) : ∃ ord : Fin (Fintype.card V) ≃ V, ∀ i : Fin (Fintype.card V), ∀ [DecidableRel G.Adj], (Finset.univ.filter fun j : Fin (Fintype.card V) => j < i ∧ G.Adj (ord i) (ord j)).card ≤ d := by classical have hmain : ∀ m : ℕ, ∀ {W : Type u} [Fintype W] (H : SimpleGraph W), Fintype.card W = m → IsDegenerate H d → ∃ ord : Fin m ≃ W, ∀ i : Fin m, ∀ [DecidableRel H.Adj], (Finset.univ.filter fun j : Fin m => j < i ∧ H.Adj (ord i) (ord j)).card ≤ d := by intro m induction m with | zero => intro W _ H hcard _ have : IsEmpty W := Fintype.card_eq_zero_iff.1 hcard exact ⟨Equiv.equivOfIsEmpty (Fin 0) W, fun i => Fin.elim0 i⟩ | succ m ih => intro W _ H hcard hdegH have hne : (Finset.univ : Finset W).Nonempty := Finset.card_pos.1 (by rw [Finset.card_univ, hcard]; omega) obtain ⟨v₀, _, hv₀_deg⟩ := hdegH Finset.univ hne let W' := {w : W // w ≠ v₀} let H' : SimpleGraph W' := H.induce {w : W | w ≠ v₀} have hcard' : Fintype.card W' = m := by have h1 : Fintype.card W' = Fintype.card W - 1 := by simp [W', Fintype.card_subtype_compl] omega have hdegH' : IsDegenerate H' d := by intro S hS let S' : Finset W := S.map ⟨Subtype.val, Subtype.val_injective⟩ have hS' : S'.Nonempty := by obtain ⟨x, hx⟩ := hS; exact ⟨x.val, Finset.mem_map.2 ⟨x, hx, rfl⟩⟩ obtain ⟨u, huS', hu_deg⟩ := hdegH S' hS' rcases Finset.mem_map.1 huS' with ⟨u', hu'S, rfl⟩ refine ⟨u', hu'S, ?_⟩ intro inst have hbij : (S.filter (H'.Adj u')).card = (S'.filter (H.Adj u'.val)).card := by apply Finset.card_bij (fun x _ => x.val) · intro x hx rcases Finset.mem_filter.1 hx with ⟨hxS, hadj⟩ exact Finset.mem_filter.2 ⟨Finset.mem_map.2 ⟨x, hxS, rfl⟩, hadj⟩ · intro x₁ _ x₂ _ h; exact Subtype.ext h · intro y hy rcases Finset.mem_filter.1 hy with ⟨hyS', hadj⟩ rcases Finset.mem_map.1 hyS' with ⟨x, hxS, rfl⟩ exact ⟨x, Finset.mem_filter.2 ⟨hxS, hadj⟩, rfl⟩ rw [hbij] exact hu_deg obtain ⟨ord', hord'⟩ := ih H' hcard' hdegH' let ord : Fin (m + 1) ≃ W := { toFun := fun i => if hi : i.val < m then (ord' ⟨i.val, hi⟩).val else v₀ invFun := fun w => if hw : w = v₀ then ⟨m, Nat.lt_succ_self m⟩ else ⟨(ord'.symm ⟨w, hw⟩).val, Nat.lt_trans (ord'.symm ⟨w, hw⟩).isLt (Nat.lt_succ_self m)⟩ left_inv := fun i => by by_cases hi : i.val < m · simp only [dif_pos hi] have hne' : (ord' ⟨i.val, hi⟩).val ≠ v₀ := (ord' ⟨i.val, hi⟩).property simp only [dif_neg hne', Subtype.coe_eta, Equiv.symm_apply_apply] · have him : i.val = m := by omega simp only [dif_neg hi] exact Fin.ext him.symm right_inv := fun w => by by_cases hw : w = v₀ · subst hw; simp · simp only [dif_neg hw] have hlt : (ord'.symm ⟨w, hw⟩).val < m := (ord'.symm ⟨w, hw⟩).isLt simp only [dif_pos hlt, Fin.eta, Equiv.apply_symm_apply] } refine ⟨ord, fun i inst => ?_⟩ by_cases hi : i.val < m · have hord_i : ord i = (ord' ⟨i.val, hi⟩).val := dif_pos hi have hcard_eq : (Finset.univ.filter fun j : Fin (m + 1) => j < i ∧ H.Adj (ord i) (ord j)).card = (Finset.univ.filter fun j' : Fin m => j' < ⟨i.val, hi⟩ ∧ H'.Adj (ord' ⟨i.val, hi⟩) (ord' j')).card := by apply Finset.card_bij (fun j hj => ⟨j.val, lt_trans (Finset.mem_filter.1 hj).2.1 hi⟩) · intro j hj rcases Finset.mem_filter.1 hj with ⟨_, hji, hadj⟩ have hjlt : j.val < m := lt_trans hji hi have hord_j : ord j = (ord' ⟨j.val, hjlt⟩).val := dif_pos hjlt rw [hord_i, hord_j] at hadj exact Finset.mem_filter.2 ⟨Finset.mem_univ _, hji, hadj⟩ · intro j₁ _ j₂ _ h exact Fin.ext (by simpa using congrArg Fin.val h) · intro j' hj' rcases Finset.mem_filter.1 hj' with ⟨_, hj'i, hadj⟩ have hjlt : j'.val < m + 1 := Nat.lt_trans j'.isLt (Nat.lt_succ_self m) refine ⟨⟨j'.val, hjlt⟩, Finset.mem_filter.2 ⟨Finset.mem_univ _, hj'i, ?_⟩, Fin.ext rfl⟩ have hord_j : ord ⟨j'.val, hjlt⟩ = (ord' j').val := dif_pos j'.isLt rw [hord_i, hord_j] exact hadj rw [hcard_eq] exact hord' ⟨i.val, hi⟩ · have hord_i : ord i = v₀ := dif_neg hi have hle : (Finset.univ.filter fun j : Fin (m + 1) => j < i ∧ H.Adj (ord i) (ord j)).card ≤ (Finset.univ.filter (H.Adj v₀)).card := by have hcard_map : ((Finset.univ.filter fun j : Fin (m + 1) => j < i ∧ H.Adj (ord i) (ord j)).map ord.toEmbedding).card = (Finset.univ.filter fun j : Fin (m + 1) => j < i ∧ H.Adj (ord i) (ord j)).card := Finset.card_map _ rw [← hcard_map] apply Finset.card_le_card intro y hy rcases Finset.mem_map.1 hy with ⟨j, hj, rfl⟩ rcases Finset.mem_filter.1 hj with ⟨_, _, hadj⟩ rw [hord_i] at hadj exact Finset.mem_filter.2 ⟨Finset.mem_univ _, hadj⟩ exact hle.trans hv₀_deg exact hmain (Fintype.card V) G rfl hdeg end DegeneracyOrdering /-! ## Section 2: Self-Contained Finite Product-Space Symmetric Lovász Local Lemma -/ section SymmetricLLL /-- Auxiliary numeric lemma: `((D : ℝ) / (D + 1 : ℝ)) ^ D ≥ (Real.exp 1)⁻¹` for every `D : ℕ`. -/ lemma inv_exp_one_le_pow_div_succ (D : ℕ) : (Real.exp 1)⁻¹ ≤ ((D : ℝ) / ((D : ℝ) + 1)) ^ D := by rcases D with _ | D' · simp only [Nat.cast_zero, zero_add, zero_div, pow_zero] exact inv_le_one_of_one_le₀ (le_trans (by norm_num) (le_of_lt Real.exp_one_gt_d9)) · let dR : ℝ := (D' + 1 : ℕ) have hd_pos : (0 : ℝ) < dR := by positivity have hstep : (1 + 1 / dR) ^ (D' + 1) ≤ Real.exp 1 := by calc (1 + 1 / dR) ^ (D' + 1) = (1 / dR + 1) ^ (D' + 1) := by ring _ ≤ (Real.exp (1 / dR)) ^ (D' + 1) := pow_le_pow_left₀ (by positivity) (Real.add_one_le_exp (1 / dR)) _ _ = Real.exp (((D' + 1 : ℕ) : ℝ) * (1 / dR)) := (Real.exp_nat_mul _ _).symm _ = Real.exp 1 := by congr 1; dsimp only [dR]; field_simp have hinv : (1 + 1 / dR)⁻¹ = dR / (dR + 1) := by field_simp have hpos1 : (0 : ℝ) < (1 + 1 / dR) ^ (D' + 1) := by positivity have h1 : (Real.exp 1)⁻¹ ≤ ((1 + 1 / dR) ^ (D' + 1))⁻¹ := inv_anti₀ hpos1 hstep rw [← inv_pow, hinv] at h1 simpa [dR] using h1 /-- Product-space independence for finite function spaces `V → α`: if `P` depends only on `A` and `Q` depends only on `B` with `Disjoint A B`, then `|P ∧ Q| * |V → α| = |P| * |Q|`. -/ lemma card_filter_and_of_disjoint_supp {V α : Type*} [Fintype V] [DecidableEq V] [Fintype α] (A B : Finset V) (hdisj : Disjoint A B) (P Q : (V → α) → Prop) [DecidablePred P] [DecidablePred Q] (hP : ∀ f g : V → α, (∀ v ∈ A, f v = g v) → (P f ↔ P g)) (hQ : ∀ f g : V → α, (∀ v ∈ B, f v = g v) → (Q f ↔ Q g)) : (Finset.univ.filter fun f : V → α => P f ∧ Q f).card * Fintype.card (V → α) = (Finset.univ.filter P).card * (Finset.univ.filter Q).card := by classical -- Split `V → α` as `({v : V // v ∈ A} → α) × ({v : V // v ∉ A} → α)` let e : (V → α) ≃ (({v : V // v ∈ A} → α) × ({v : V // v ∉ A} → α)) := { toFun := fun f => (fun v => f v.1, fun v => f v.1) invFun := fun fg v => if hv : v ∈ A then fg.1 ⟨v, hv⟩ else fg.2 ⟨v, hv⟩ left_inv := fun f => by ext v; by_cases hv : v ∈ A <;> simp [hv] right_inv := fun ⟨f₁, f₂⟩ => by ext v · simp [v.2] · simp [v.2] } -- Handle `IsEmpty (V → α)` trivially by_cases hα : IsEmpty α · by_cases hV : IsEmpty V · have : Unique (V → α) := inferInstance have hcard1 : Fintype.card (V → α) = 1 := Fintype.card_unique simp only [hcard1, mul_one] have hf : ∀ f : V → α, f = default := fun f => Subsingleton.elim f default by_cases hp0 : P default <;> by_cases hq0 : Q default <;> simp [hf, hp0, hq0] · obtain ⟨v₀⟩ := not_isEmpty_iff.1 hV have : IsEmpty (V → α) := ⟨fun f => hα.false (f v₀)⟩ simp · obtain ⟨a₀⟩ := not_isEmpty_iff.1 hα let P' : ({v : V // v ∈ A} → α) → Prop := fun f₁ => P (fun v => if hv : v ∈ A then f₁ ⟨v, hv⟩ else a₀) let Q' : ({v : V // v ∉ A} → α) → Prop := fun f₂ => Q (fun v => if hv : v ∈ A then a₀ else f₂ ⟨v, hv⟩) have hP_eq : ∀ f : V → α, P f ↔ P' (e f).1 := fun f => by apply hP intro v hv; simp [e, hv] have hQ_eq : ∀ f : V → α, Q f ↔ Q' (e f).2 := fun f => by apply hQ intro v hv have hvA : v ∉ A := Finset.disjoint_right.1 hdisj hv simp [e, hvA] let SA := Finset.univ.filter P' let SB := Finset.univ.filter Q' have hcard_PQ : (Finset.univ.filter fun f : V → α => P f ∧ Q f).card = SA.card * SB.card := by rw [← Finset.card_product] apply Finset.card_bij (fun f _ => e f) · intro f hf rcases Finset.mem_filter.1 hf with ⟨_, hpf, hqf⟩ exact Finset.mem_product.2 ⟨Finset.mem_filter.2 ⟨Finset.mem_univ _, (hP_eq f).1 hpf⟩, Finset.mem_filter.2 ⟨Finset.mem_univ _, (hQ_eq f).1 hqf⟩⟩ · intro f₁ _ f₂ _ h; exact e.injective h · intro fg hfg rcases Finset.mem_product.1 hfg with ⟨h1, h2⟩ refine ⟨e.symm fg, Finset.mem_filter.2 ⟨Finset.mem_univ _, ?_, ?_⟩, e.apply_symm_apply fg⟩ · exact (hP_eq (e.symm fg)).2 (by simpa [e.apply_symm_apply] using (Finset.mem_filter.1 h1).2) · exact (hQ_eq (e.symm fg)).2 (by simpa [e.apply_symm_apply] using (Finset.mem_filter.1 h2).2) have hcard_P : (Finset.univ.filter P).card = SA.card * Fintype.card ({v : V // v ∉ A} → α) := by rw [← Finset.card_univ, ← Finset.card_product] apply Finset.card_bij (fun f _ => e f) · intro f hf exact Finset.mem_product.2 ⟨Finset.mem_filter.2 ⟨Finset.mem_univ _, (hP_eq f).1 (Finset.mem_filter.1 hf).2⟩, Finset.mem_univ _⟩ · intro f₁ _ f₂ _ h; exact e.injective h · intro fg hfg rcases Finset.mem_product.1 hfg with ⟨h1, _⟩ refine ⟨e.symm fg, Finset.mem_filter.2 ⟨Finset.mem_univ _, ?_⟩, e.apply_symm_apply fg⟩ exact (hP_eq (e.symm fg)).2 (by simpa [e.apply_symm_apply] using (Finset.mem_filter.1 h1).2) have hcard_Q : (Finset.univ.filter Q).card = Fintype.card ({v : V // v ∈ A} → α) * SB.card := by rw [← Finset.card_univ, ← Finset.card_product] apply Finset.card_bij (fun f _ => e f) · intro f hf exact Finset.mem_product.2 ⟨Finset.mem_univ _, Finset.mem_filter.2 ⟨Finset.mem_univ _, (hQ_eq f).1 (Finset.mem_filter.1 hf).2⟩⟩ · intro f₁ _ f₂ _ h; exact e.injective h · intro fg hfg rcases Finset.mem_product.1 hfg with ⟨_, h2⟩ refine ⟨e.symm fg, Finset.mem_filter.2 ⟨Finset.mem_univ _, ?_⟩, e.apply_symm_apply fg⟩ exact (hQ_eq (e.symm fg)).2 (by simpa [e.apply_symm_apply] using (Finset.mem_filter.1 h2).2) have hcard_all : Fintype.card (V → α) = Fintype.card ({v : V // v ∈ A} → α) * Fintype.card ({v : V // v ∉ A} → α) := by rw [Fintype.card_congr e, Fintype.card_prod] rw [hcard_PQ, hcard_P, hcard_Q, hcard_all] ring /-- **Symmetric Lovász Local Lemma on a Finite Product Space `V → α`** (100% self-contained elementary counting proof). -/ theorem symmetric_lll_finite_product {V α ι : Type*} [Fintype V] [DecidableEq V] [Fintype α] [Nonempty α] [DecidableEq ι] (I : Finset ι) (supp : ι → Finset V) (bad : ι → (V → α) → Prop) [∀ i, DecidablePred (bad i)] (hloc : ∀ i ∈ I, ∀ f g : V → α, (∀ v ∈ supp i, f v = g v) → (bad i f ↔ bad i g)) (p x : ℝ) (hx0 : 0 ≤ x) (hx1 : x < 1) (D : ℕ) (hprob : ∀ i ∈ I, ((Finset.univ.filter (bad i)).card : ℝ) ≤ p * (Fintype.card (V → α) : ℝ)) (hdep : ∀ i ∈ I, (I.filter fun j => j ≠ i ∧ ¬Disjoint (supp i) (supp j)).card ≤ D) (hlll : p ≤ x * (1 - x) ^ D) : ∃ f : V → α, ∀ i ∈ I, ¬bad i f := by classical let good : Finset ι → Finset (V → α) := fun S => Finset.univ.filter fun f => ∀ j ∈ S, ¬bad j f have hΩ_pos : (0 : ℝ) < (Fintype.card (V → α) : ℝ) := by exact_mod_cast Fintype.card_pos (α := V → α) -- Strong induction on `m = S.card` have hind : ∀ m : ℕ, ∀ S : Finset ι, S ⊆ I → S.card = m → (0 < (good S).card) ∧ ∀ i ∈ I, i ∉ S → (((good S).filter (bad i)).card : ℝ) ≤ x * ((good S).card : ℝ) := by intro m induction m using Nat.strong_induction_on with | _ m ih => intro S hSI hSm -- Part 1: `0 < (good S).card` have hgood_pos : 0 < (good S).card := by rcases Finset.eq_empty_or_nonempty S with rfl | ⟨j, hjS⟩ · simp only [good, Finset.notMem_empty, IsEmpty.forall_iff, implies_true, Finset.filter_true, Finset.card_univ] exact Fintype.card_pos · let S' := S.erase j have hS'I : S' ⊆ I := Finset.Subset.trans (Finset.erase_subset j S) hSI have hS'lt : S'.card < m := by have hposS : 0 < S.card := Finset.card_pos.2 ⟨j, hjS⟩ dsimp only [S']; rw [Finset.card_erase_of_mem hjS, hSm]; omega have ⟨hpos', hcond'⟩ := ih S'.card hS'lt S' hS'I rfl have hj_not : j ∉ S' := Finset.notMem_erase j S have hle_j : (((good S').filter (bad j)).card : ℝ) ≤ x * ((good S').card : ℝ) := hcond' j (hSI hjS) hj_not have hsplit : (good S).card + ((good S').filter (bad j)).card = (good S').card := by have hgood_eq : good S = (good S').filter (fun f => ¬bad j f) := by ext f simp only [good, Finset.mem_filter, Finset.mem_univ, true_and, S', Finset.mem_erase] constructor · intro h exact ⟨fun k ⟨_, hkS⟩ => h k hkS, h j hjS⟩ · rintro ⟨h1, h2⟩ k hkS by_cases hkj : k = j · subst hkj; exact h2 · exact h1 k ⟨hkj, hkS⟩ rw [hgood_eq, add_comm] exact Finset.card_filter_add_card_filter_not (s := good S') (p := bad j) have hreal : ((good S).card : ℝ) ≥ (1 - x) * ((good S').card : ℝ) := by have hsplitR : ((good S).card : ℝ) + (((good S').filter (bad j)).card : ℝ) = ((good S').card : ℝ) := by exact_mod_cast hsplit linarith have hposR : (0 : ℝ) < ((good S).card : ℝ) := by have h1 : (0 : ℝ) < (1 - x) * ((good S').card : ℝ) := mul_pos (by linarith) (by exact_mod_cast hpos') linarith exact_mod_cast hposR refine ⟨hgood_pos, ?_⟩ -- Part 2: conditional probability bound for `i ∈ I \ S` intro i hiI hiS let depI : Finset ι := I.filter fun j => j ≠ i ∧ ¬Disjoint (supp i) (supp j) let S₁ : Finset ι := S ∩ depI let S₂ : Finset ι := S \ S₁ have hS₁_le : S₁.card ≤ D := (Finset.card_le_card Finset.inter_subset_right).trans (hdep i hiI) have hS_union : S₂ ∪ S₁ = S := Finset.sdiff_union_of_subset Finset.inter_subset_left have hS₂_disj_S₁ : Disjoint S₂ S₁ := Finset.sdiff_disjoint -- Numerator bound: `((good S).filter (bad i)).card ≤ p * (good S₂).card` have hnum : (((good S).filter (bad i)).card : ℝ) ≤ p * ((good S₂).card : ℝ) := by have hsub_num : (good S).filter (bad i) ⊆ (good S₂).filter (bad i) := by intro f hf rcases Finset.mem_filter.1 hf with ⟨hfS, hbi⟩ refine Finset.mem_filter.2 ⟨Finset.mem_filter.2 ⟨Finset.mem_univ _, fun j hj => ?_⟩, hbi⟩ exact (Finset.mem_filter.1 hfS).2 j (Finset.sdiff_subset hj) have hle1 : (((good S).filter (bad i)).card : ℝ) ≤ (((good S₂).filter (bad i)).card : ℝ) := by exact_mod_cast Finset.card_le_card hsub_num -- Independence between `bad i` (support `supp i`) and `good S₂` (support `S₂.biUnion supp`) have hdisj_supp : Disjoint (supp i) (S₂.biUnion supp) := by rw [Finset.disjoint_biUnion_right] intro j hj have hjS : j ∈ S := Finset.sdiff_subset hj have hj_not_dep : j ∉ depI := fun h => (Finset.mem_sdiff.1 hj).2 (Finset.mem_inter.2 ⟨hjS, h⟩) have hji : j ≠ i := fun h => hiS (h ▸ hjS) by_contra hnd exact hj_not_dep (Finset.mem_filter.2 ⟨hSI hjS, hji, hnd⟩) have hQ_loc : ∀ f g : V → α, (∀ v ∈ S₂.biUnion supp, f v = g v) → ((∀ j ∈ S₂, ¬bad j f) ↔ (∀ j ∈ S₂, ¬bad j g)) := by intro f g hfg constructor <;> intro h j hj · rw [← hloc j (hSI (Finset.sdiff_subset hj)) f g (fun v hv => hfg v (Finset.mem_biUnion.2 ⟨j, hj, hv⟩))] exact h j hj · rw [hloc j (hSI (Finset.sdiff_subset hj)) f g (fun v hv => hfg v (Finset.mem_biUnion.2 ⟨j, hj, hv⟩))] exact h j hj have hindep := card_filter_and_of_disjoint_supp (supp i) (S₂.biUnion supp) hdisj_supp (bad i) (fun f => ∀ j ∈ S₂, ¬bad j f) (hloc i hiI) hQ_loc have hfilt_eq : (good S₂).filter (bad i) = Finset.univ.filter (fun f => bad i f ∧ ∀ j ∈ S₂, ¬bad j f) := by ext f; simp [good, and_comm] rw [← hfilt_eq] at hindep have hindepR : (((good S₂).filter (bad i)).card : ℝ) * (Fintype.card (V → α) : ℝ) = ((Finset.univ.filter (bad i)).card : ℝ) * ((good S₂).card : ℝ) := by exact_mod_cast hindep have hmul : (((good S₂).filter (bad i)).card : ℝ) * (Fintype.card (V → α) : ℝ) ≤ (p * ((good S₂).card : ℝ)) * (Fintype.card (V → α) : ℝ) := by rw [hindepR] calc ((Finset.univ.filter (bad i)).card : ℝ) * ((good S₂).card : ℝ) ≤ (p * (Fintype.card (V → α) : ℝ)) * ((good S₂).card : ℝ) := mul_le_mul_of_nonneg_right (hprob i hiI) (Nat.cast_nonneg _) _ = (p * ((good S₂).card : ℝ)) * (Fintype.card (V → α) : ℝ) := by ring have hle2 : (((good S₂).filter (bad i)).card : ℝ) ≤ p * ((good S₂).card : ℝ) := le_of_mul_le_mul_right hmul hΩ_pos exact hle1.trans hle2 -- Denominator bound: `(1 - x) ^ S₁.card * (good S₂).card ≤ (good S).card` have hden : (1 - x) ^ S₁.card * ((good S₂).card : ℝ) ≤ ((good S).card : ℝ) := by have htel : ∀ T : Finset ι, T ⊆ S₁ → (1 - x) ^ T.card * ((good S₂).card : ℝ) ≤ ((good (S₂ ∪ T)).card : ℝ) := by intro T induction T using Finset.induction_on with | empty => intro _; simp | @insert j T' hjT' ihT => intro hTsub have hT'sub : T' ⊆ S₁ := Finset.Subset.trans (Finset.subset_insert j T') hTsub have hjS₁ : j ∈ S₁ := hTsub (Finset.mem_insert_self j T') have hj_not_S₂ : j ∉ S₂ := Finset.disjoint_right.1 hS₂_disj_S₁ hjS₁ have hj_not_U : j ∉ S₂ ∪ T' := by simp [hj_not_S₂, hjT'] have hUsubS : S₂ ∪ T' ⊆ S := by rw [← hS_union] exact Finset.union_subset_union_right hT'sub have hUsubI : S₂ ∪ T' ⊆ I := Finset.Subset.trans hUsubS hSI have hUlt : (S₂ ∪ T').card < m := by rw [← hSm] apply Finset.card_lt_card exact Finset.ssubset_iff_subset_ne.2 ⟨hUsubS, fun h => hj_not_U (h ▸ Finset.inter_subset_left hjS₁)⟩ have hcondU := (ih (S₂ ∪ T').card hUlt (S₂ ∪ T') hUsubI rfl).2 j (hSI (Finset.inter_subset_left hjS₁)) hj_not_U have hgood_ins : good (S₂ ∪ insert j T') = (good (S₂ ∪ T')).filter (fun f => ¬bad j f) := by ext f simp only [good, Finset.mem_filter, Finset.mem_univ, true_and, Finset.mem_union, Finset.mem_insert] constructor · intro h exact ⟨fun k hk => h k (hk.elim Or.inl (fun h' => Or.inr (Or.inr h'))), h j (Or.inr (Or.inl rfl))⟩ · rintro ⟨h1, h2⟩ k (hk | rfl | hk) · exact h1 k (Or.inl hk) · exact h2 · exact h1 k (Or.inr hk) have hsplit : (good (S₂ ∪ insert j T')).card + ((good (S₂ ∪ T')).filter (bad j)).card = (good (S₂ ∪ T')).card := by rw [hgood_ins, add_comm] exact Finset.card_filter_add_card_filter_not (s := good (S₂ ∪ T')) (p := bad j) have hstep : (1 - x) * ((good (S₂ ∪ T')).card : ℝ) ≤ ((good (S₂ ∪ insert j T')).card : ℝ) := by have hsplitR : ((good (S₂ ∪ insert j T')).card : ℝ) + (((good (S₂ ∪ T')).filter (bad j)).card : ℝ) = ((good (S₂ ∪ T')).card : ℝ) := by exact_mod_cast hsplit linarith rw [Finset.card_insert_of_notMem hjT', pow_succ', mul_assoc] exact (mul_le_mul_of_nonneg_left (ihT hT'sub) (by linarith)).trans hstep simpa [hS_union] using htel S₁ Subset.rfl -- Combine numerator, denominator, and LLL inequality `p ≤ x * (1 - x)^D ≤ x * (1 - x)^S₁.card` have hpow_mono : (1 - x) ^ D ≤ (1 - x) ^ S₁.card := pow_le_pow_of_le_one (by linarith) (by linarith) hS₁_le calc (((good S).filter (bad i)).card : ℝ) ≤ p * ((good S₂).card : ℝ) := hnum _ ≤ (x * (1 - x) ^ D) * ((good S₂).card : ℝ) := mul_le_mul_of_nonneg_right hlll (Nat.cast_nonneg _) _ ≤ (x * (1 - x) ^ S₁.card) * ((good S₂).card : ℝ) := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hpow_mono hx0) (Nat.cast_nonneg _) _ = x * ((1 - x) ^ S₁.card * ((good S₂).card : ℝ)) := by ring _ ≤ x * ((good S).card : ℝ) := mul_le_mul_of_nonneg_left hden hx0 have hposI := (hind I.card I Subset.rfl rfl).1 obtain ⟨f, hf⟩ := Finset.card_pos.1 hposI exact ⟨f, (Finset.mem_filter.1 hf).2⟩ /-- **Standard Euler-Constant Symmetric LLL**: if `e * p * (D + 1) ≤ 1`, then there exists an assignment `f : V → α` avoiding every bad event `bad i`. -/ theorem symmetric_lll_exp {V α ι : Type*} [Fintype V] [DecidableEq V] [Fintype α] [Nonempty α] [DecidableEq ι] (I : Finset ι) (supp : ι → Finset V) (bad : ι → (V → α) → Prop) [∀ i, DecidablePred (bad i)] (hloc : ∀ i ∈ I, ∀ f g : V → α, (∀ v ∈ supp i, f v = g v) → (bad i f ↔ bad i g)) (p : ℝ) (D : ℕ) (hprob : ∀ i ∈ I, ((Finset.univ.filter (bad i)).card : ℝ) ≤ p * (Fintype.card (V → α) : ℝ)) (hdep : ∀ i ∈ I, (I.filter fun j => j ≠ i ∧ ¬Disjoint (supp i) (supp j)).card ≤ D) (hlll : Real.exp 1 * p * ((D : ℝ) + 1) ≤ 1) : ∃ f : V → α, ∀ i ∈ I, ¬bad i f := by by_cases hD0 : D = 0 · subst hD0 rcases Finset.eq_empty_or_nonempty I with rfl | ⟨i₀, hi₀⟩ · exact ⟨fun _ => Classical.arbitrary α, fun _ hi => (Finset.notMem_empty _ hi).elim⟩ · apply symmetric_lll_finite_product I supp bad hloc p (1 / 2) (by norm_num) (by norm_num) 0 hprob hdep simp only [Nat.cast_zero, zero_add, mul_one] at hlll have he2 : (2 : ℝ) ≤ Real.exp 1 := le_trans (by norm_num) (le_of_lt Real.exp_one_gt_d9) have hp_nonneg : 0 ≤ p := by have h1 := hprob i₀ hi₀ have hpos : (0 : ℝ) < (Fintype.card (V → α) : ℝ) := by exact_mod_cast Fintype.card_pos (α := V → α) nlinarith [Nat.cast_nonneg (α := ℝ) (Finset.univ.filter (bad i₀)).card] simp only [pow_zero, mul_one] nlinarith · have hDpos : (0 : ℝ) < (D : ℝ) := by exact_mod_cast Nat.pos_of_ne_zero hD0 let x : ℝ := 1 / ((D : ℝ) + 1) have hx0 : 0 ≤ x := by dsimp only [x]; positivity have hx1 : x < 1 := by dsimp only [x] rw [div_lt_one (by linarith)] linarith apply symmetric_lll_finite_product I supp bad hloc p x hx0 hx1 D hprob hdep have h1mx : 1 - x = (D : ℝ) / ((D : ℝ) + 1) := by dsimp only [x]; field_simp; ring rw [h1mx] have hpow := inv_exp_one_le_pow_div_succ D have hp_le : p ≤ (Real.exp 1)⁻¹ * x := by dsimp only [x] have h1 : (Real.exp 1)⁻¹ * (1 / ((D : ℝ) + 1)) = 1 / (Real.exp 1 * ((D : ℝ) + 1)) := by rw [one_div, one_div, mul_inv] rw [h1, le_div_iff₀ (by positivity)] linarith calc p ≤ (Real.exp 1)⁻¹ * x := hp_le _ = x * (Real.exp 1)⁻¹ := by ring _ ≤ x * ((D : ℝ) / ((D : ℝ) + 1)) ^ D := mul_le_mul_of_nonneg_left hpow hx0 end SymmetricLLL /-! ## Section 3: Exact Single-Edge Exponential-Tilt Tail Bound -/ section TailBound /-- Exact count of vertex colorings `g : V → Fin q` for which `g v ≠ g w` for all `w ∈ F` (assuming `v ∉ F`): `(q - 1) ^ F.card * q ^ (card V - F.card)`. -/ lemma card_good_single_coord {V : Type*} [Fintype V] [DecidableEq V] (q : ℕ) (hq : 1 ≤ q) (v : V) (F : Finset V) (hvF : v ∉ F) : ((Finset.univ.filter fun g : V → Fin q => ∀ w ∈ F, g v ≠ g w).card : ℝ) = (((q - 1 : ℕ) : ℝ) / (q : ℝ)) ^ F.card * (Fintype.card (V → Fin q) : ℝ) := by classical have : Nonempty (Fin q) := ⟨⟨0, by omega⟩⟩ -- Split `V → Fin q` by `v`, `F`, and `R = univ \ insert v F` let R : Finset V := Finset.univ \ insert v F have hcard_disj : Fintype.card V = 1 + F.card + R.card := by have h1 : (insert v F).card = 1 + F.card := by rw [Finset.card_insert_of_notMem hvF]; omega have h2 : (insert v F).card + R.card = (Finset.univ : Finset V).card := by dsimp only [R] rw [add_comm, Finset.card_sdiff_add_card_eq_card (Finset.subset_univ _)] rw [Finset.card_univ] at h2 omega -- Count by fiber over `c₀ = g v : Fin q` have hfiber : ∀ c₀ : Fin q, (Finset.univ.filter fun g : V → Fin q => g v = c₀ ∧ ∀ w ∈ F, g w ≠ c₀).card = (q - 1) ^ F.card * q ^ R.card := by intro c₀ let e : {g : V → Fin q // g v = c₀ ∧ ∀ w ∈ F, g w ≠ c₀} ≃ (({w : V // w ∈ F} → {c : Fin q // c ≠ c₀}) × ({u : V // u ∈ R} → Fin q)) := { toFun := fun ⟨g, _, hF⟩ => (fun w => ⟨g w.1, hF w.1 w.2⟩, fun u => g u.1) invFun := fun ⟨gF, gR⟩ => ⟨fun x => if hx : x = v then c₀ else if hxF : x ∈ F then (gF ⟨x, hxF⟩).1 else gR ⟨x, Finset.mem_sdiff.2 ⟨Finset.mem_univ _, by simp [hx, hxF]⟩⟩, by simp, fun w hw => by have hwv : w ≠ v := fun h => hvF (h ▸ hw) simp [hwv, hw, (gF ⟨w, hw⟩).2]⟩ left_inv := fun ⟨g, hgv, _⟩ => by ext x by_cases hx : x = v · subst hx; simp [hgv] · by_cases hxF : x ∈ F · simp [hx, hxF] · simp [hx, hxF] right_inv := fun ⟨gF, gR⟩ => by ext x · have hxv : x.1 ≠ v := fun h => hvF (h ▸ x.2) simp [hxv, x.2] · have hxR := Finset.mem_sdiff.1 x.2 have hxv : x.1 ≠ v := fun h => hxR.2 (h ▸ Finset.mem_insert_self v F) have hxF : x.1 ∉ F := fun h => hxR.2 (Finset.mem_insert_of_mem h) simp [hxv, hxF] } rw [← Fintype.card_subtype, Fintype.card_congr e, Fintype.card_prod, Fintype.card_fun, Fintype.card_fun, Fintype.card_coe, Fintype.card_coe, Fintype.card_fin] have hsub : Fintype.card {c : Fin q // c ≠ c₀} = q - 1 := by simp [Fintype.card_subtype_compl, Fintype.card_fin] rw [hsub] have hsum : (Finset.univ.filter fun g : V → Fin q => ∀ w ∈ F, g v ≠ g w).card = q * ((q - 1) ^ F.card * q ^ R.card) := by have hpart : (Finset.univ.filter fun g : V → Fin q => ∀ w ∈ F, g v ≠ g w).card = ∑ c₀ : Fin q, (Finset.univ.filter fun g : V → Fin q => g v = c₀ ∧ ∀ w ∈ F, g w ≠ c₀).card := by rw [← Finset.card_biUnion] · congr 1; ext g simp only [Finset.mem_filter, Finset.mem_univ, true_and, Finset.mem_biUnion] constructor · intro h; exact ⟨g v, rfl, fun w hw => (h w hw).symm⟩ · rintro ⟨c₀, rfl, h⟩ w hw; exact (h w hw).symm · intro c₁ _ c₂ _ hne show Disjoint _ _ rw [Finset.disjoint_left] intro g hg1 hg2 exact hne ((Finset.mem_filter.1 hg1).2.1.symm.trans (Finset.mem_filter.1 hg2).2.1) rw [hpart] simp only [hfiber, Finset.sum_const, Finset.card_univ, Fintype.card_fin, smul_eq_mul] rw [hsum, Fintype.card_fun, Fintype.card_fin, hcard_disj] have hq_pos : (q : ℝ) ≠ 0 := by positivity push_cast rw [div_pow, pow_add, pow_add, pow_one] field_simp /-- **Exponential-Tilt Binomial Tail Bound (Pure Finite Counting, Zero Measure Theory!)**: For `q = s + 1` (`1 ≤ s`), `v ∉ F`, `F.card ≤ s`, and `need ≥ 1`, the fraction of assignments `f : V → Fin L → Fin q` having fewer than `need` coordinates `i : Fin L` where `f v i ∉ f '' F` is at most `3 ^ (need - 1) * (1 - 2 / (3 * e)) ^ L`. -/ lemma card_bad_edge_le {V : Type*} [Fintype V] [DecidableEq V] (s L need : ℕ) (hs : 1 ≤ s) (hneed : 1 ≤ need) (v : V) (F : Finset V) (hvF : v ∉ F) (hFcard : F.card ≤ s) : ((Finset.univ.filter fun f : V → Fin L → Fin (s + 1) => (Finset.univ.filter fun i : Fin L => ∀ w ∈ F, f v i ≠ f w i).card < need).card : ℝ) ≤ (3 : ℝ) ^ (need - 1) * (1 - 2 / (3 * Real.exp 1)) ^ L * (Fintype.card (V → Fin L → Fin (s + 1)) : ℝ) := by classical let q := s + 1 let good1 : (V → Fin q) → Prop := fun g => ∀ w ∈ F, g v ≠ g w let w1 : (V → Fin q) → ℝ := fun g => if good1 g then (1 / 3 : ℝ) else 1 let W : (V → Fin L → Fin q) → ℝ := fun f => ∏ i : Fin L, w1 (fun x => f x i) -- Step 1: Lower bound `W f ≥ (1/3)^(need - 1)` on every bad `f` have hW_nonneg : ∀ f : V → Fin L → Fin q, 0 ≤ W f := fun f => Finset.prod_nonneg fun i _ => by dsimp only [w1]; split_ifs <;> norm_num have hW_bad : ∀ f : V → Fin L → Fin q, (Finset.univ.filter fun i : Fin L => good1 (fun x => f x i)).card < need → ((1 / 3 : ℝ) ^ (need - 1)) ≤ W f := by intro f hlt let Gf := Finset.univ.filter fun i : Fin L => good1 (fun x => f x i) have hprod_eq : W f = (1 / 3 : ℝ) ^ Gf.card := by dsimp only [W] rw [← Finset.prod_filter_mul_prod_filter_not Finset.univ (fun i => good1 (fun x => f x i))] have h1 : ∏ i ∈ Gf, w1 (fun x => f x i) = (1 / 3 : ℝ) ^ Gf.card := by calc ∏ i ∈ Gf, w1 (fun x => f x i) = ∏ _i ∈ Gf, (1 / 3 : ℝ) := Finset.prod_congr rfl fun i hi => if_pos (Finset.mem_filter.1 hi).2 _ = (1 / 3 : ℝ) ^ Gf.card := Finset.prod_const _ have h2 : ∏ i ∈ Finset.univ.filter (fun i => ¬good1 (fun x => f x i)), w1 (fun x => f x i) = 1 := by calc ∏ i ∈ Finset.univ.filter (fun i => ¬good1 (fun x => f x i)), w1 (fun x => f x i) = ∏ _i ∈ Finset.univ.filter (fun i => ¬good1 (fun x => f x i)), (1 : ℝ) := Finset.prod_congr rfl fun i hi => if_neg (Finset.mem_filter.1 hi).2 _ = 1 := Finset.prod_const_one rw [h1, h2, mul_one] rw [hprod_eq] have hGf_le : Gf.card ≤ need - 1 := by dsimp only [Gf]; omega exact pow_le_pow_of_le_one (by norm_num) (by norm_num) hGf_le have hmarkov : ((1 / 3 : ℝ) ^ (need - 1)) * ((Finset.univ.filter fun f : V → Fin L → Fin q => (Finset.univ.filter fun i : Fin L => good1 (fun x => f x i)).card < need).card : ℝ) ≤ ∑ f : V → Fin L → Fin q, W f := by calc ((1 / 3 : ℝ) ^ (need - 1)) * ((Finset.univ.filter fun f : V → Fin L → Fin q => (Finset.univ.filter fun i : Fin L => good1 (fun x => f x i)).card < need).card : ℝ) = ∑ _f ∈ Finset.univ.filter (fun f : V → Fin L → Fin q => (Finset.univ.filter fun i : Fin L => good1 (fun x => f x i)).card < need), ((1 / 3 : ℝ) ^ (need - 1)) := by rw [Finset.sum_const, nsmul_eq_mul, mul_comm] _ ≤ ∑ f ∈ Finset.univ.filter (fun f : V → Fin L → Fin q => (Finset.univ.filter fun i : Fin L => good1 (fun x => f x i)).card < need), W f := Finset.sum_le_sum fun f hf => hW_bad f (Finset.mem_filter.1 hf).2 _ ≤ ∑ f : V → Fin L → Fin q, W f := Finset.sum_le_univ_sum_of_nonneg hW_nonneg -- Step 2: Factor `∑ f, W f = (∑ g : V → Fin q, w1 g) ^ L` via `Fintype.prod_sum` have hfactor : ∑ f : V → Fin L → Fin q, W f = (∑ g : V → Fin q, w1 g) ^ L := by let swap : (V → Fin L → Fin q) ≃ (Fin L → (V → Fin q)) := Equiv.piComm (fun _ _ => Fin q) calc ∑ f : V → Fin L → Fin q, W f = ∑ h : Fin L → (V → Fin q), ∏ i : Fin L, w1 (h i) := Fintype.sum_equiv swap _ _ (fun f => rfl) _ = ∏ _i : Fin L, ∑ g : V → Fin q, w1 g := (Fintype.prod_sum (fun (_ : Fin L) (g : V → Fin q) => w1 g)).symm _ = (∑ g : V → Fin q, w1 g) ^ L := by rw [Finset.prod_const, Finset.card_univ, Fintype.card_fin] -- Step 3: Upper bound `∑ g, w1 g ≤ (1 - 2 / (3 * e)) * card (V → Fin q)` have hsingle : ∑ g : V → Fin q, w1 g ≤ (1 - 2 / (3 * Real.exp 1)) * (Fintype.card (V → Fin q) : ℝ) := by have hsplit : ∑ g : V → Fin q, w1 g = (Fintype.card (V → Fin q) : ℝ) - (2 / 3 : ℝ) * ((Finset.univ.filter good1).card : ℝ) := by have h1 : ∑ g : V → Fin q, w1 g = ∑ g ∈ Finset.univ.filter good1, (1 / 3 : ℝ) + ∑ g ∈ Finset.univ.filter (fun g => ¬good1 g), (1 : ℝ) := by rw [← Finset.sum_filter_add_sum_filter_not Finset.univ good1] congr 1 · exact Finset.sum_congr rfl fun g hg => if_pos (Finset.mem_filter.1 hg).2 · exact Finset.sum_congr rfl fun g hg => if_neg (Finset.mem_filter.1 hg).2 have h2 : (Finset.univ.filter good1).card + (Finset.univ.filter (fun g => ¬good1 g)).card = Fintype.card (V → Fin q) := by simpa [Finset.card_univ] using Finset.card_filter_add_card_filter_not (s := (Finset.univ : Finset (V → Fin q))) (p := good1) have h2R : ((Finset.univ.filter good1).card : ℝ) + ((Finset.univ.filter (fun g => ¬good1 g)).card : ℝ) = (Fintype.card (V → Fin q) : ℝ) := by exact_mod_cast h2 rw [h1, Finset.sum_const, Finset.sum_const, nsmul_eq_mul, nsmul_eq_mul] linarith rw [hsplit] have hgood_card := card_good_single_coord q (by omega) v F hvF have hratio : (Real.exp 1)⁻¹ ≤ (((q - 1 : ℕ) : ℝ) / (q : ℝ)) ^ F.card := by have hq1 : ((q - 1 : ℕ) : ℝ) / (q : ℝ) = (s : ℝ) / ((s : ℝ) + 1) := by dsimp only [q]; simp [Nat.cast_add] rw [hq1] have hle1 : (s : ℝ) / ((s : ℝ) + 1) ≤ 1 := by rw [div_le_one (by positivity)]; linarith exact (inv_exp_one_le_pow_div_succ s).trans (pow_le_pow_of_le_one (by positivity) hle1 hFcard) have hgood_ge : (Real.exp 1)⁻¹ * (Fintype.card (V → Fin q) : ℝ) ≤ ((Finset.univ.filter good1).card : ℝ) := by rw [hgood_card] exact mul_le_mul_of_nonneg_right hratio (Nat.cast_nonneg _) have hdiv : 2 / (3 * Real.exp 1) = (2 / 3 : ℝ) * (Real.exp 1)⁻¹ := by ring rw [hdiv] nlinarith -- Step 4: Raise to `L` and multiply by `3^(need - 1)` have hsum_nonneg : 0 ≤ ∑ g : V → Fin q, w1 g := Finset.sum_nonneg fun g _ => by dsimp only [w1]; split_ifs <;> norm_num have hcard_eq : (Fintype.card (V → Fin L → Fin q) : ℝ) = (Fintype.card (V → Fin q) : ℝ) ^ L := by have hnat : Fintype.card (V → Fin L → Fin q) = (Fintype.card (V → Fin q)) ^ L := by simp only [Fintype.card_fun, Fintype.card_fin] rw [← pow_mul, mul_comm, pow_mul] exact_mod_cast hnat have hpow_le : (∑ g : V → Fin q, w1 g) ^ L ≤ (1 - 2 / (3 * Real.exp 1)) ^ L * (Fintype.card (V → Fin L → Fin q) : ℝ) := by rw [hcard_eq, ← mul_pow] exact pow_le_pow_left₀ hsum_nonneg hsingle L have h3pow : (3 : ℝ) ^ (need - 1) * ((1 / 3 : ℝ) ^ (need - 1)) = 1 := by rw [← mul_pow]; norm_num have hcomb := hmarkov.trans (hfactor.symm ▸ hpow_le) calc ((Finset.univ.filter fun f : V → Fin L → Fin q => (Finset.univ.filter fun i : Fin L => good1 (fun x => f x i)).card < need).card : ℝ) = (3 : ℝ) ^ (need - 1) * (((1 / 3 : ℝ) ^ (need - 1)) * ((Finset.univ.filter fun f : V → Fin L → Fin q => (Finset.univ.filter fun i : Fin L => good1 (fun x => f x i)).card < need).card : ℝ)) := by rw [← mul_assoc, h3pow, one_mul] _ ≤ (3 : ℝ) ^ (need - 1) * ((1 - 2 / (3 * Real.exp 1)) ^ L * (Fintype.card (V → Fin L → Fin q) : ℝ)) := mul_le_mul_of_nonneg_left hcomb (by positivity) _ = (3 : ℝ) ^ (need - 1) * (1 - 2 / (3 * Real.exp 1)) ^ L * (Fintype.card (V → Fin L → Fin q) : ℝ) := by ring end TailBound /-! ## Section 4: Master Injective Edge Coloring Theorem (`O(d² log Δ + d³)` and `O(d² log Δ)`) -/ section MainTheorem /-- Explicit number of random-hash coordinates `L` for our theorem. -/ noncomputable def coordCount (d Δ need : ℕ) : ℕ := Nat.ceil ((1 + ((need - 1 : ℕ) : ℝ) * Real.log 3 + Real.log (3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3)) / (-Real.log (1 - 2 / (3 * Real.exp 1)))) /-- Our world-record upper bound on `χ'_{inj}(G)` for general `d`-degenerate graphs (`d ≥ 1, Δ ≥ 2`): `(2d² + d) * coordCount d Δ d = O(d² log Δ + d³)`. -/ noncomputable def worldRecordBound (d Δ : ℕ) : ℕ := (2 * d * d + d) * coordCount d Δ d /-- Our pure `O(d² log Δ)` upper bound for triangle-free `d`-degenerate graphs (ZERO `d³` term!). -/ noncomputable def triangleFreeBound (d Δ : ℕ) : ℕ := (2 * d * d + d) * coordCount d Δ 1 /-- Standing world record of Bradshaw, Clow & Xu (*European Journal of Combinatorics*, 2025): `⌈4 e d ln Δ⌉ * (2d + 1) * (d + 1) = O(d³ log Δ)`. -/ noncomputable def bradshawClowXuBound (d Δ : ℕ) : ℕ := Nat.ceil (4 * Real.exp 1 * (d : ℝ) * Real.log (Δ : ℝ)) * (2 * d + 1) * (d + 1) /-- Elementary helper: `0 < 1 - 2 / (3 * e) < 1`, so `0 < -Real.log (1 - 2 / (3 * e))`. -/ lemma neg_log_base_pos : 0 < -Real.log (1 - 2 / (3 * Real.exp 1)) := by have he : (2 : ℝ) < Real.exp 1 := lt_trans (by norm_num) Real.exp_one_gt_d9 have hpos : (0 : ℝ) < 1 - 2 / (3 * Real.exp 1) := by rw [sub_pos, div_lt_one (by positivity)]; linarith have hlt1 : 1 - 2 / (3 * Real.exp 1) < 1 := by have : 0 < 2 / (3 * Real.exp 1) := by positivity linarith have hlog_neg : Real.log (1 - 2 / (3 * Real.exp 1)) < 0 := Real.log_neg hpos hlt1 linarith /-- Key LLL numeric check: `L = coordCount d Δ need` satisfies the exact Euler-constant LLL condition `e * 3^(need - 1) * (1 - 2 / (3 * e))^L * (3 * (d + 1)^3 * Δ^3) ≤ 1`. -/ lemma coordCount_satisfies_lll {d Δ need : ℕ} (hΔ : 1 ≤ Δ) : Real.exp 1 * ((3 : ℝ) ^ (need - 1) * (1 - 2 / (3 * Real.exp 1)) ^ coordCount d Δ need) * (3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3) ≤ 1 := by have hbase_pos : 0 < 1 - 2 / (3 * Real.exp 1) := by have he : (2 : ℝ) < Real.exp 1 := lt_trans (by norm_num) Real.exp_one_gt_d9 rw [sub_pos, div_lt_one (by positivity)]; linarith have hneg_pos := neg_log_base_pos have hΔpos : (0 : ℝ) < (Δ : ℝ) := by exact_mod_cast (by omega : 0 < Δ) have hDpos : (0 : ℝ) < 3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3 := by positivity have hceil : (1 + ((need - 1 : ℕ) : ℝ) * Real.log 3 + Real.log (3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3)) / (-Real.log (1 - 2 / (3 * Real.exp 1))) ≤ (coordCount d Δ need : ℝ) := Nat.le_ceil _ have hmul : 1 + ((need - 1 : ℕ) : ℝ) * Real.log 3 + Real.log (3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3) ≤ (coordCount d Δ need : ℝ) * (-Real.log (1 - 2 / (3 * Real.exp 1))) := (div_le_iff₀ hneg_pos).1 hceil have hlog_sum : Real.log (Real.exp 1 * ((3 : ℝ) ^ (need - 1) * (1 - 2 / (3 * Real.exp 1)) ^ coordCount d Δ need) * (3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3)) ≤ 0 := by rw [Real.log_mul (by positivity) (ne_of_gt hDpos), Real.log_mul (ne_of_gt (Real.exp_pos 1)) (by positivity), Real.log_mul (by positivity) (by positivity), Real.log_exp, Real.log_pow, Real.log_pow] linarith have hprod_pos : 0 < Real.exp 1 * ((3 : ℝ) ^ (need - 1) * (1 - 2 / (3 * Real.exp 1)) ^ coordCount d Δ need) * (3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3) := by positivity calc Real.exp 1 * ((3 : ℝ) ^ (need - 1) * (1 - 2 / (3 * Real.exp 1)) ^ coordCount d Δ need) * (3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3) = Real.exp (Real.log (Real.exp 1 * ((3 : ℝ) ^ (need - 1) * (1 - 2 / (3 * Real.exp 1)) ^ coordCount d Δ need) * (3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3))) := (Real.exp_log hprod_pos).symm _ ≤ Real.exp 0 := Real.exp_le_exp.2 hlog_sum _ = 1 := Real.exp_zero /-- **Unified Master Theorem**: Let `G` be a finite `d`-degenerate graph (`d ≥ 1`, `Δ = maxDeg G ≥ 2`) with forward `d`-degeneracy orientation `u → v` (`ord⁻¹ v < ord⁻¹ u`). Suppose `need ≥ 1` exceeds the number of directed triangle pivots `b ∈ N⁺(u) ∩ N⁻(v)` for every directed edge `u → v` (which holds with `need = d` for ALL `d`-degenerate graphs and with `need = 1` for ALL triangle-free `d`-degenerate graphs!). Then `G` admits an injective edge coloring with `(2 * d * d + d) * coordCount d Δ need` colors! -/ theorem injective_edge_coloring_of_degenerate_core {V : Type*} [Fintype V] (G : SimpleGraph V) {d need : ℕ} (hd : 1 ≤ d) (hΔ : 2 ≤ maxDeg G) (hneed : 1 ≤ need) (hdeg : IsDegenerate G d) (htri : d ≤ need ∨ IsTriangleFree G) : IsInjectiveEdgeColorable G ((2 * d * d + d) * coordCount d (maxDeg G) need) := by classical let n := Fintype.card V let Δ := maxDeg G let s := 2 * d * d + d - 1 let q := s + 1 let L := coordCount d Δ need have hs : 1 ≤ s := by dsimp only [s] have hdd : 1 ≤ 2 * d * d := by nlinarith omega have hq_eq : q = 2 * d * d + d := by dsimp only [q, s]; omega have hL_pos : 1 ≤ L := by have hneg_pos := neg_log_base_pos have hD_gt1 : (1 : ℝ) < 3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3 := by have hd1 : (1 : ℝ) ≤ ((d + 1 : ℕ) : ℝ) ^ 3 := one_le_pow₀ (by exact_mod_cast (by omega : 1 ≤ d + 1)) have hΔ2 : (1 : ℝ) ≤ (Δ : ℝ) ^ 3 := one_le_pow₀ (by exact_mod_cast (by omega : 1 ≤ Δ)) nlinarith have hlogD : 0 < Real.log (3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3) := Real.log_pos hD_gt1 have hlog3 : 0 ≤ Real.log 3 := Real.log_nonneg (by norm_num) have hnum_pos : 0 < 1 + ((need - 1 : ℕ) : ℝ) * Real.log 3 + Real.log (3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3) := by positivity have hfrac_pos : 0 < (1 + ((need - 1 : ℕ) : ℝ) * Real.log 3 + Real.log (3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3)) / (-Real.log (1 - 2 / (3 * Real.exp 1))) := div_pos hnum_pos hneg_pos exact Nat.ceil_pos.2 hfrac_pos -- Step 1: Forward `d`-degeneracy ordering `ord : Fin n ≃ V` obtain ⟨ord, hord⟩ := exists_forward_degeneracy_ordering G d hdeg -- Directed out-neighborhood: `u → v` iff `G.Adj u v ∧ ord.symm v < ord.symm u` let outN : V → Finset V := fun u => Finset.univ.filter fun v => G.Adj u v ∧ ord.symm v < ord.symm u have houtN_card : ∀ u : V, (outN u).card ≤ d := by intro u let i := ord.symm u have hbij : (outN u).card = (Finset.univ.filter fun j : Fin n => j < i ∧ G.Adj (ord i) (ord j)).card := by apply Finset.card_bij (fun v _ => ord.symm v) · intro v hv rcases Finset.mem_filter.1 hv with ⟨_, hadj, hlt⟩ exact Finset.mem_filter.2 ⟨Finset.mem_univ _, hlt, by simpa [i] using hadj⟩ · intro v₁ _ v₂ _ h; exact ord.symm.injective h · intro j hj rcases Finset.mem_filter.1 hj with ⟨_, hlt, hadj⟩ refine ⟨ord j, Finset.mem_filter.2 ⟨Finset.mem_univ _, ?_, ?_⟩, ord.symm_apply_apply j⟩ · simpa [i] using hadj · simpa [i] using hlt rw [hbij] exact hord i -- Directed edge set `I ⊆ V × V` let I : Finset (V × V) := Finset.univ.filter fun uv => uv.2 ∈ outN uv.1 -- Forbidden vertex set `F(u, v)` for each directed edge `u → v` let Fset : V × V → Finset V := fun uv => let u := uv.1 let v := uv.2 ((outN u).erase v) ∪ (((outN u).erase v).biUnion fun b => (outN b).erase v) ∪ (outN v) ∪ ((outN v).biUnion outN) have hv_notMem_F : ∀ uv ∈ I, uv.2 ∉ Fset uv := by intro ⟨u, v⟩ huv dsimp only [Fset] simp only [Finset.mem_union, Finset.mem_erase, Finset.mem_biUnion, not_or, not_exists, not_and] refine ⟨⟨⟨fun h _ => h rfl, fun b _ h _ => h rfl⟩, fun hv => ?_⟩, fun b hb hvb => ?_⟩ · have hlt := (Finset.mem_filter.1 hv).2.2 exact lt_irrefl _ hlt · have h1 := (Finset.mem_filter.1 hb).2.2 have h2 := (Finset.mem_filter.1 hvb).2.2 exact lt_irrefl _ (lt_trans h2 h1) have hFset_card : ∀ uv ∈ I, (Fset uv).card ≤ s := by intro ⟨u, v⟩ huv have hv_in : v ∈ outN u := (Finset.mem_filter.1 huv).2 have h1 : ((outN u).erase v).card ≤ d - 1 := by rw [Finset.card_erase_of_mem hv_in] exact Nat.sub_le_sub_right (houtN_card u) 1 have h2 : (((outN u).erase v).biUnion fun b => (outN b).erase v).card ≤ (d - 1) * d := by calc (((outN u).erase v).biUnion fun b => (outN b).erase v).card ≤ ∑ b ∈ (outN u).erase v, ((outN b).erase v).card := Finset.card_biUnion_le _ ≤ ∑ _b ∈ (outN u).erase v, d := Finset.sum_le_sum fun b _ => (Finset.card_erase_le).trans (houtN_card b) _ = ((outN u).erase v).card * d := by simp _ ≤ (d - 1) * d := Nat.mul_le_mul_right d h1 have h3 : (outN v).card ≤ d := houtN_card v have h4 : ((outN v).biUnion outN).card ≤ d * d := by calc ((outN v).biUnion outN).card ≤ ∑ b ∈ outN v, (outN b).card := Finset.card_biUnion_le _ ≤ ∑ _b ∈ outN v, d := Finset.sum_le_sum fun b _ => houtN_card b _ = (outN v).card * d := by simp _ ≤ d * d := Nat.mul_le_mul_right d h3 have hu1 := Finset.card_union_le (((outN u).erase v) ∪ (((outN u).erase v).biUnion fun b => (outN b).erase v) ∪ outN v) ((outN v).biUnion outN) have hu2 := Finset.card_union_le (((outN u).erase v) ∪ (((outN u).erase v).biUnion fun b => (outN b).erase v)) (outN v) have hu3 := Finset.card_union_le ((outN u).erase v) (((outN u).erase v).biUnion fun b => (outN b).erase v) have hmul : (d - 1) * d + d = d * d := by cases d with | zero => omega | succ d' => simp [Nat.add_mul] have h2dd : 2 * d * d = d * d + d * d := by ring dsimp only [Fset, s] omega -- Support `supp uv = insert uv.2 (Fset uv)` let supp : V × V → Finset V := fun uv => insert uv.2 (Fset uv) have hsupp_card : ∀ uv ∈ I, (supp uv).card ≤ 2 * d * d + d := by intro uv huv have h1 := Finset.card_insert_le uv.2 (Fset uv) have h2 := hFset_card uv huv dsimp only [supp, s] at h1 h2 ⊢ omega -- Count directed edges `uv' ∈ I` whose support contains a given vertex `z : V`! have hcontain_z : ∀ z : V, (I.filter fun uv => z ∈ supp uv).card ≤ Δ ^ 3 + d * Δ ^ 2 + d * Δ := by intro z let A1 : Finset (V × V) := (G.neighborFinset z).image fun u => (u, z) let A2 : Finset (V × V) := ((G.neighborFinset z).filter fun u => z ∈ outN u).biUnion fun u => ((outN u).erase z).image fun v => (u, v) let A3 : Finset (V × V) := (G.neighborFinset z).biUnion fun b => ((G.neighborFinset b).filter fun u => b ∈ outN u).biUnion fun u => ((outN u).erase b).image fun v => (u, v) let A4 : Finset (V × V) := (G.neighborFinset z).biUnion fun v => (G.neighborFinset v).image fun u => (u, v) let A5 : Finset (V × V) := (G.neighborFinset z).biUnion fun b => (G.neighborFinset b).biUnion fun v => (G.neighborFinset v).image fun u => (u, v) have hsub : I.filter (fun uv => z ∈ supp uv) ⊆ A1 ∪ A2 ∪ A3 ∪ A4 ∪ A5 := by intro ⟨u, v⟩ huv rcases Finset.mem_filter.1 huv with ⟨huvI, hz⟩ have huv_adj : G.Adj u v := (Finset.mem_filter.1 (Finset.mem_filter.1 huvI).2).2.1 rcases Finset.mem_insert.1 hz with rfl | hzF · exact Finset.mem_union_left _ (Finset.mem_union_left _ (Finset.mem_union_left _ (Finset.mem_union_left _ (Finset.mem_image_of_mem _ ((SimpleGraph.mem_neighborFinset G z u).2 huv_adj.symm))))) · dsimp only [Fset] at hzF rcases Finset.mem_union.1 hzF with hz123 | hz4 · rcases Finset.mem_union.1 hz123 with hz12 | hz3 · rcases Finset.mem_union.1 hz12 with hz1 | hz2 · rcases Finset.mem_erase.1 hz1 with ⟨hzv, hz_out⟩ have huz : G.Adj u z := (Finset.mem_filter.1 hz_out).2.1 refine Finset.mem_union_left _ (Finset.mem_union_left _ (Finset.mem_union_left _ (Finset.mem_union_right _ (Finset.mem_biUnion.2 ⟨u, Finset.mem_filter.2 ⟨(SimpleGraph.mem_neighborFinset G z u).2 huz.symm, hz_out⟩, Finset.mem_image_of_mem _ (Finset.mem_erase.2 ⟨hzv.symm, (Finset.mem_filter.1 huvI).2⟩)⟩)))) · rcases Finset.mem_biUnion.1 hz2 with ⟨b, hb_er, hz_er⟩ rcases Finset.mem_erase.1 hb_er with ⟨hbv, hb_out⟩ have hub : G.Adj u b := (Finset.mem_filter.1 hb_out).2.1 have hbz : G.Adj b z := (Finset.mem_filter.1 (Finset.mem_of_mem_erase hz_er)).2.1 refine Finset.mem_union_left _ (Finset.mem_union_left _ (Finset.mem_union_right _ (Finset.mem_biUnion.2 ⟨b, (SimpleGraph.mem_neighborFinset G z b).2 hbz.symm, Finset.mem_biUnion.2 ⟨u, Finset.mem_filter.2 ⟨(SimpleGraph.mem_neighborFinset G b u).2 hub.symm, hb_out⟩, Finset.mem_image_of_mem _ (Finset.mem_erase.2 ⟨hbv.symm, (Finset.mem_filter.1 huvI).2⟩)⟩⟩))) · have hvz : G.Adj v z := (Finset.mem_filter.1 hz3).2.1 refine Finset.mem_union_left _ (Finset.mem_union_right _ (Finset.mem_biUnion.2 ⟨v, (SimpleGraph.mem_neighborFinset G z v).2 hvz.symm, Finset.mem_image_of_mem _ ((SimpleGraph.mem_neighborFinset G v u).2 huv_adj.symm)⟩)) · rcases Finset.mem_biUnion.1 hz4 with ⟨b, hb_out, hz_out⟩ have hvb : G.Adj v b := (Finset.mem_filter.1 hb_out).2.1 have hbz : G.Adj b z := (Finset.mem_filter.1 hz_out).2.1 refine Finset.mem_union_right _ (Finset.mem_biUnion.2 ⟨b, (SimpleGraph.mem_neighborFinset G z b).2 hbz.symm, Finset.mem_biUnion.2 ⟨v, (SimpleGraph.mem_neighborFinset G b v).2 hvb.symm, Finset.mem_image_of_mem _ ((SimpleGraph.mem_neighborFinset G v u).2 huv_adj.symm)⟩⟩) have hA1 : A1.card ≤ Δ := Finset.card_image_le.trans (by rw [← SimpleGraph.degree]; exact degree_le_maxDeg G z) have hA2 : A2.card ≤ Δ * (d - 1) := by calc A2.card ≤ ∑ u ∈ (G.neighborFinset z).filter (fun u => z ∈ outN u), (((outN u).erase z).image fun v => (u, v)).card := Finset.card_biUnion_le _ ≤ ∑ _u ∈ (G.neighborFinset z).filter (fun u => z ∈ outN u), (d - 1) := by apply Finset.sum_le_sum intro u hu have hz_in : z ∈ outN u := (Finset.mem_filter.1 hu).2 calc (((outN u).erase z).image fun v => (u, v)).card ≤ ((outN u).erase z).card := Finset.card_image_le _ = (outN u).card - 1 := Finset.card_erase_of_mem hz_in _ ≤ d - 1 := Nat.sub_le_sub_right (houtN_card u) 1 _ = ((G.neighborFinset z).filter (fun u => z ∈ outN u)).card * (d - 1) := by simp _ ≤ Δ * (d - 1) := Nat.mul_le_mul_right _ ((Finset.card_filter_le _ _).trans (by rw [← SimpleGraph.degree]; exact degree_le_maxDeg G z)) have hA3 : A3.card ≤ Δ * Δ * (d - 1) := by calc A3.card ≤ ∑ b ∈ G.neighborFinset z, (((G.neighborFinset b).filter fun u => b ∈ outN u).biUnion fun u => ((outN u).erase b).image fun v => (u, v)).card := Finset.card_biUnion_le _ ≤ ∑ _b ∈ G.neighborFinset z, (Δ * (d - 1)) := by apply Finset.sum_le_sum intro b _ calc (((G.neighborFinset b).filter fun u => b ∈ outN u).biUnion fun u => ((outN u).erase b).image fun v => (u, v)).card ≤ ∑ u ∈ (G.neighborFinset b).filter (fun u => b ∈ outN u), (((outN u).erase b).image fun v => (u, v)).card := Finset.card_biUnion_le _ ≤ ∑ _u ∈ (G.neighborFinset b).filter (fun u => b ∈ outN u), (d - 1) := by apply Finset.sum_le_sum intro u hu have hb_in : b ∈ outN u := (Finset.mem_filter.1 hu).2 calc (((outN u).erase b).image fun v => (u, v)).card ≤ ((outN u).erase b).card := Finset.card_image_le _ = (outN u).card - 1 := Finset.card_erase_of_mem hb_in _ ≤ d - 1 := Nat.sub_le_sub_right (houtN_card u) 1 _ = ((G.neighborFinset b).filter (fun u => b ∈ outN u)).card * (d - 1) := by simp _ ≤ Δ * (d - 1) := Nat.mul_le_mul_right _ ((Finset.card_filter_le _ _).trans (by rw [← SimpleGraph.degree]; exact degree_le_maxDeg G b)) _ = (G.neighborFinset z).card * (Δ * (d - 1)) := by simp _ ≤ Δ * (Δ * (d - 1)) := Nat.mul_le_mul_right _ (by rw [← SimpleGraph.degree]; exact degree_le_maxDeg G z) _ = Δ * Δ * (d - 1) := by ring have hA4 : A4.card ≤ Δ * Δ := by calc A4.card ≤ ∑ v ∈ G.neighborFinset z, ((G.neighborFinset v).image fun u => (u, v)).card := Finset.card_biUnion_le _ ≤ ∑ _v ∈ G.neighborFinset z, Δ := Finset.sum_le_sum fun v _ => Finset.card_image_le.trans (by rw [← SimpleGraph.degree]; exact degree_le_maxDeg G v) _ = (G.neighborFinset z).card * Δ := by simp _ ≤ Δ * Δ := Nat.mul_le_mul_right _ (by rw [← SimpleGraph.degree]; exact degree_le_maxDeg G z) have hA5 : A5.card ≤ Δ * Δ * Δ := by calc A5.card ≤ ∑ b ∈ G.neighborFinset z, ((G.neighborFinset b).biUnion fun v => (G.neighborFinset v).image fun u => (u, v)).card := Finset.card_biUnion_le _ ≤ ∑ _b ∈ G.neighborFinset z, (Δ * Δ) := by apply Finset.sum_le_sum intro b _ calc ((G.neighborFinset b).biUnion fun v => (G.neighborFinset v).image fun u => (u, v)).card ≤ ∑ v ∈ G.neighborFinset b, ((G.neighborFinset v).image fun u => (u, v)).card := Finset.card_biUnion_le _ ≤ ∑ _v ∈ G.neighborFinset b, Δ := Finset.sum_le_sum fun v _ => Finset.card_image_le.trans (by rw [← SimpleGraph.degree]; exact degree_le_maxDeg G v) _ = (G.neighborFinset b).card * Δ := by simp _ ≤ Δ * Δ := Nat.mul_le_mul_right _ (by rw [← SimpleGraph.degree]; exact degree_le_maxDeg G b) _ = (G.neighborFinset z).card * (Δ * Δ) := by simp _ ≤ Δ * (Δ * Δ) := Nat.mul_le_mul_right _ (by rw [← SimpleGraph.degree]; exact degree_le_maxDeg G z) _ = Δ * Δ * Δ := by ring have hu1 := Finset.card_union_le (A1 ∪ A2 ∪ A3 ∪ A4) A5 have hu2 := Finset.card_union_le (A1 ∪ A2 ∪ A3) A4 have hu3 := Finset.card_union_le (A1 ∪ A2) A3 have hu4 := Finset.card_union_le A1 A2 have hle := Finset.card_le_card hsub have hmul1 : Δ + Δ * (d - 1) = d * Δ := by cases d with | zero => omega | succ d' => simp [Nat.add_mul]; ring have hmul2 : Δ * Δ * (d - 1) + Δ * Δ = d * Δ ^ 2 := by cases d with | zero => omega | succ d' => simp [Nat.add_mul, pow_two]; ring have hmul3 : Δ * Δ * Δ = Δ ^ 3 := by ring omega -- Dependency degree bound `D := 3 * (d + 1)^3 * Δ^3 - 1` let D : ℕ := 3 * (d + 1) ^ 3 * Δ ^ 3 - 1 have hD_pos : 1 ≤ 3 * (d + 1) ^ 3 * Δ ^ 3 := Nat.mul_pos (Nat.mul_pos (by omega) (pow_pos (by omega) 3)) (pow_pos (by omega) 3) have hdep_le : ∀ uv ∈ I, (I.filter fun uv' => uv' ≠ uv ∧ ¬Disjoint (supp uv) (supp uv')).card ≤ D := by intro uv huv have hsub : I.filter (fun uv' => uv' ≠ uv ∧ ¬Disjoint (supp uv) (supp uv')) ⊆ (supp uv).biUnion fun z => I.filter fun uv' => z ∈ supp uv' := by intro uv' huv' rcases Finset.mem_filter.1 huv' with ⟨huv'I, _, hnd⟩ rw [Finset.not_disjoint_iff] at hnd rcases hnd with ⟨z, hz1, hz2⟩ exact Finset.mem_biUnion.2 ⟨z, hz1, Finset.mem_filter.2 ⟨huv'I, hz2⟩⟩ have hcard_le : (I.filter fun uv' => uv' ≠ uv ∧ ¬Disjoint (supp uv) (supp uv')).card ≤ (2 * d * d + d) * (Δ ^ 3 + d * Δ ^ 2 + d * Δ) := by calc (I.filter fun uv' => uv' ≠ uv ∧ ¬Disjoint (supp uv) (supp uv')).card ≤ ((supp uv).biUnion fun z => I.filter fun uv' => z ∈ supp uv').card := Finset.card_le_card hsub _ ≤ ∑ z ∈ supp uv, (I.filter fun uv' => z ∈ supp uv').card := Finset.card_biUnion_le _ ≤ ∑ _z ∈ supp uv, (Δ ^ 3 + d * Δ ^ 2 + d * Δ) := Finset.sum_le_sum fun z _ => hcontain_z z _ = (supp uv).card * (Δ ^ 3 + d * Δ ^ 2 + d * Δ) := by simp _ ≤ (2 * d * d + d) * (Δ ^ 3 + d * Δ ^ 2 + d * Δ) := Nat.mul_le_mul_right _ (hsupp_card uv huv) have hΔ2 : Δ ^ 2 + Δ ≤ Δ ^ 3 := by have : Δ + 1 ≤ Δ * Δ := by nlinarith nlinarith [pow_two Δ, pow_succ Δ 2] have hstep1 : Δ ^ 3 + d * Δ ^ 2 + d * Δ ≤ (d + 1) * Δ ^ 3 := by nlinarith have hstep2 : (2 * d * d + d) * (Δ ^ 3 + d * Δ ^ 2 + d * Δ) ≤ (2 * d * d + d) * ((d + 1) * Δ ^ 3) := Nat.mul_le_mul_left _ hstep1 have hstep3 : (2 * d * d + d) * ((d + 1) * Δ ^ 3) + 1 ≤ 3 * (d + 1) ^ 3 * Δ ^ 3 := by have hcoef : 2 * d * d + d + 1 ≤ 3 * (d + 1) ^ 2 := by nlinarith have hΔ3 : 1 ≤ Δ ^ 3 := by nlinarith [pow_two Δ, pow_succ Δ 2] have hd1 : 1 ≤ d + 1 := by omega nlinarith [pow_succ (d + 1) 2] dsimp only [D] omega -- Step 2: Apply `symmetric_lll_exp` to obtain a good vertex-hash assignment `f : V → Fin L → Fin q`! have : Nonempty (Fin q) := ⟨⟨0, by omega⟩⟩ let bad : V × V → (V → Fin L → Fin q) → Prop := fun uv f => (Finset.univ.filter fun i : Fin L => ∀ w ∈ Fset uv, f uv.2 i ≠ f w i).card < need have hloc : ∀ uv ∈ I, ∀ f g : V → Fin L → Fin q, (∀ z ∈ supp uv, f z = g z) → (bad uv f ↔ bad uv g) := by intro uv _ f g hfg have hv_eq : f uv.2 = g uv.2 := hfg uv.2 (Finset.mem_insert_self _ _) have hF_eq : ∀ w ∈ Fset uv, f w = g w := fun w hw => hfg w (Finset.mem_insert_of_mem hw) dsimp only [bad] have hfilt : (Finset.univ.filter fun i : Fin L => ∀ w ∈ Fset uv, f uv.2 i ≠ f w i) = (Finset.univ.filter fun i : Fin L => ∀ w ∈ Fset uv, g uv.2 i ≠ g w i) := by ext i simp only [Finset.mem_filter, Finset.mem_univ, true_and] constructor <;> intro h w hw · rw [← hv_eq, ← hF_eq w hw]; exact h w hw · rw [hv_eq, hF_eq w hw]; exact h w hw rw [hfilt] let p : ℝ := (3 : ℝ) ^ (need - 1) * (1 - 2 / (3 * Real.exp 1)) ^ L have hprob : ∀ uv ∈ I, ((Finset.univ.filter (bad uv)).card : ℝ) ≤ p * (Fintype.card (V → Fin L → Fin q) : ℝ) := by intro uv huv exact card_bad_edge_le s L need hs hneed uv.2 (Fset uv) (hv_notMem_F uv huv) (hFset_card uv huv) have hD_cast : ((D : ℝ) + 1) = 3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3 := by have hnat : D + 1 = 3 * (d + 1) ^ 3 * Δ ^ 3 := by dsimp only [D]; omega exact_mod_cast hnat have hlll : Real.exp 1 * p * ((D : ℝ) + 1) ≤ 1 := by rw [hD_cast] exact coordCount_satisfies_lll (by omega : 1 ≤ Δ) obtain ⟨f, hf_good⟩ := symmetric_lll_exp I supp bad hloc p D hprob hdep_le hlll -- Step 3: Greedily pick `coord (u, v) : Fin L` in ascending order of `ord.symm u` to avoid -- triangle collisions `a → b → x, a → x`! have hcoord_build : ∀ t : ℕ, ∃ coord : V × V → Fin L, (∀ u v : V, v ∈ outN u → (ord.symm u).val < t → ∀ w ∈ Fset (u, v), f v (coord (u, v)) ≠ f w (coord (u, v))) ∧ (∀ u b v : V, v ∈ outN u → b ∈ outN u → v ∈ outN b → (ord.symm u).val < t → coord (u, v) ≠ coord (b, v)) := by intro t induction t with | zero => exact ⟨fun _ => ⟨0, hL_pos⟩, fun _ _ _ h => by omega, fun _ _ _ _ _ _ h => by omega⟩ | succ t ih => obtain ⟨coord, hgood_c, htri_c⟩ := ih by_cases ht : t < n · let u₀ : V := ord ⟨t, ht⟩ -- For each `v ∈ outN u₀`, choose `i_v ∈ goodCoord (u₀, v) \ forbCoord (u₀, v)`! have hex : ∀ v : V, v ∈ outN u₀ → ∃ i : Fin L, (∀ w ∈ Fset (u₀, v), f v i ≠ f w i) ∧ (∀ b ∈ outN u₀, v ∈ outN b → i ≠ coord (b, v)) := by intro v hv have huvI : (u₀, v) ∈ I := Finset.mem_filter.2 ⟨Finset.mem_univ _, hv⟩ have hgood_ge : need ≤ (Finset.univ.filter fun i : Fin L => ∀ w ∈ Fset (u₀, v), f v i ≠ f w i).card := Nat.le_of_not_lt (hf_good (u₀, v) huvI) let pivots : Finset V := (outN u₀).filter fun b => v ∈ outN b have hpiv_lt : pivots.card < need := by rcases htri with hd_le | htf · have hsub_p : pivots ⊆ (outN u₀).erase v := by intro b hb rcases Finset.mem_filter.1 hb with ⟨hb_out, hvb⟩ have hbv : b ≠ v := fun h => by subst h exact lt_irrefl _ (Finset.mem_filter.1 hvb).2.2 exact Finset.mem_erase.2 ⟨hbv, hb_out⟩ have hle1 := Finset.card_le_card hsub_p rw [Finset.card_erase_of_mem hv] at hle1 have hle2 := houtN_card u₀ omega · have hemp : pivots = ∅ := by ext b simp only [pivots, Finset.mem_filter, Finset.notMem_empty, iff_false, not_and] intro hb_out hvb have hub : G.Adj u₀ b := (Finset.mem_filter.1 hb_out).2.1 have hbv : G.Adj b v := (Finset.mem_filter.1 hvb).2.1 have huv : G.Adj u₀ v := (Finset.mem_filter.1 hv).2.1 exact htf u₀ b v hub hbv huv rw [hemp, Finset.card_empty] omega let forb : Finset (Fin L) := pivots.image fun b => coord (b, v) have hforb_lt : forb.card < (Finset.univ.filter fun i : Fin L => ∀ w ∈ Fset (u₀, v), f v i ≠ f w i).card := lt_of_le_of_lt Finset.card_image_le (lt_of_lt_of_le hpiv_lt hgood_ge) obtain ⟨i, hi_good, hi_notForb⟩ := Finset.exists_mem_notMem_of_card_lt_card hforb_lt refine ⟨i, (Finset.mem_filter.1 hi_good).2, fun b hb hvb heq => ?_⟩ exact hi_notForb (heq ▸ Finset.mem_image_of_mem (fun b => coord (b, v)) (Finset.mem_filter.2 ⟨hb, hvb⟩)) choose pick hpick_good hpick_tri using hex let coord' : V × V → Fin L := fun uv => if h : uv.1 = u₀ ∧ uv.2 ∈ outN u₀ then pick uv.2 h.2 else coord uv have hu₀_val : (ord.symm u₀).val = t := by simp [u₀] refine ⟨coord', ?_, ?_⟩ · intro u v hv hlt by_cases hu : u = u₀ · subst hu have hcond : u₀ = u₀ ∧ v ∈ outN u₀ := ⟨rfl, hv⟩ simpa [coord', dif_pos hcond] using hpick_good v hv · have hlt' : (ord.symm u).val < t := by have hne : (ord.symm u).val ≠ t := fun h => hu (by have h1 : ord.symm u = ⟨t, ht⟩ := Fin.ext h simpa [u₀] using congrArg ord h1) omega have hcond : ¬(u = u₀ ∧ v ∈ outN u₀) := fun h => hu h.1 simpa [coord', dif_neg hcond] using hgood_c u v hv hlt' · intro u b v hv hb hvb hlt have hbu_lt : (ord.symm b).val < (ord.symm u).val := (Finset.mem_filter.1 hb).2.2 by_cases hu : u = u₀ · subst hu have hb_ne : b ≠ u₀ := fun h => by subst h; exact lt_irrefl _ hbu_lt have hcond1 : u₀ = u₀ ∧ v ∈ outN u₀ := ⟨rfl, hv⟩ have hcond2 : ¬(b = u₀ ∧ v ∈ outN u₀) := fun h => hb_ne h.1 simpa [coord', dif_pos hcond1, dif_neg hcond2] using hpick_tri v hv b hb hvb · have hlt' : (ord.symm u).val < t := by have hne : (ord.symm u).val ≠ t := fun h => hu (by have h1 : ord.symm u = ⟨t, ht⟩ := Fin.ext h simpa [u₀] using congrArg ord h1) omega have hb_ne : b ≠ u₀ := fun h => by subst h; rw [hu₀_val] at hbu_lt; omega have hcond1 : ¬(u = u₀ ∧ v ∈ outN u₀) := fun h => hu h.1 have hcond2 : ¬(b = u₀ ∧ v ∈ outN u₀) := fun h => hb_ne h.1 simpa [coord', dif_neg hcond1, dif_neg hcond2] using htri_c u b v hv hb hvb hlt' · refine ⟨coord, fun u v hv _ => hgood_c u v hv (lt_of_lt_of_le (ord.symm u).isLt (by omega)), fun u b v hv hb hvb _ => htri_c u b v hv hb hvb (lt_of_lt_of_le (ord.symm u).isLt (by omega))⟩ obtain ⟨coord, hcoord_good, hcoord_tri⟩ := hcoord_build n -- Step 4: Assemble the undirected edge coloring `c : Sym2 V → Fin ((2 * d * d + d) * L)`! let colPair : V × V → Fin (q * L) := fun uv => finProdFinEquiv (f uv.2 (coord uv), coord uv) let c : Sym2 V → Fin (q * L) := Sym2.lift ⟨fun x y => if ord.symm y < ord.symm x then colPair (x, y) else colPair (y, x), fun x y => by by_cases hxy : ord.symm y < ord.symm x · have hyx : ¬ord.symm x < ord.symm y := not_lt_of_gt hxy simp [hxy, hyx] · by_cases hyx : ord.symm x < ord.symm y · simp [hxy, hyx] · have heq : x = y := ord.symm.injective (le_antisymm (le_of_not_gt hxy) (le_of_not_gt hyx)) subst heq; simp⟩ have hc_dir : ∀ u v : V, v ∈ outN u → c s(u, v) = colPair (u, v) := by intro u v hv have hlt : ord.symm v < ord.symm u := (Finset.mem_filter.1 hv).2.2 show (if ord.symm v < ord.symm u then colPair (u, v) else colPair (v, u)) = colPair (u, v) exact if_pos hlt have hc_dir_swap : ∀ u v : V, v ∈ outN u → c s(v, u) = colPair (u, v) := by intro u v hv; rw [Sym2.eq_swap]; exact hc_dir u v hv -- Verify all 4 orientation cases of `IsInjectiveEdgeColoring G c`! have hcore_case : ∀ a b x y : V, b ∈ outN a → G.Adj x a → G.Adj b y → x ≠ b → y ≠ a → c s(x, a) ≠ c s(b, y) := by intro a b x y hab hxa hby hxb hya heq have hxa_ne : ord.symm x ≠ ord.symm a := fun h => G.ne_of_adj hxa (ord.symm.injective h) have hby_ne : ord.symm b ≠ ord.symm y := fun h => G.ne_of_adj hby (ord.symm.injective h) rcases lt_or_gt_of_ne hxa_ne with hxa_lt | hxa_gt <;> rcases lt_or_gt_of_ne hby_ne with hby_lt | hby_gt · -- Case 2: `a → x` (`x ∈ outN a`) and `y → b` (`b ∈ outN y`) → wait: `hby_lt : ord.symm b < ord.symm y` means `y → b`! -- That is Case 4: `a → x` and `y → b`, bridge `a → b`! have hx_out : x ∈ outN a := Finset.mem_filter.2 ⟨Finset.mem_univ _, hxa.symm, hxa_lt⟩ have hb_out : b ∈ outN y := Finset.mem_filter.2 ⟨Finset.mem_univ _, hby.symm, hby_lt⟩ rw [hc_dir_swap a x hx_out, hc_dir_swap y b hb_out] at heq have hpair := finProdFinEquiv.injective heq have hf_eq : f x (coord (a, x)) = f b (coord (y, b)) := congrArg Prod.fst hpair have hi_eq : coord (a, x) = coord (y, b) := congrArg Prod.snd hpair rw [← hi_eq] at hf_eq have hb_F : b ∈ Fset (a, x) := Finset.mem_union_left _ (Finset.mem_union_left _ (Finset.mem_union_left _ (Finset.mem_erase.2 ⟨hxb.symm, hab⟩))) exact hcoord_good a x hx_out (ord.symm a).isLt b hb_F hf_eq · -- Case 2: `a → x` (`x ∈ outN a`) and `b → y` (`y ∈ outN b`), bridge `a → b`! have hx_out : x ∈ outN a := Finset.mem_filter.2 ⟨Finset.mem_univ _, hxa.symm, hxa_lt⟩ have hy_out : y ∈ outN b := Finset.mem_filter.2 ⟨Finset.mem_univ _, hby, hby_gt⟩ rw [hc_dir_swap a x hx_out, hc_dir b y hy_out] at heq have hpair := finProdFinEquiv.injective heq have hf_eq : f x (coord (a, x)) = f y (coord (b, y)) := congrArg Prod.fst hpair have hi_eq : coord (a, x) = coord (b, y) := congrArg Prod.snd hpair by_cases hxy : x = y · subst hxy exact hcoord_tri a b x hx_out hab hy_out (ord.symm a).isLt hi_eq · rw [← hi_eq] at hf_eq have hy_F : y ∈ Fset (a, x) := Finset.mem_union_left _ (Finset.mem_union_left _ (Finset.mem_union_right _ (Finset.mem_biUnion.2 ⟨b, Finset.mem_erase.2 ⟨hxb.symm, hab⟩, Finset.mem_erase.2 ⟨Ne.symm hxy, hy_out⟩⟩))) exact hcoord_good a x hx_out (ord.symm a).isLt y hy_F hf_eq · -- Case 1: `x → a` (`a ∈ outN x`) and `y → b` (`b ∈ outN y`), bridge `a → b`! have ha_out : a ∈ outN x := Finset.mem_filter.2 ⟨Finset.mem_univ _, hxa, hxa_gt⟩ have hb_out : b ∈ outN y := Finset.mem_filter.2 ⟨Finset.mem_univ _, hby.symm, hby_lt⟩ rw [hc_dir x a ha_out, hc_dir_swap y b hb_out] at heq have hpair := finProdFinEquiv.injective heq have hf_eq : f a (coord (x, a)) = f b (coord (y, b)) := congrArg Prod.fst hpair have hi_eq : coord (x, a) = coord (y, b) := congrArg Prod.snd hpair rw [← hi_eq] at hf_eq have hb_F : b ∈ Fset (x, a) := Finset.mem_union_left _ (Finset.mem_union_right _ hab) exact hcoord_good x a ha_out (ord.symm x).isLt b hb_F hf_eq · -- Case 3: `x → a` (`a ∈ outN x`) and `b → y` (`y ∈ outN b`), bridge `a → b`! have ha_out : a ∈ outN x := Finset.mem_filter.2 ⟨Finset.mem_univ _, hxa, hxa_gt⟩ have hy_out : y ∈ outN b := Finset.mem_filter.2 ⟨Finset.mem_univ _, hby, hby_gt⟩ rw [hc_dir x a ha_out, hc_dir b y hy_out] at heq have hpair := finProdFinEquiv.injective heq have hf_eq : f a (coord (x, a)) = f y (coord (b, y)) := congrArg Prod.fst hpair have hi_eq : coord (x, a) = coord (b, y) := congrArg Prod.snd hpair rw [← hi_eq] at hf_eq have hy_F : y ∈ Fset (x, a) := Finset.mem_union_right _ (Finset.mem_biUnion.2 ⟨b, hab, hy_out⟩) exact hcoord_good x a ha_out (ord.symm x).isLt y hy_F hf_eq refine ⟨fun e => Fin.cast (by rw [hq_eq]) (c e), fun u v x y huv hxu hvy hxv hyu heq => ?_⟩ have heq' : c s(x, u) = c s(v, y) := Fin.cast_injective _ heq have huv_ne : ord.symm u ≠ ord.symm v := fun h => G.ne_of_adj huv (ord.symm.injective h) rcases lt_or_gt_of_ne huv_ne with huv_lt | huv_gt · have hu_out : u ∈ outN v := Finset.mem_filter.2 ⟨Finset.mem_univ _, huv.symm, huv_lt⟩ exact hcore_case v u y x hu_out hvy.symm hxu.symm hyu hxv (by simpa [Sym2.eq_swap] using heq'.symm) · have hv_out : v ∈ outN u := Finset.mem_filter.2 ⟨Finset.mem_univ _, huv, huv_gt⟩ exact hcore_case u v x y hv_out hxu hvy hxv hyu heq' /-- **Main World-Record Theorem**: Every finite `d`-degenerate graph `G` (`d ≥ 1`, `Δ = maxDeg G ≥ 2`) admits an injective edge coloring with at most `worldRecordBound d Δ = O(d² log Δ + d³)` colors, slashing the standing `O(d³ log Δ)` bound of Bradshaw, Clow & Xu (*European Journal of Combinatorics*, 2025) by a full factor of `d`! -/ theorem injective_edge_coloring_of_degenerate {V : Type*} [Fintype V] (G : SimpleGraph V) {d : ℕ} (hd : 1 ≤ d) (hΔ : 2 ≤ maxDeg G) (hdeg : IsDegenerate G d) : IsInjectiveEdgeColorable G (worldRecordBound d (maxDeg G)) := injective_edge_coloring_of_degenerate_core G hd hΔ hd hdeg (Or.inl le_rfl) /-- **Pure `O(d² log Δ)` Theorem for Triangle-Free `d`-Degenerate Graphs**: Every finite triangle-free (e.g., bipartite) `d`-degenerate graph `G` (`d ≥ 1`, `Δ ≥ 2`) admits an injective edge coloring with at most `triangleFreeBound d Δ = O(d² log Δ)` colors (ZERO `d³` term!). -/ theorem injective_edge_coloring_of_triangleFree_degenerate {V : Type*} [Fintype V] (G : SimpleGraph V) {d : ℕ} (hd : 1 ≤ d) (hΔ : 2 ≤ maxDeg G) (hdeg : IsDegenerate G d) (htf : IsTriangleFree G) : IsInjectiveEdgeColorable G (triangleFreeBound d (maxDeg G)) := injective_edge_coloring_of_degenerate_core G hd hΔ le_rfl hdeg (Or.inr htf) end MainTheorem /-! ## Section 5: Strict World-Record Improvements over Bradshaw–Clow–Xu (*EJC* 2025) -/ section Comparison /-- Elementary rational lower bound: `27 / 100 ≤ -Real.log (1 - 2 / (3 * e))`. -/ lemma twentyseven_div_100_le_neg_log_base : (27 / 100 : ℝ) ≤ -Real.log (1 - 2 / (3 * Real.exp 1)) := by have he_lt : Real.exp 1 < 2.7183 := lt_trans Real.exp_one_lt_d9 (by norm_num) have he_gt : (2.7182 : ℝ) < Real.exp 1 := lt_trans (by norm_num) Real.exp_one_gt_d9 have hbase_pos : (0 : ℝ) < 1 - 2 / (3 * Real.exp 1) := by rw [sub_pos, div_lt_one (by positivity)]; linarith have hbase_le : 1 - 2 / (3 * Real.exp 1) ≤ 1 - 2 / (3 * 2.7183) := by have hdiv : 2 / (3 * (2.7183 : ℝ)) ≤ 2 / (3 * Real.exp 1) := div_le_div_of_nonneg_left (by norm_num) (by positivity) (by linarith) linarith -- Upper bound `exp(27 / 100) ≤ (800 / 773)^8` using `Real.add_one_le_exp (-27 / 800)` have hstep : (773 / 800 : ℝ) ≤ Real.exp (-27 / 800) := by have h := Real.add_one_le_exp (-27 / 800 : ℝ) linarith have hexp_sub : Real.exp (27 / 800) ≤ (800 / 773 : ℝ) := by have h1 : (Real.exp (-27 / 800))⁻¹ ≤ (773 / 800 : ℝ)⁻¹ := inv_anti₀ (by norm_num) hstep rw [← Real.exp_neg] at h1 norm_num at h1 linarith have hexp_le : Real.exp (27 / 100) ≤ (800 / 773 : ℝ) ^ 8 := by have h8 : Real.exp (27 / 100) = (Real.exp (27 / 800)) ^ 8 := by rw [← Real.exp_nat_mul]; congr 1; norm_num rw [h8] exact pow_le_pow_left₀ (le_of_lt (Real.exp_pos _)) hexp_sub 8 have hprod_le : Real.exp (27 / 100) * (1 - 2 / (3 * Real.exp 1)) ≤ 1 := by calc Real.exp (27 / 100) * (1 - 2 / (3 * Real.exp 1)) ≤ (800 / 773 : ℝ) ^ 8 * (1 - 2 / (3 * 2.7183)) := mul_le_mul hexp_le hbase_le (le_of_lt hbase_pos) (by positivity) _ ≤ 1 := by norm_num have hle_exp : 1 - 2 / (3 * Real.exp 1) ≤ Real.exp (-(27 / 100)) := by rw [Real.exp_neg, ← one_div, le_div_iff₀ (Real.exp_pos _), mul_comm] exact hprod_le have hlog : Real.log (1 - 2 / (3 * Real.exp 1)) ≤ -(27 / 100) := by calc Real.log (1 - 2 / (3 * Real.exp 1)) ≤ Real.log (Real.exp (-(27 / 100))) := Real.log_le_log hbase_pos hle_exp _ = -(27 / 100) := Real.log_exp _ linarith /-- Elementary rational upper bound: `Real.log 3 ≤ 11 / 10`. -/ lemma log_three_le_11_div_10 : Real.log 3 ≤ (11 / 10 : ℝ) := by have hexp : (3 : ℝ) ≤ Real.exp (11 / 10) := by have h := Real.sum_le_exp_of_nonneg (x := (11 / 10 : ℝ)) (by norm_num) 6 simp only [Finset.sum_range_succ, Finset.range_zero, Finset.sum_empty, Nat.factorial, Nat.cast_one, Nat.cast_mul, pow_zero, pow_one, div_one, zero_add] at h linarith calc Real.log 3 ≤ Real.log (Real.exp (11 / 10)) := Real.log_le_log (by norm_num) hexp _ = 11 / 10 := Real.log_exp _ /-- Elementary rational lower bound: `53 / 50 ≤ Real.log 3`. -/ lemma fiftythree_div_50_le_log_three : (53 / 50 : ℝ) ≤ Real.log 3 := by have hstep : (747 / 800 : ℝ) ≤ Real.exp (-53 / 800) := by have h := Real.add_one_le_exp (-53 / 800 : ℝ) linarith have hexp_sub : Real.exp (53 / 800) ≤ (800 / 747 : ℝ) := by have h1 : (Real.exp (-53 / 800))⁻¹ ≤ (747 / 800 : ℝ)⁻¹ := inv_anti₀ (by norm_num) hstep rw [← Real.exp_neg] at h1 norm_num at h1 linarith have hexp_le : Real.exp (53 / 50) ≤ (3 : ℝ) := by have h16 : Real.exp (53 / 50) = (Real.exp (53 / 800)) ^ 16 := by rw [← Real.exp_nat_mul]; congr 1; norm_num rw [h16] calc (Real.exp (53 / 800)) ^ 16 ≤ (800 / 747 : ℝ) ^ 16 := pow_le_pow_left₀ (le_of_lt (Real.exp_pos _)) hexp_sub 16 _ ≤ 3 := by norm_num calc (53 / 50 : ℝ) = Real.log (Real.exp (53 / 50)) := (Real.log_exp _).symm _ ≤ Real.log 3 := Real.log_le_log (Real.exp_pos _) hexp_le /-- Elementary upper bound: `Real.log x ≤ 1 + x / 7.3` for all `x > 0` (from `log(x / e²) ≤ x / e² - 1` and `e² > 7.3`). -/ lemma log_le_one_add_div {x : ℝ} (hx : 0 < x) : Real.log x ≤ 1 + x / 7.3 := by have he : (2.7182 : ℝ) < Real.exp 1 := lt_trans (by norm_num) Real.exp_one_gt_d9 have he2 : (7.3 : ℝ) < Real.exp 2 := by have hsq : Real.exp 2 = (Real.exp 1) ^ 2 := by rw [← Real.exp_nat_mul]; norm_num rw [hsq] nlinarith have h1 := Real.log_le_sub_one_of_pos (div_pos hx (Real.exp_pos 2)) rw [Real.log_div (ne_of_gt hx) (ne_of_gt (Real.exp_pos 2)), Real.log_exp] at h1 have h2 : x / Real.exp 2 ≤ x / 7.3 := div_le_div_of_nonneg_left (le_of_lt hx) (by norm_num) (le_of_lt he2) linarith /-- Explicit asymptotic upper bound on `worldRecordBound d Δ`: `worldRecordBound d Δ ≤ (2d² + d) * (5 * d + 12 * ⌈log Δ⌉ + 12 * ⌈log(d + 1)⌉ + 9)` — clearly displaying the `O(d² log Δ + d³)` scaling (an entire factor of `d` better than `O(d³ log Δ)`). -/ theorem worldRecordBound_explicit_O_d2_log_Delta {d Δ : ℕ} (hd : 1 ≤ d) (hΔ : 2 ≤ Δ) : (worldRecordBound d Δ : ℝ) ≤ ((2 * d * d + d : ℕ) : ℝ) * (4.1 * (d : ℝ) + 11.2 * Real.log (Δ : ℝ) + 11.2 * Real.log ((d + 1 : ℕ) : ℝ) + 8.9) := by have hden := twentyseven_div_100_le_neg_log_base have hlog3 := log_three_le_11_div_10 have hΔpos : (0 : ℝ) < (Δ : ℝ) := by exact_mod_cast (by omega : 0 < Δ) have hd1pos : (0 : ℝ) < ((d + 1 : ℕ) : ℝ) := by positivity have hlogD : Real.log (3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3) = Real.log 3 + 3 * Real.log ((d + 1 : ℕ) : ℝ) + 3 * Real.log (Δ : ℝ) := by rw [Real.log_mul (by positivity) (by positivity), Real.log_mul (by norm_num) (by positivity), Real.log_pow, Real.log_pow] ring have hnum_nonneg : 0 ≤ 1 + ((d - 1 : ℕ) : ℝ) * Real.log 3 + Real.log (3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3) := by have : 0 ≤ Real.log 3 := Real.log_nonneg (by norm_num) have : 0 ≤ Real.log ((d + 1 : ℕ) : ℝ) := Real.log_nonneg (by exact_mod_cast (by omega : 1 ≤ d + 1)) have : 0 ≤ Real.log (Δ : ℝ) := Real.log_nonneg (by exact_mod_cast (by omega : 1 ≤ Δ)) rw [hlogD]; positivity have hceil_lt : (coordCount d Δ d : ℝ) < (1 + ((d - 1 : ℕ) : ℝ) * Real.log 3 + Real.log (3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3)) / (-Real.log (1 - 2 / (3 * Real.exp 1))) + 1 := Nat.ceil_lt_add_one (div_nonneg hnum_nonneg (le_of_lt neg_log_base_pos)) have hdiv_le : (1 + ((d - 1 : ℕ) : ℝ) * Real.log 3 + Real.log (3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3)) / (-Real.log (1 - 2 / (3 * Real.exp 1))) ≤ (1 + ((d - 1 : ℕ) : ℝ) * Real.log 3 + Real.log (3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3)) / (27 / 100) := div_le_div_of_nonneg_left hnum_nonneg (by norm_num) hden have hd_sub : ((d - 1 : ℕ) : ℝ) = (d : ℝ) - 1 := by rw [Nat.cast_sub hd, Nat.cast_one] have hlogΔ_nonneg : 0 ≤ Real.log (Δ : ℝ) := Real.log_nonneg (by exact_mod_cast (by omega : 1 ≤ Δ)) have hlogd1_nonneg : 0 ≤ Real.log ((d + 1 : ℕ) : ℝ) := Real.log_nonneg (by exact_mod_cast (by omega : 1 ≤ d + 1)) have hd_ge1 : (1 : ℝ) ≤ (d : ℝ) := by exact_mod_cast hd have hcoord_le : (coordCount d Δ d : ℝ) ≤ 4.1 * (d : ℝ) + 11.2 * Real.log (Δ : ℝ) + 11.2 * Real.log ((d + 1 : ℕ) : ℝ) + 8.9 := by rw [hlogD, hd_sub] at hceil_lt hdiv_le nlinarith dsimp only [worldRecordBound] rw [Nat.cast_mul] exact mul_le_mul_of_nonneg_left hcoord_le (Nat.cast_nonneg _) /-- **Arithmetic Breakthrough Theorem vs Bradshaw–Clow–Xu (*EJC* 2025)**: `worldRecordBound d Δ < bradshawClowXuBound d Δ` for ALL `d ≥ 3, Δ ≥ 3` and ALL `d = 2, Δ ≥ 4`! -/ theorem worldRecordBound_lt_bradshawClowXu {d Δ : ℕ} (hcond : (d = 2 ∧ 4 ≤ Δ) ∨ (3 ≤ d ∧ 3 ≤ Δ)) : worldRecordBound d Δ < bradshawClowXuBound d Δ := by have hd : 2 ≤ d := by rcases hcond with ⟨rfl, _⟩ | ⟨hd, _⟩ <;> omega have hΔ : 3 ≤ Δ := by rcases hcond with ⟨_, hΔ⟩ | ⟨_, hΔ⟩ <;> omega have hden := twentyseven_div_100_le_neg_log_base have hlog3 := log_three_le_11_div_10 have hd1pos : (0 : ℝ) < ((d + 1 : ℕ) : ℝ) := by positivity have hlogd1 : Real.log ((d + 1 : ℕ) : ℝ) ≤ 1 + ((d + 1 : ℕ) : ℝ) / 7.3 := log_le_one_add_div hd1pos have he_gt : (2.718 : ℝ) < Real.exp 1 := lt_trans (by norm_num) Real.exp_one_gt_d9 have hlogΔ_ge : (53 / 50 : ℝ) ≤ Real.log (Δ : ℝ) := by have hΔ3 : (3 : ℝ) ≤ (Δ : ℝ) := by exact_mod_cast hΔ exact le_trans fiftythree_div_50_le_log_three (Real.log_le_log (by norm_num) hΔ3) have hbcx_ge : 4 * (2.718 : ℝ) * (d : ℝ) * Real.log (Δ : ℝ) * ((2 * d + 1 : ℕ) : ℝ) * ((d + 1 : ℕ) : ℝ) ≤ (bradshawClowXuBound d Δ : ℝ) := by dsimp only [bradshawClowXuBound] rw [Nat.cast_mul, Nat.cast_mul] have hceil : 4 * Real.exp 1 * (d : ℝ) * Real.log (Δ : ℝ) ≤ (Nat.ceil (4 * Real.exp 1 * (d : ℝ) * Real.log (Δ : ℝ)) : ℝ) := Nat.le_ceil _ have h1 : 4 * (2.718 : ℝ) * (d : ℝ) * Real.log (Δ : ℝ) ≤ 4 * Real.exp 1 * (d : ℝ) * Real.log (Δ : ℝ) := by have hdl_nn : (0 : ℝ) ≤ (d : ℝ) * Real.log (Δ : ℝ) := mul_nonneg (Nat.cast_nonneg d) (by linarith) calc 4 * (2.718 : ℝ) * (d : ℝ) * Real.log (Δ : ℝ) = (4 * (2.718 : ℝ)) * ((d : ℝ) * Real.log (Δ : ℝ)) := by ring _ ≤ (4 * Real.exp 1) * ((d : ℝ) * Real.log (Δ : ℝ)) := mul_le_mul_of_nonneg_right (by linarith) hdl_nn _ = 4 * Real.exp 1 * (d : ℝ) * Real.log (Δ : ℝ) := by ring have hprod_nn : (0 : ℝ) ≤ ((2 * d + 1 : ℕ) : ℝ) * ((d + 1 : ℕ) : ℝ) := by positivity calc 4 * (2.718 : ℝ) * (d : ℝ) * Real.log (Δ : ℝ) * ((2 * d + 1 : ℕ) : ℝ) * ((d + 1 : ℕ) : ℝ) = (4 * (2.718 : ℝ) * (d : ℝ) * Real.log (Δ : ℝ)) * (((2 * d + 1 : ℕ) : ℝ) * ((d + 1 : ℕ) : ℝ)) := by ring _ ≤ (Nat.ceil (4 * Real.exp 1 * (d : ℝ) * Real.log (Δ : ℝ)) : ℝ) * (((2 * d + 1 : ℕ) : ℝ) * ((d + 1 : ℕ) : ℝ)) := mul_le_mul_of_nonneg_right (h1.trans hceil) hprod_nn _ = (Nat.ceil (4 * Real.exp 1 * (d : ℝ) * Real.log (Δ : ℝ)) : ℝ) * ((2 * d + 1 : ℕ) : ℝ) * ((d + 1 : ℕ) : ℝ) := by ring have hlogD : Real.log (3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3) = Real.log 3 + 3 * Real.log ((d + 1 : ℕ) : ℝ) + 3 * Real.log (Δ : ℝ) := by rw [Real.log_mul (by positivity) (by positivity), Real.log_mul (by norm_num) (by positivity), Real.log_pow, Real.log_pow] ring have hnum_nonneg : 0 ≤ 1 + ((d - 1 : ℕ) : ℝ) * Real.log 3 + Real.log (3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3) := by have : 0 ≤ Real.log 3 := Real.log_nonneg (by norm_num) have : 0 ≤ Real.log ((d + 1 : ℕ) : ℝ) := Real.log_nonneg (by exact_mod_cast (by omega : 1 ≤ d + 1)) rw [hlogD]; nlinarith have hceil_lt : (coordCount d Δ d : ℝ) < (1 + ((d - 1 : ℕ) : ℝ) * Real.log 3 + Real.log (3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3)) / (27 / 100) + 1 := by have h1 := Nat.ceil_lt_add_one (div_nonneg hnum_nonneg (le_of_lt neg_log_base_pos)) have h2 : (1 + ((d - 1 : ℕ) : ℝ) * Real.log 3 + Real.log (3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3)) / (-Real.log (1 - 2 / (3 * Real.exp 1))) ≤ (1 + ((d - 1 : ℕ) : ℝ) * Real.log 3 + Real.log (3 * ((d + 1 : ℕ) : ℝ) ^ 3 * (Δ : ℝ) ^ 3)) / (27 / 100) := div_le_div_of_nonneg_left hnum_nonneg (by norm_num) hden dsimp only [coordCount] linarith have hd_sub : ((d - 1 : ℕ) : ℝ) = (d : ℝ) - 1 := by rw [Nat.cast_sub (by omega : 1 ≤ d), Nat.cast_one] have hd_add : ((d + 1 : ℕ) : ℝ) = (d : ℝ) + 1 := by push_cast; ring have h2d_add : ((2 * d + 1 : ℕ) : ℝ) = 2 * (d : ℝ) + 1 := by push_cast; ring have h2dd : ((2 * d * d + d : ℕ) : ℝ) = 2 * (d : ℝ) ^ 2 + (d : ℝ) := by push_cast; ring have hstrictR : (worldRecordBound d Δ : ℝ) < (bradshawClowXuBound d Δ : ℝ) := by dsimp only [worldRecordBound] rw [Nat.cast_mul, h2dd] have hq_pos : (0 : ℝ) < 2 * (d : ℝ) ^ 2 + (d : ℝ) := by positivity have hcoord_up : (coordCount d Δ d : ℝ) < (1 + ((d : ℝ) - 1) * (11 / 10) + (11 / 10) + 3 * (1 + ((d : ℝ) + 1) / 7.3) + 3 * Real.log (Δ : ℝ)) / (27 / 100) + 1 := by rw [hlogD, hd_sub, hd_add] at hceil_lt rw [hd_add] at hlogd1 have hd1_nn : (0 : ℝ) ≤ (d : ℝ) - 1 := by have : (2 : ℝ) ≤ (d : ℝ) := by exact_mod_cast hd linarith nlinarith have hleft_lt : (2 * (d : ℝ) ^ 2 + (d : ℝ)) * (coordCount d Δ d : ℝ) < (2 * (d : ℝ) ^ 2 + (d : ℝ)) * ((1 + ((d : ℝ) - 1) * (11 / 10) + (11 / 10) + 3 * (1 + ((d : ℝ) + 1) / 7.3) + 3 * Real.log (Δ : ℝ)) / (27 / 100) + 1) := mul_lt_mul_of_pos_left hcoord_up hq_pos rw [hd_add, h2d_add] at hbcx_ge rcases hcond with ⟨rfl, hΔ4⟩ | ⟨hd3, _⟩ · -- `d = 2, Δ ≥ 4`: `Real.log Δ ≥ 2 * Real.log 2 > 1.386`! have hlog4 : (1.386 : ℝ) < Real.log (Δ : ℝ) := by have h2 : (0.6931 : ℝ) < Real.log 2 := lt_trans (by norm_num) Real.log_two_gt_d9 have h4le : (4 : ℝ) ≤ (Δ : ℝ) := by exact_mod_cast hΔ4 have hlog4_eq : Real.log (4 : ℝ) = 2 * Real.log 2 := by have : (4 : ℝ) = (2 : ℝ) ^ (2 : ℕ) := by norm_num rw [this, Real.log_pow]; norm_num have hle := Real.log_le_log (by norm_num) h4le linarith norm_num at hleft_lt hbcx_ge ⊢ linarith · -- `d ≥ 3, Δ ≥ 3`: write `t = d - 3 ≥ 0` and `v = Real.log Δ - 53/50 ≥ 0`; -- every polynomial coefficient of `RHS - LHS` is strictly positive! have hd3R : (3 : ℝ) ≤ (d : ℝ) := by exact_mod_cast hd3 let t : ℝ := (d : ℝ) - 3 let v : ℝ := Real.log (Δ : ℝ) - 53 / 50 have ht : 0 ≤ t := by dsimp only [t]; linarith have hv : 0 ≤ v := by dsimp only [v]; linarith have hdiff : 4 * (2.718 : ℝ) * (d : ℝ) * Real.log (Δ : ℝ) * (2 * (d : ℝ) + 1) * ((d : ℝ) + 1) - (2 * (d : ℝ) ^ 2 + (d : ℝ)) * ((1 + ((d : ℝ) - 1) * (11 / 10) + (11 / 10) + 3 * (1 + ((d : ℝ) + 1) / 7.3) + 3 * Real.log (Δ : ℝ)) / (27 / 100) + 1) = (8372413 / 2053125 : ℝ) + (21433967 / 168750 : ℝ) * t + (954144557 / 12318750 : ℝ) * t ^ 2 + (73027717 / 6159375 : ℝ) * t ^ 3 + v * ((254968 / 375 : ℝ) + (730363 / 1125 : ℝ) * t + (231851 / 1125 : ℝ) * t ^ 2 + (2718 / 125 : ℝ) * t ^ 3) := by dsimp only [t, v]; ring have hnn : 0 ≤ 4 * (2.718 : ℝ) * (d : ℝ) * Real.log (Δ : ℝ) * (2 * (d : ℝ) + 1) * ((d : ℝ) + 1) - (2 * (d : ℝ) ^ 2 + (d : ℝ)) * ((1 + ((d : ℝ) - 1) * (11 / 10) + (11 / 10) + 3 * (1 + ((d : ℝ) + 1) / 7.3) + 3 * Real.log (Δ : ℝ)) / (27 / 100) + 1) := by rw [hdiff]; positivity linarith exact_mod_cast hstrictR /-- **Strict World-Record Improvement over Bradshaw–Clow–Xu (*EJC* 2025) from `worldRecordBound` Alone**: For every `d ≥ 3, Δ ≥ 3` and every `d = 2, Δ ≥ 4`, every finite `d`-degenerate graph `G` admits an injective edge coloring using strictly fewer than `bradshawClowXuBound d Δ` colors! -/ theorem injective_edge_coloring_worldRecord_beats_bcx {V : Type*} [Fintype V] (G : SimpleGraph V) {d : ℕ} (hcond : (d = 2 ∧ 4 ≤ maxDeg G) ∨ (3 ≤ d ∧ 3 ≤ maxDeg G)) (hdeg : IsDegenerate G d) : IsInjectiveEdgeColorable G (bradshawClowXuBound d (maxDeg G) - 1) := by have hd : 1 ≤ d := by rcases hcond with ⟨rfl, _⟩ | ⟨hd, _⟩ <;> omega have hΔ : 2 ≤ maxDeg G := by rcases hcond with ⟨_, hΔ⟩ | ⟨_, hΔ⟩ <;> omega have hlt := worldRecordBound_lt_bradshawClowXu hcond exact (injective_edge_coloring_of_degenerate G hd hΔ hdeg).mono (by omega) /-- **Universal Strict World-Record Improvement over Bradshaw–Clow–Xu (*EJC* 2025) for EVERY `d ≥ 2, Δ ≥ 2`**: Combining our `O(d² log Δ + d³)` theorem with the universal greedy bound `2(Δ - 1)² + 1` strictly beats `bradshawClowXuBound d Δ` for EVERY `d ≥ 2` and EVERY `Δ ≥ 2` without a single exception! -/ theorem injective_edge_coloring_strictly_beats_bcx_all {V : Type*} [Fintype V] (G : SimpleGraph V) {d : ℕ} (hd : 2 ≤ d) (hΔ : 2 ≤ maxDeg G) (hdeg : IsDegenerate G d) : IsInjectiveEdgeColorable G (bradshawClowXuBound d (maxDeg G) - 1) := by have hbcx_ge_15 : 15 ≤ bradshawClowXuBound d (maxDeg G) := by have hlog2 : (0 : ℝ) < Real.log (maxDeg G : ℝ) := Real.log_pos (by exact_mod_cast (by omega : 1 < maxDeg G)) have hceil1 : 1 ≤ Nat.ceil (4 * Real.exp 1 * (d : ℝ) * Real.log (maxDeg G : ℝ)) := Nat.ceil_pos.2 (by positivity) have hprod : 15 ≤ (2 * d + 1) * (d + 1) := by nlinarith dsimp only [bradshawClowXuBound] nlinarith by_cases hsmall : maxDeg G = 2 ∨ (d = 2 ∧ maxDeg G = 3) · have hgreedy := injective_edge_coloring_greedy_bound G have hle : 2 * (maxDeg G - 1) ^ 2 + 1 ≤ bradshawClowXuBound d (maxDeg G) - 1 := by rcases hsmall with h2 | ⟨_, h3⟩ · rw [h2] at hbcx_ge_15 ⊢; omega · rw [h3] at hbcx_ge_15 ⊢; omega exact hgreedy.mono hle · have hcond : (d = 2 ∧ 4 ≤ maxDeg G) ∨ (3 ≤ d ∧ 3 ≤ maxDeg G) := by omega exact injective_edge_coloring_worldRecord_beats_bcx G hcond hdeg end Comparison end DegenerateInjectiveEdgeColoring /-! ## Axiom Verification -/ #print axioms DegenerateInjectiveEdgeColoring.isInjectiveEdgeColoring_iff_no_P4_no_K3 #print axioms DegenerateInjectiveEdgeColoring.injective_edge_coloring_completeGraph_lower_bound #print axioms DegenerateInjectiveEdgeColoring.injective_edge_coloring_greedy_bound #print axioms DegenerateInjectiveEdgeColoring.exists_forward_degeneracy_ordering #print axioms DegenerateInjectiveEdgeColoring.symmetric_lll_finite_product #print axioms DegenerateInjectiveEdgeColoring.symmetric_lll_exp #print axioms DegenerateInjectiveEdgeColoring.card_bad_edge_le #print axioms DegenerateInjectiveEdgeColoring.injective_edge_coloring_of_degenerate_core #print axioms DegenerateInjectiveEdgeColoring.injective_edge_coloring_of_degenerate #print axioms DegenerateInjectiveEdgeColoring.injective_edge_coloring_of_triangleFree_degenerate #print axioms DegenerateInjectiveEdgeColoring.worldRecordBound_explicit_O_d2_log_Delta #print axioms DegenerateInjectiveEdgeColoring.worldRecordBound_lt_bradshawClowXu #print axioms DegenerateInjectiveEdgeColoring.injective_edge_coloring_worldRecord_beats_bcx #print axioms DegenerateInjectiveEdgeColoring.injective_edge_coloring_strictly_beats_bcx_all