| | @@ -0,0 +1,119 @@ |
| 1 | +import Mathlib.Combinatorics.SimpleGraph.VertexCover |
| 2 | +import Mathlib.Order.Minimal |
| 3 | + |
| 4 | +/-! |
| 5 | +# A small induced subgraph preserving the vertex cover number |
| 6 | + |
| 7 | +The graph lemma in §3 of `experiments/erdos530/upper-canonical-deletion/NOTES.md` is the |
| 8 | +Erdős–Gallai vertex-cover witness theorem. Here we prove it by choosing a minimal vertex set |
| 9 | +preserving the cover number. Every vertex in this induced graph belongs to a minimum cover. |
| 10 | +The union of minimum covers has at most twice the minimum cover size. |
| 11 | +-/ |
| 12 | + |
| 13 | +namespace ErdosSwarm.Erdos530Gap |
| 14 | + |
| 15 | +open Finset SimpleGraph |
| 16 | + |
| 17 | +variable {V : Type*} |
| 18 | + |
| 19 | +private lemma exists_minimum_cover (G : SimpleGraph V) [Fintype V] : |
| 20 | + ∃ C : Finset V, G.IsVertexCover C ∧ C.card = G.vertexCoverNum.toNat := by |
| 21 | + classical |
| 22 | + obtain ⟨s, hs, hc⟩ := G.vertexCoverNum_exists |
| 23 | + rw [Set.encard_eq_coe_toFinset_card s] at hs |
| 24 | + exact ⟨s.toFinset, by simpa using hc, by simpa using congrArg ENat.toNat hs⟩ |
| 25 | + |
| 26 | +private lemma minimum_le_card {G : SimpleGraph V} {C : Finset V} (hc : G.IsVertexCover C) : |
| 27 | + G.vertexCoverNum.toNat ≤ C.card := |
| 28 | + ENat.toNat_le_of_le_natCast (by simpa using hc.vertexCoverNum_le) |
| 29 | + |
| 30 | +/-- If every vertex belongs to a minimum cover, the graph has at most twice that many vertices. -/ |
| 31 | +private lemma card_le_twice_of_mem_minimum_cover (G : SimpleGraph V) [Fintype V] |
| 32 | + (h : ∀ v : V, ∃ C : Finset V, v ∈ C ∧ G.IsVertexCover C ∧ C.card = G.vertexCoverNum.toNat) : |
| 33 | + Fintype.card V ≤ 2 * G.vertexCoverNum.toNat := by |
| 34 | + classical |
| 35 | + -- For a family of covers with union U and intersection I, every neighbor of a vertex |
| 36 | + -- outside U lies in I. |
| 37 | + let P (U : Finset V) := ∃ I ⊆ U, U.card + I.card ≤ 2 * G.vertexCoverNum.toNat ∧ |
| 38 | + ∀ ⦃x y : V⦄, G.Adj x y → x ∈ U ∨ y ∈ I |
| 39 | + obtain ⟨C₀, hc₀, hsize₀⟩ := exists_minimum_cover G |
| 40 | + obtain ⟨U, hU⟩ := exists_maximal_of_wellFoundedGT P |
| 41 | + ⟨C₀, C₀, Subset.rfl, by omega, hc₀⟩ |
| 42 | + obtain ⟨I, hIU, hsize, hedge⟩ := hU.prop |
| 43 | + have hfull : U = univ := eq_univ_of_forall fun v => by |
| 44 | + obtain ⟨C, hv, hc, hcard⟩ := h v |
| 45 | + -- Since I ∪ (U ∩ C) is a cover, |U ∪ C| - |U| is at most |I| - |I ∩ C|. |
| 46 | + have hcover : G.IsVertexCover (↑(I ∪ (U ∩ C)) : Set V) := by |
| 47 | + intro x y hxy |
| 48 | + have h₁ := hedge hxy |
| 49 | + have h₂ := hedge hxy.symm |
| 50 | + have h₃ := hc hxy |
| 51 | + simp only [mem_coe, mem_union, mem_inter] at h₃ ⊢ |
| 52 | + tauto |
| 53 | + have hnext : P (U ∪ C) := by |
| 54 | + refine ⟨I ∩ C, inter_subset_right.trans subset_union_right, ?_, ?_⟩ |
| 55 | + · have hcount := card_union_add_card_inter I (U ∩ C) |
| 56 | + rw [← inter_assoc, inter_eq_left.mpr hIU] at hcount |
| 57 | + have := card_union_add_card_inter U C |
| 58 | + have := minimum_le_card hcover |
| 59 | + omega |
| 60 | + · intro x y hxy |
| 61 | + have h₁ := hedge hxy |
| 62 | + have h₂ := hc hxy |
| 63 | + simp only [mem_coe, mem_union, mem_inter] at h₂ ⊢ |
| 64 | + tauto |
| 65 | + exact hU.2 hnext subset_union_left (mem_union_right U hv) |
| 66 | + simpa only [hfull, card_univ] using (show U.card ≤ 2 * G.vertexCoverNum.toNat by omega) |
| 67 | + |
| 68 | +/-- When deleting a vertex decreases the cover number, adding it to a minimum cover of the |
| 69 | +smaller graph gives a minimum cover of the original induced graph. -/ |
| 70 | +private lemma exists_minimum_cover_mem_of_erase (G : SimpleGraph V) [DecidableEq V] |
| 71 | + (W : Finset V) (v : W) |
| 72 | + (hlt : (G.induce (W.erase v.val : Set V)).vertexCoverNum.toNat < |
| 73 | + (G.induce (W : Set V)).vertexCoverNum.toNat) : |
| 74 | + ∃ C : Finset W, v ∈ C ∧ (G.induce (W : Set V)).IsVertexCover C ∧ |
| 75 | + C.card = (G.induce (W : Set V)).vertexCoverNum.toNat := by |
| 76 | + classical |
| 77 | + let e := Set.embeddingOfSubset (W.erase v.val : Set V) (W : Set V) (erase_subset _ _) |
| 78 | + obtain ⟨D, hD, hcard⟩ := exists_minimum_cover (G.induce (W.erase v.val : Set V)) |
| 79 | + let C := insert v (D.map e) |
| 80 | + have hc : (G.induce (W : Set V)).IsVertexCover C := by |
| 81 | + intro x y hxy |
| 82 | + by_cases hx : x = v |
| 83 | + · simp [C, hx] |
| 84 | + by_cases hy : y = v |
| 85 | + · simp [C, hy] |
| 86 | + let x' : ↥(W.erase v.val) := ⟨x, mem_erase.mpr ⟨fun h => hx (Subtype.ext h), x.prop⟩⟩ |
| 87 | + let y' : ↥(W.erase v.val) := ⟨y, mem_erase.mpr ⟨fun h => hy (Subtype.ext h), y.prop⟩⟩ |
| 88 | + exact (hD (v := x') (w := y') hxy).imp |
| 89 | + (fun h => mem_insert_of_mem (mem_map_of_mem e h)) |
| 90 | + (fun h => mem_insert_of_mem (mem_map_of_mem e h)) |
| 91 | + refine ⟨C, mem_insert_self _ _, hc, le_antisymm ?_ (minimum_le_card hc)⟩ |
| 92 | + calc C.card ≤ (D.map e).card + 1 := card_insert_le _ _ |
| 93 | + _ ≤ _ := by simpa only [card_map, hcard] using Nat.succ_le_of_lt hlt |
| 94 | + |
| 95 | +/-- A finite graph of vertex cover number `t` has an induced subgraph on at most `2 * t` |
| 96 | +vertices with the same vertex cover number. -/ |
| 97 | +theorem exists_vertexCover_kernel (G : SimpleGraph V) [Fintype V] : |
| 98 | + ∃ W : Finset V, W.card ≤ 2 * G.vertexCoverNum.toNat ∧ |
| 99 | + (G.induce (W : Set V)).vertexCoverNum = G.vertexCoverNum := by |
| 100 | + classical |
| 101 | + let size (W : Finset V) := (G.induce (W : Set V)).vertexCoverNum.toNat |
| 102 | + have hfull : G.vertexCoverNum.toNat ≤ size univ := by |
| 103 | + dsimp only [size] |
| 104 | + rw [coe_univ, vertexCoverNum_congr G.induceUnivIso] |
| 105 | + obtain ⟨W, hW⟩ := exists_minimal_of_wellFoundedLT |
| 106 | + (fun W : Finset V => G.vertexCoverNum.toNat ≤ size W) ⟨univ, hfull⟩ |
| 107 | + have hsize : size W = G.vertexCoverNum.toNat := le_antisymm |
| 108 | + (ENat.toNat_le_toNat (Embedding.induce (W : Set V)).isContained.vertexCoverNum_le_vertexCoverNum |
| 109 | + vertexCoverNum_ne_top_of_finite) hW.prop |
| 110 | + have hcard := card_le_twice_of_mem_minimum_cover (G.induce (W : Set V)) fun v => |
| 111 | + exists_minimum_cover_mem_of_erase G W v |
| 112 | + ((lt_of_not_ge (hW.not_prop_of_lt (erase_ssubset v.prop))).trans_le hW.prop) |
| 113 | + refine ⟨W, ?_, ?_⟩ |
| 114 | + · rw [← Fintype.card_coe W, ← hsize] |
| 115 | + exact hcard |
| 116 | + · simpa only [size, ENat.natCast_toNat vertexCoverNum_ne_top_of_finite] using |
| 117 | + congrArg (fun n : ℕ => (n : ℕ∞)) hsize |
| 118 | + |
| 119 | +end ErdosSwarm.Erdos530Gap |