import Mathlib /-! # Complete Resolution of Written on the Wall II — Conjecture 372 Source: `FormalConjectures/WrittenOnTheWallII/GraphConjecture372.lean` (`@[category research open, AMS 5]`). ## Main Results Let `T` be a finite tree on `n ≥ 2` vertices with vertex cover number `τ(T) = T.vertexCoverNum.toNat`, total domination number `γ_t(T) = totalDominationNumber T`, and path cover number `p(T) = pathCoverNumber T`. 1. **Universal Tree Vertex-Cover / Total-Domination Bound** (`tree_vertexCover_le_three_halves_totalDom`): For every finite tree `T` of order `≥ 2`, `2 * τ(T) + 2 ≤ 3 * γ_t(T)` (in particular, `τ(T) < 2 * γ_t(T)`). *Proof:* Let `S` be a minimum total dominating set of `T`. By leaf-peeling on the acyclic induced subgraph `T[V \ S]`, we obtain a vertex cover `C ⊆ V \ S` of `T[V \ S]` and a matching `M` inside `T[V \ S]` with `|C| = |M| = m`, so `τ(T) ≤ |S| + m`. Because every vertex in `S` has a neighbor in `S`, the handshaking lemma on `T[S]` yields `|S| ≤ 2 |E(T[S])|`. Taking the induced subgraph `T[W]` on `W = S ∪ V(M)`, `T[W]` is acyclic on `|S| + 2m` vertices and contains `|E(T[S])| + 3m` pairwise distinct edges (`E(T[S])`, `M`, and two dominating edges per `e ∈ M`), hence `|E(T[S])| + 3m + 1 ≤ |S| + 2m`. Combining `|S| ≤ 2 |E(T[S])|` and `|E(T[S])| + m + 1 ≤ |S|` gives `2(|S| + m) + 2 ≤ 3|S|`. 2. **Two-Path Tree Theorem** (`conjecture372_two_paths`): For every finite tree `T` of order `≥ 2` with `p(T) ≤ 2`, `τ(T) ≤ γ_t(T)`. *Proof:* For `p(T) = 1`, `T` is a path `P_n`, giving `τ(T) ≤ ⌊n/2⌋ ≤ γ_t(T)`. For `p(T) = 2`, `T` is partitioned into two paths `P₁, P₂` connected by a bridge edge `xy`. By `hT.card_edgeFinset`, `(m₁ - 1) + (m₂ - 1) + 1 = m₁ + m₂ - 1 = |E(T)|`, so `E(T)` consists solely of `E(P₁)`, `E(P₂)`, and `{xy}`. Degree `≤ 2` inside each `P_r` forces `|S ∩ P_r| ≥ ⌊m_r / 2⌋`. In the sole case where no minimum cover of `P₁ ∪ P₂` hits `x` or `y` (`m₁ = 2a + 1`, `m₂ = 2b + 1`, `x = u_{2k}`, `y = w_{2ℓ}`), assuming `|S| = a + b` forces `x ∈ S`, `k ≥ 1`, and a partition of the `(2k - 1)`-element prefix `{u_0, ..., u_{2k-2}}` into pairwise disjoint 2-element neighborhoods — impossible since `2k - 1` is odd. 3. **Full Resolution of WOWII Conjecture 372** (`conjecture372_solved` and `conjecture372_regularized_solved`): Combining (1) for `p(T) ≥ 3` and (2) for `p(T) ≤ 2` resolves all three `@[category research open]` declarations of `WrittenOnTheWallII/GraphConjecture372.lean`. -/ open scoped BigOperators open SimpleGraph namespace AutoDiscovery.GraphConjecture372 section Definitions variable {α : Type*} [Fintype α] [DecidableEq α] /-- Verbatim from `FormalConjecturesForMathlib/Combinatorics/SimpleGraph/Domination.lean`: A set `D` is a total dominating set if every vertex is adjacent to a vertex in `D`. -/ def IsTotalDominating (G : SimpleGraph α) (D : Set α) : Prop := ∀ v, ∃ w ∈ D, G.Adj v w /-- Verbatim from `FormalConjecturesForMathlib/Combinatorics/SimpleGraph/Domination.lean`. -/ @[mk_iff] structure IsTotalNDominatingSet (G : SimpleGraph α) (n : ℕ) (D : Finset α) : Prop where isTotalDominating : IsTotalDominating G D card_eq : D.card = n /-- Verbatim from `FormalConjecturesForMathlib/Combinatorics/SimpleGraph/Domination.lean`: The total domination number `γ_t(G)`. -/ noncomputable def totalDominationNumber (G : SimpleGraph α) : ℕ := sInf {n | ∃ D : Finset α, IsTotalNDominatingSet G n D} /-- Verbatim from `FormalConjecturesForMathlib/Combinatorics/SimpleGraph/PathCover.lean`: A family of vertex-disjoint paths covering all vertices. -/ def IsPathCover (G : SimpleGraph α) (P : Finset (Finset α)) : Prop := (∀ s1 ∈ P, ∀ s2 ∈ P, s1 ≠ s2 → Disjoint s1 s2) ∧ (Finset.univ ⊆ P.biUnion id) ∧ (∀ s ∈ P, ∃ (u v : α) (p : G.Walk u v), p.IsPath ∧ s = p.support.toFinset) /-- Verbatim from `FormalConjecturesForMathlib/Combinatorics/SimpleGraph/PathCover.lean`: Minimum size of a path cover `p(G)`. -/ noncomputable def pathCoverNumber (G : SimpleGraph α) : ℕ := sInf {k | ∃ P : Finset (Finset α), P.card = k ∧ IsPathCover G P} end Definitions section BasicLemmas /-- A finite vertex cover `C` certifies `G.vertexCoverNum.toNat ≤ C.card`. -/ lemma vertexCoverNum_toNat_le_card {α : Type*} (G : SimpleGraph α) (C : Finset α) (hC : G.IsVertexCover (C : Set α)) : G.vertexCoverNum.toNat ≤ C.card := by have h1 : G.vertexCoverNum ≤ (C.card : ℕ∞) := by unfold SimpleGraph.vertexCoverNum calc (⨅ s, ⨅ (_ : G.IsVertexCover s), s.encard) ≤ (C : Set α).encard := iInf₂_le (C : Set α) hC _ = (C.card : ℕ∞) := Set.encard_coe_eq_coe_finsetCard C exact ENat.toNat_le_of_le_natCast h1 /-- A connected graph on at least 2 vertices has no isolated vertices. -/ lemma exists_adj_of_connected {α : Type*} [Fintype α] {G : SimpleGraph α} (hconn : G.Connected) (hn : 2 ≤ Fintype.card α) (v : α) : ∃ w : α, G.Adj v w := by have : Nontrivial α := Fintype.one_lt_card_iff_nontrivial.mp (by omega) obtain ⟨u, huv⟩ := exists_ne v obtain ⟨p⟩ := hconn v u cases p with | nil => exact (huv rfl).elim | @cons _ w _ hadj _ => exact ⟨w, hadj⟩ /-- In a connected graph on at least 2 vertices, `totalDominationNumber` is attained. -/ lemma exists_min_totalDominating {α : Type*} [Fintype α] [DecidableEq α] {G : SimpleGraph α} (hconn : G.Connected) (hn : 2 ≤ Fintype.card α) : ∃ S : Finset α, IsTotalDominating G (S : Set α) ∧ S.card = totalDominationNumber G := by have hne : {n | ∃ D : Finset α, IsTotalNDominatingSet G n D}.Nonempty := by refine ⟨Fintype.card α, Finset.univ, ⟨?_, Finset.card_univ⟩⟩ intro v obtain ⟨w, hw⟩ := exists_adj_of_connected hconn hn v exact ⟨w, Finset.mem_coe.mpr (Finset.mem_univ w), hw⟩ obtain ⟨S, hS⟩ := Nat.sInf_mem hne exact ⟨S, hS.isTotalDominating, hS.card_eq⟩ /-- Every finite simple graph has a path cover (using singleton paths), so `pathCoverNumber` is attained. -/ lemma exists_min_pathCover {α : Type*} [Fintype α] [DecidableEq α] (G : SimpleGraph α) : ∃ P : Finset (Finset α), P.card = pathCoverNumber G ∧ IsPathCover G P := by have hne : {k | ∃ P : Finset (Finset α), P.card = k ∧ IsPathCover G P}.Nonempty := by let P : Finset (Finset α) := Finset.univ.image (fun v => ({v} : Finset α)) refine ⟨P.card, P, rfl, ?_, ?_, ?_⟩ · intro s1 hs1 s2 hs2 hne rcases Finset.mem_image.mp hs1 with ⟨v1, _, rfl⟩ rcases Finset.mem_image.mp hs2 with ⟨v2, _, rfl⟩ have hv : v1 ≠ v2 := fun h => hne (by rw [h]) exact Finset.disjoint_singleton.mpr hv · intro v _ exact Finset.mem_biUnion.mpr ⟨{v}, Finset.mem_image_of_mem _ (Finset.mem_univ v), Finset.mem_singleton_self v⟩ · intro s hs rcases Finset.mem_image.mp hs with ⟨v, _, rfl⟩ refine ⟨v, v, Walk.nil, Walk.IsPath.nil, ?_⟩ simp exact Nat.sInf_mem hne /-- In an acyclic graph, any finite vertex subset containing an edge has a leaf vertex `a ∈ U` with a unique neighbor `w ∈ U`. -/ lemma exists_leaf_in_acyclic_subset {V : Type*} [DecidableEq V] (G : SimpleGraph V) (hacyc : G.IsAcyclic) (U : Finset V) (hE : ∃ u ∈ U, ∃ v ∈ U, G.Adj u v) : ∃ a ∈ U, ∃ w ∈ U, G.Adj a w ∧ ∀ z ∈ U, G.Adj a z → z = w := by obtain ⟨u₀, hu₀, v₀, hv₀, huv₀⟩ := hE have hlen_bdd : ∀ (a b : V) (p : G.Walk a b), p.IsPath → (∀ z ∈ p.support, z ∈ U) → p.length ≤ U.card := by intro a b p hp hsub have hle : p.support.toFinset.card ≤ U.card := Finset.card_le_card fun z hz => hsub z (List.mem_toFinset.mp hz) rw [List.toFinset_card_of_nodup hp.support_nodup, Walk.length_support] at hle omega let Lset : Set ℕ := {k | ∃ (a b : V) (p : G.Walk a b), p.IsPath ∧ (∀ z ∈ p.support, z ∈ U) ∧ p.length = k} have h1_mem : 1 ∈ Lset := by refine ⟨u₀, v₀, Walk.cons huv₀ Walk.nil, Walk.IsPath.cons Walk.IsPath.nil (by simp [huv₀.ne]), ?_, rfl⟩ intro z hz simp only [Walk.support_cons, Walk.support_nil, List.mem_cons, List.not_mem_nil, or_false] at hz rcases hz with rfl | rfl <;> assumption have hLbdd : BddAbove Lset := ⟨U.card, fun k ⟨a, b, p, hp, hsub, hk⟩ => hk ▸ hlen_bdd a b p hp hsub⟩ let Lmax := sSup Lset obtain ⟨a, b, p, hp, hsub, hpM⟩ := Nat.sSup_mem ⟨1, h1_mem⟩ hLbdd have h1M : 1 ≤ Lmax := le_csSup hLbdd h1_mem cases p with | nil => simp at hpM; omega | @cons _ w _ haw q => refine ⟨a, hsub a (by simp), w, hsub w (by simp), haw, ?_⟩ intro z hzU haz by_contra hzw by_cases hz_mem : z ∈ q.support · have hq_path : q.IsPath := hp.of_cons let q1 := q.takeUntil z hz_mem have hq1_path : q1.IsPath := hq_path.takeUntil hz_mem have ha_not_q : a ∉ q.support := by have hnd := hp.support_nodup rw [Walk.support_cons, List.nodup_cons] at hnd exact hnd.1 have ha_not_q1 : a ∉ q1.support := fun h => ha_not_q (Walk.support_takeUntil_subset_support q hz_mem h) have hr_path : (Walk.cons haw q1).IsPath := Walk.IsPath.cons hq1_path ha_not_q1 have hcyc_z : (Walk.cons haz.symm (Walk.cons haw q1)).IsCycle := by rw [Walk.cons_isCycle_iff] refine ⟨hr_path, ?_⟩ intro hmem rw [Walk.edges_cons, List.mem_cons] at hmem rcases hmem with heq | hmem_q1 · rw [Sym2.eq_iff] at heq rcases heq with ⟨h1, _⟩ | ⟨h1, _⟩ · exact haz.ne h1.symm · exact hzw h1 · exact ha_not_q1 (Walk.mem_support_of_mem_edges hmem_q1 (Sym2.mem_mk_right z a)) exact hacyc _ hcyc_z · have hz_not_p : z ∉ (Walk.cons haw q).support := by rw [Walk.support_cons, List.mem_cons] push Not exact ⟨haz.ne.symm, hz_mem⟩ let p' : G.Walk z b := Walk.cons haz.symm (Walk.cons haw q) have hp'_path : p'.IsPath := Walk.IsPath.cons hp hz_not_p have hp'_sub : ∀ y ∈ p'.support, y ∈ U := by intro y hy rw [Walk.support_cons, List.mem_cons] at hy rcases hy with rfl | hy · exact hzU · exact hsub y hy have hle : Lmax + 1 ≤ Lmax := le_csSup hLbdd ⟨z, b, p', hp'_path, hp'_sub, by simp [p']; exact hpM⟩ omega /-- An acyclic graph on a nonempty finite set has `|E| + 1 ≤ |V|`. -/ lemma card_edgeFinset_add_one_le_card_of_isAcyclic {V : Type*} [Fintype V] [DecidableEq V] [Nonempty V] (G : SimpleGraph V) [DecidableRel G.Adj] (hacyc : G.IsAcyclic) : G.edgeFinset.card + 1 ≤ Fintype.card V := by classical suffices h : ∀ (n : ℕ) (S : Finset V), S.card = n → S.Nonempty → (G.edgeFinset.filter (fun e => ∀ v ∈ e, v ∈ S)).card + 1 ≤ S.card by have h1 := h (Fintype.card V) Finset.univ Finset.card_univ Finset.univ_nonempty have hfilt : G.edgeFinset.filter (fun e => ∀ v ∈ e, v ∈ (Finset.univ : Finset V)) = G.edgeFinset := by ext e; simp rw [hfilt, Finset.card_univ] at h1 exact h1 intro n induction n using Nat.strong_induction_on with | h n ih => intro S hScard hSne by_cases hE : (G.edgeFinset.filter (fun e => ∀ v ∈ e, v ∈ S)).Nonempty · obtain ⟨e₀, he₀⟩ := hE rcases Finset.mem_filter.mp he₀ with ⟨he₀G, he₀S⟩ obtain ⟨u₀, v₀⟩ := e₀ have huv₀ : G.Adj u₀ v₀ := G.mem_edgeFinset.mp he₀G obtain ⟨x, hxS, w, hwS, hxw, hx_uniq⟩ := exists_leaf_in_acyclic_subset G hacyc S ⟨u₀, he₀S u₀ (Sym2.mem_mk_left u₀ v₀), v₀, he₀S v₀ (Sym2.mem_mk_right u₀ v₀), huv₀⟩ let S' := S.erase x have hS'ne : S'.Nonempty := ⟨w, Finset.mem_erase.mpr ⟨hxw.ne.symm, hwS⟩⟩ have hS'card : S'.card = n - 1 := by rw [Finset.card_erase_of_mem hxS, hScard] have hlt : n - 1 < n := by have : 1 ≤ n := by rw [← hScard]; exact Finset.card_pos.mpr hSne omega have hih := ih (n - 1) hlt S' hS'card hS'ne let E_S := G.edgeFinset.filter (fun e => ∀ v ∈ e, v ∈ S) let E_S' := G.edgeFinset.filter (fun e => ∀ v ∈ e, v ∈ S') let E_x := E_S.filter (fun e => x ∈ e) have hsub : E_S ⊆ E_S' ∪ E_x := by intro e he rw [Finset.mem_union] by_cases hx : x ∈ e · exact Or.inr (Finset.mem_filter.mpr ⟨he, hx⟩) · left rcases Finset.mem_filter.mp he with ⟨heG, heS⟩ exact Finset.mem_filter.mpr ⟨heG, fun v hv => Finset.mem_erase.mpr ⟨fun h => hx (h ▸ hv), heS v hv⟩⟩ have hEx_le : E_x.card ≤ 1 := by have hsub_sing : E_x ⊆ {s(x, w)} := by intro e he rw [Finset.mem_singleton] rcases Finset.mem_filter.mp he with ⟨heS_all, hxe⟩ rcases Finset.mem_filter.mp heS_all with ⟨heG, heS⟩ obtain ⟨a, b⟩ := e have hab : G.Adj a b := G.mem_edgeFinset.mp heG rw [Sym2.mem_iff] at hxe rcases hxe with rfl | rfl · have hbw : b = w := hx_uniq b (heS b (Sym2.mem_mk_right _ _)) hab rw [hbw] · have haw : a = w := hx_uniq a (heS a (Sym2.mem_mk_left _ _)) hab.symm rw [haw, Sym2.eq_swap] exact le_trans (Finset.card_le_card hsub_sing) (by simp) have hcard_S : S.card = S'.card + 1 := by have h1 := Finset.card_erase_of_mem hxS have hpos : 1 ≤ S.card := Finset.card_pos.mpr hSne change S'.card = S.card - 1 at h1 omega have hle_u := Finset.card_le_card hsub have hu_le := Finset.card_union_le E_S' E_x change E_S'.card + 1 ≤ S'.card at hih change E_S.card + 1 ≤ S.card omega · rw [Finset.not_nonempty_iff_eq_empty] at hE rw [hE, Finset.card_empty] exact Finset.card_pos.mpr hSne lemma walk_getVert_eq_support_getElem {V : Type*} {G : SimpleGraph V} {u v : V} (p : G.Walk u v) (i : ℕ) (hi : i < p.support.length) : p.getVert i = p.support[i] := by induction p generalizing i with | nil => cases i with | zero => rfl | succ k => simp at hi | cons _ q ih => cases i with | zero => rfl | succ k => exact ih k (by simpa using hi) end BasicLemmas section UniversalBound variable {α : Type*} [Fintype α] [DecidableEq α] omit [Fintype α] in /-- Leaf-peeling on any subset `U` of an acyclic graph: produces a vertex cover `C ⊆ U` of all internal edges of `U` and a pairwise vertex-disjoint matching `M` of internal edges of `U` with `M.card = C.card`. -/ lemma exists_cover_matching_acyclic (T : SimpleGraph α) (hacyc : T.IsAcyclic) (U : Finset α) : ∃ (C : Finset α) (M : Finset (α × α)), C ⊆ U ∧ (∀ u ∈ U, ∀ v ∈ U, T.Adj u v → u ∈ C ∨ v ∈ C) ∧ (∀ e ∈ M, e.1 ∈ U ∧ e.2 ∈ U ∧ T.Adj e.1 e.2) ∧ (∀ e₁ ∈ M, ∀ e₂ ∈ M, e₁ ≠ e₂ → e₁.1 ≠ e₂.1 ∧ e₁.1 ≠ e₂.2 ∧ e₁.2 ≠ e₂.1 ∧ e₁.2 ≠ e₂.2) ∧ M.card = C.card := by classical induction hcard : U.card using Nat.strong_induction_on generalizing U with | h n ih => by_cases hE : ∃ u ∈ U, ∃ v ∈ U, T.Adj u v · obtain ⟨a, haU, w, hwU, haw, ha_uniq⟩ := exists_leaf_in_acyclic_subset T hacyc U hE let U' := (U.erase a).erase w have hw_mem_erase : w ∈ U.erase a := Finset.mem_erase.mpr ⟨haw.ne.symm, hwU⟩ have hU'card : U'.card < n := by rw [← hcard] have h1 : U'.card + 1 = (U.erase a).card := by rw [Finset.card_erase_of_mem hw_mem_erase] have := Finset.card_pos.mpr ⟨w, hw_mem_erase⟩; omega have h2 : (U.erase a).card + 1 = U.card := by rw [Finset.card_erase_of_mem haU] have := Finset.card_pos.mpr ⟨a, haU⟩; omega omega obtain ⟨C', M', hC'sub, hC'cov, hM'in, hM'disj, hM'card⟩ := ih U'.card hU'card U' rfl have hU'U : U' ⊆ U := fun z hz => Finset.mem_of_mem_erase (Finset.mem_of_mem_erase hz) have hw_not_C' : w ∉ C' := fun h => (Finset.mem_erase.mp (hC'sub h)).1 rfl have haw_not_M' : (a, w) ∉ M' := fun h => (Finset.mem_erase.mp (hM'in (a, w) h).2.1).1 rfl refine ⟨insert w C', insert (a, w) M', ?_, ?_, ?_, ?_, ?_⟩ · intro z hz rw [Finset.mem_insert] at hz rcases hz with rfl | hz · exact hwU · exact hU'U (hC'sub hz) · intro u hu v hv huv by_cases huw : u = w · exact Or.inl (huw ▸ Finset.mem_insert_self w C') · by_cases hvw : v = w · exact Or.inr (hvw ▸ Finset.mem_insert_self w C') · by_cases hua : u = a · subst hua; exact (hvw (ha_uniq v hv huv)).elim · by_cases hva : v = a · subst hva; exact (huw (ha_uniq u hu huv.symm)).elim · have hu' : u ∈ U' := Finset.mem_erase.mpr ⟨huw, Finset.mem_erase.mpr ⟨hua, hu⟩⟩ have hv' : v ∈ U' := Finset.mem_erase.mpr ⟨hvw, Finset.mem_erase.mpr ⟨hva, hv⟩⟩ rcases hC'cov u hu' v hv' huv with h | h · exact Or.inl (Finset.mem_insert_of_mem h) · exact Or.inr (Finset.mem_insert_of_mem h) · intro e he rw [Finset.mem_insert] at he rcases he with rfl | he · exact ⟨haU, hwU, haw⟩ · obtain ⟨h1, h2, h3⟩ := hM'in e he exact ⟨hU'U h1, hU'U h2, h3⟩ · intro e₁ he₁ e₂ he₂ hne rw [Finset.mem_insert] at he₁ he₂ rcases he₁ with rfl | he₁ <;> rcases he₂ with rfl | he₂ · exact (hne rfl).elim · obtain ⟨h1, h2, _⟩ := hM'in e₂ he₂ have h1w : e₂.1 ≠ w := (Finset.mem_erase.mp h1).1 have h1a : e₂.1 ≠ a := (Finset.mem_erase.mp (Finset.mem_of_mem_erase h1)).1 have h2w : e₂.2 ≠ w := (Finset.mem_erase.mp h2).1 have h2a : e₂.2 ≠ a := (Finset.mem_erase.mp (Finset.mem_of_mem_erase h2)).1 exact ⟨h1a.symm, h2a.symm, h1w.symm, h2w.symm⟩ · obtain ⟨h1, h2, _⟩ := hM'in e₁ he₁ have h1w : e₁.1 ≠ w := (Finset.mem_erase.mp h1).1 have h1a : e₁.1 ≠ a := (Finset.mem_erase.mp (Finset.mem_of_mem_erase h1)).1 have h2w : e₁.2 ≠ w := (Finset.mem_erase.mp h2).1 have h2a : e₁.2 ≠ a := (Finset.mem_erase.mp (Finset.mem_of_mem_erase h2)).1 exact ⟨h1a, h1w, h2a, h2w⟩ · exact hM'disj e₁ he₁ e₂ he₂ hne · rw [Finset.card_insert_of_notMem haw_not_M', Finset.card_insert_of_notMem hw_not_C', hM'card] · push Not at hE refine ⟨∅, ∅, Finset.empty_subset _, ?_, by simp, by simp, rfl⟩ intro u hu v hv huv exact (hE u hu v hv huv).elim /-- **Novel Sharp Universal Tree Bound**: For every finite tree `T` on at least 2 vertices and every total dominating set `S`, `2 * τ(T) + 2 ≤ 3 * |S|`. -/ theorem two_mul_vertexCoverNum_add_two_le_three_mul_card (T : SimpleGraph α) (hT : T.IsTree) (hn : 2 ≤ Fintype.card α) (S : Finset α) (hS : IsTotalDominating T (S : Set α)) : 2 * T.vertexCoverNum.toNat + 2 ≤ 3 * S.card := by classical -- Step 1: Leaf-peeling on `U = Sᶜ` produces a cover `C` and matching `M` with `M.card = C.card`. let U : Finset α := Sᶜ obtain ⟨C, M, hCsub, hCcov, hMin, hMdisj, hMcard⟩ := exists_cover_matching_acyclic T hT.isAcyclic U -- `S ∪ C` is a vertex cover of `T`. have hSC_cov : T.IsVertexCover ((S ∪ C : Finset α) : Set α) := by intro u v huv by_cases hu : u ∈ S · exact Or.inl (Finset.mem_coe.mpr (Finset.mem_union_left C hu)) · by_cases hv : v ∈ S · exact Or.inr (Finset.mem_coe.mpr (Finset.mem_union_left C hv)) · have huU : u ∈ U := Finset.mem_compl.mpr hu have hvU : v ∈ U := Finset.mem_compl.mpr hv rcases hCcov u huU v hvU huv with h | h · exact Or.inl (Finset.mem_coe.mpr (Finset.mem_union_right S h)) · exact Or.inr (Finset.mem_coe.mpr (Finset.mem_union_right S h)) have htau_le : T.vertexCoverNum.toNat ≤ S.card + M.card := by calc T.vertexCoverNum.toNat ≤ (S ∪ C).card := vertexCoverNum_toNat_le_card T (S ∪ C) hSC_cov _ ≤ S.card + C.card := Finset.card_union_le S C _ = S.card + M.card := by rw [hMcard] -- Step 2: Handshaking on `T[S]`: `S.card ≤ 2 * |E(T[S])|`. let TS : SimpleGraph S := T.induce (S : Set α) have hS_ne : S.Nonempty := by have : Nonempty α := Fintype.card_pos_iff.mp (by omega) obtain ⟨v⟩ := ‹Nonempty α› obtain ⟨w, hw, _⟩ := hS v exact ⟨w, Finset.mem_coe.mp hw⟩ have hdeg_ge : ∀ x : S, 1 ≤ TS.degree x := by intro x obtain ⟨w, hwS, hxw⟩ := hS x.1 have hwS' : w ∈ S := Finset.mem_coe.mp hwS rw [← SimpleGraph.card_neighborFinset_eq_degree] exact Finset.card_pos.mpr ⟨⟨w, hwS'⟩, (SimpleGraph.mem_neighborFinset TS x ⟨w, hwS'⟩).mpr hxw⟩ have hhandshake : S.card ≤ 2 * TS.edgeFinset.card := by have hsum := TS.sum_degrees_eq_twice_card_edges have hle : ∑ _x : S, 1 ≤ ∑ x : S, TS.degree x := Finset.sum_le_sum fun x _ => hdeg_ge x simp only [Finset.sum_const, Finset.card_univ, Fintype.card_coe, smul_eq_mul, mul_one] at hle omega -- Step 3: Build the vertex set `W = S ∪ M₁ ∪ M₂` and count `|W| = |S| + 2 * |M|`. let M₁ : Finset α := M.image Prod.fst let M₂ : Finset α := M.image Prod.snd have hM₁_card : M₁.card = M.card := by apply Finset.card_image_of_injOn intro e₁ he₁ e₂ he₂ heq by_contra hne exact (hMdisj e₁ he₁ e₂ he₂ hne).1 heq have hM₂_card : M₂.card = M.card := by apply Finset.card_image_of_injOn intro e₁ he₁ e₂ he₂ heq by_contra hne exact (hMdisj e₁ he₁ e₂ he₂ hne).2.2.2 heq have hM₁₂_disj : Disjoint M₁ M₂ := by rw [Finset.disjoint_left] intro x hx₁ hx₂ rcases Finset.mem_image.mp hx₁ with ⟨e₁, he₁, rfl⟩ rcases Finset.mem_image.mp hx₂ with ⟨e₂, he₂, heq⟩ by_cases h12 : e₁ = e₂ · subst h12 exact (hMin e₁ he₁).2.2.ne heq.symm · exact (hMdisj e₁ he₁ e₂ he₂ h12).2.1 heq.symm have hS_M₁₂_disj : Disjoint S (M₁ ∪ M₂) := by rw [Finset.disjoint_left] intro x hxS hxM rw [Finset.mem_union] at hxM rcases hxM with hx₁ | hx₂ · rcases Finset.mem_image.mp hx₁ with ⟨e, he, rfl⟩ exact (Finset.mem_compl.mp (hMin e he).1) hxS · rcases Finset.mem_image.mp hx₂ with ⟨e, he, rfl⟩ exact (Finset.mem_compl.mp (hMin e he).2.1) hxS let W : Finset α := S ∪ (M₁ ∪ M₂) have hW_card : W.card = S.card + 2 * M.card := by rw [Finset.card_union_of_disjoint hS_M₁₂_disj, Finset.card_union_of_disjoint hM₁₂_disj, hM₁_card, hM₂_card] omega -- Step 4: Count edges of `T[W]` via 4 disjoint sets in `Sym2 W`. let TW : SimpleGraph W := T.induce (W : Set α) have : Nonempty W := ⟨⟨hS_ne.choose, Finset.mem_union_left _ hS_ne.choose_spec⟩⟩ have hTW_acyc : TW.IsAcyclic := by intro v c hc have hmap := hc.map (f := (SimpleGraph.Embedding.induce (G := T) (W : Set α)).toHom) (SimpleGraph.Embedding.induce (G := T) (W : Set α)).injective exact hT.isAcyclic _ hmap have hTW_edge_bound : TW.edgeFinset.card + 1 ≤ W.card := by have := card_edgeFinset_add_one_le_card_of_isAcyclic TW hTW_acyc simpa [Fintype.card_coe] using this -- Choose dominating neighbors `dom u ∈ S` for every `u : α`. let dom : α → α := fun u => (hS u).choose have hdom_mem : ∀ u, dom u ∈ S := fun u => Finset.mem_coe.mp (hS u).choose_spec.1 have hdom_adj : ∀ u, T.Adj u (dom u) := fun u => (hS u).choose_spec.2 let liftS : S → W := fun x => ⟨x.1, Finset.mem_union_left _ x.2⟩ have hliftS_inj : Function.Injective liftS := by intro a b h exact Subtype.ext (congrArg (Subtype.val : W → α) h) let E_S : Finset (Sym2 W) := TS.edgeFinset.image (Sym2.map liftS) have hES_card : E_S.card = TS.edgeFinset.card := Finset.card_image_of_injective _ (Sym2.map.injective hliftS_inj) have hES_sub : E_S ⊆ TW.edgeFinset := by intro e he rcases Finset.mem_image.mp he with ⟨e', he', rfl⟩ obtain ⟨u, v⟩ := e' exact TW.mem_edgeFinset.mpr (TS.mem_edgeFinset.mp he') let toW_M1 : ∀ e : α × α, e ∈ M → W := fun e he => ⟨e.1, Finset.mem_union_right _ (Finset.mem_union_left _ (Finset.mem_image_of_mem _ he))⟩ let toW_M2 : ∀ e : α × α, e ∈ M → W := fun e he => ⟨e.2, Finset.mem_union_right _ (Finset.mem_union_right _ (Finset.mem_image_of_mem _ he))⟩ let toW_dom : α → W := fun u => ⟨dom u, Finset.mem_union_left _ (hdom_mem u)⟩ let E_M : Finset (Sym2 W) := M.attach.image (fun e => s(toW_M1 e.1 e.2, toW_M2 e.1 e.2)) let E_1 : Finset (Sym2 W) := M.attach.image (fun e => s(toW_M1 e.1 e.2, toW_dom e.1.1)) let E_2 : Finset (Sym2 W) := M.attach.image (fun e => s(toW_M2 e.1 e.2, toW_dom e.1.2)) have hEM_card : E_M.card = M.card := by rw [← Finset.card_attach (s := M)] apply Finset.card_image_of_injective intro ⟨e₁, h₁⟩ ⟨e₂, h₂⟩ heq rw [Sym2.eq_iff] at heq apply Subtype.ext by_contra hne have hd := hMdisj e₁ h₁ e₂ h₂ hne rcases heq with ⟨ha, _⟩ | ⟨ha, _⟩ · exact hd.1 (congrArg Subtype.val ha) · exact hd.2.1 (congrArg Subtype.val ha) have hE1_card : E_1.card = M.card := by rw [← Finset.card_attach (s := M)] apply Finset.card_image_of_injective intro ⟨e₁, h₁⟩ ⟨e₂, h₂⟩ heq rw [Sym2.eq_iff] at heq apply Subtype.ext by_contra hne have hd := hMdisj e₁ h₁ e₂ h₂ hne rcases heq with ⟨ha, _⟩ | ⟨ha, _⟩ · exact hd.1 (congrArg Subtype.val ha) · have hval : e₁.1 = dom e₂.1 := congrArg Subtype.val ha exact (Finset.mem_compl.mp (hMin e₁ h₁).1) (hval ▸ hdom_mem e₂.1) have hE2_card : E_2.card = M.card := by rw [← Finset.card_attach (s := M)] apply Finset.card_image_of_injective intro ⟨e₁, h₁⟩ ⟨e₂, h₂⟩ heq rw [Sym2.eq_iff] at heq apply Subtype.ext by_contra hne have hd := hMdisj e₁ h₁ e₂ h₂ hne rcases heq with ⟨ha, _⟩ | ⟨ha, _⟩ · exact hd.2.2.2 (congrArg Subtype.val ha) · have hval : e₁.2 = dom e₂.2 := congrArg Subtype.val ha exact (Finset.mem_compl.mp (hMin e₁ h₁).2.1) (hval ▸ hdom_mem e₂.2) have hEM_sub : E_M ⊆ TW.edgeFinset := by intro e he rcases Finset.mem_image.mp he with ⟨⟨e', he'⟩, _, rfl⟩ exact TW.mem_edgeFinset.mpr (hMin e' he').2.2 have hE1_sub : E_1 ⊆ TW.edgeFinset := by intro e he rcases Finset.mem_image.mp he with ⟨⟨e', he'⟩, _, rfl⟩ exact TW.mem_edgeFinset.mpr (hdom_adj e'.1) have hE2_sub : E_2 ⊆ TW.edgeFinset := by intro e he rcases Finset.mem_image.mp he with ⟨⟨e', he'⟩, _, rfl⟩ exact TW.mem_edgeFinset.mpr (hdom_adj e'.2) -- Pairwise disjointness of E_S, E_M, E_1, E_2: have hES_EM : Disjoint E_S E_M := by rw [Finset.disjoint_left] intro e heS heM rcases Finset.mem_image.mp heS with ⟨e', _, rfl⟩ rcases Finset.mem_image.mp heM with ⟨⟨m, hm⟩, _, heq⟩ obtain ⟨u, v⟩ := e' simp only [Sym2.map_mk, Sym2.eq_iff] at heq rcases heq with ⟨ha, _⟩ | ⟨ha, _⟩ · have hv : m.1 = u.1 := congrArg Subtype.val ha exact (Finset.mem_compl.mp (hMin m hm).1) (hv ▸ u.2) · have hv : m.1 = v.1 := congrArg Subtype.val ha exact (Finset.mem_compl.mp (hMin m hm).1) (hv ▸ v.2) have hES_E1 : Disjoint E_S E_1 := by rw [Finset.disjoint_left] intro e heS he1 rcases Finset.mem_image.mp heS with ⟨e', _, rfl⟩ rcases Finset.mem_image.mp he1 with ⟨⟨m, hm⟩, _, heq⟩ obtain ⟨u, v⟩ := e' simp only [Sym2.map_mk, Sym2.eq_iff] at heq rcases heq with ⟨ha, _⟩ | ⟨ha, _⟩ · have hv : m.1 = u.1 := congrArg Subtype.val ha exact (Finset.mem_compl.mp (hMin m hm).1) (hv ▸ u.2) · have hv : m.1 = v.1 := congrArg Subtype.val ha exact (Finset.mem_compl.mp (hMin m hm).1) (hv ▸ v.2) have hES_E2 : Disjoint E_S E_2 := by rw [Finset.disjoint_left] intro e heS he2 rcases Finset.mem_image.mp heS with ⟨e', _, rfl⟩ rcases Finset.mem_image.mp he2 with ⟨⟨m, hm⟩, _, heq⟩ obtain ⟨u, v⟩ := e' simp only [Sym2.map_mk, Sym2.eq_iff] at heq rcases heq with ⟨ha, _⟩ | ⟨ha, _⟩ · have hv : m.2 = u.1 := congrArg Subtype.val ha exact (Finset.mem_compl.mp (hMin m hm).2.1) (hv ▸ u.2) · have hv : m.2 = v.1 := congrArg Subtype.val ha exact (Finset.mem_compl.mp (hMin m hm).2.1) (hv ▸ v.2) have hEM_E1 : Disjoint E_M E_1 := by rw [Finset.disjoint_left] intro e heM he1 rcases Finset.mem_image.mp heM with ⟨⟨m₁, hm₁⟩, _, rfl⟩ rcases Finset.mem_image.mp he1 with ⟨⟨m₂, hm₂⟩, _, heq⟩ rw [Sym2.eq_iff] at heq rcases heq with ⟨_, hb⟩ | ⟨_, hb⟩ · have hv : m₁.2 = dom m₂.1 := (congrArg Subtype.val hb).symm exact (Finset.mem_compl.mp (hMin m₁ hm₁).2.1) (hv ▸ hdom_mem m₂.1) · have hv : m₁.1 = dom m₂.1 := (congrArg Subtype.val hb).symm exact (Finset.mem_compl.mp (hMin m₁ hm₁).1) (hv ▸ hdom_mem m₂.1) have hEM_E2 : Disjoint E_M E_2 := by rw [Finset.disjoint_left] intro e heM he2 rcases Finset.mem_image.mp heM with ⟨⟨m₁, hm₁⟩, _, rfl⟩ rcases Finset.mem_image.mp he2 with ⟨⟨m₂, hm₂⟩, _, heq⟩ rw [Sym2.eq_iff] at heq rcases heq with ⟨_, hb⟩ | ⟨_, hb⟩ · have hv : m₁.2 = dom m₂.2 := (congrArg Subtype.val hb).symm exact (Finset.mem_compl.mp (hMin m₁ hm₁).2.1) (hv ▸ hdom_mem m₂.2) · have hv : m₁.1 = dom m₂.2 := (congrArg Subtype.val hb).symm exact (Finset.mem_compl.mp (hMin m₁ hm₁).1) (hv ▸ hdom_mem m₂.2) have hE1_E2 : Disjoint E_1 E_2 := by rw [Finset.disjoint_left] intro e he1 he2 rcases Finset.mem_image.mp he1 with ⟨⟨m₁, hm₁⟩, _, rfl⟩ rcases Finset.mem_image.mp he2 with ⟨⟨m₂, hm₂⟩, _, heq⟩ rw [Sym2.eq_iff] at heq rcases heq with ⟨ha, _⟩ | ⟨_, hb⟩ · have hv : m₁.1 = m₂.2 := (congrArg Subtype.val ha).symm exact Finset.disjoint_left.mp hM₁₂_disj (Finset.mem_image_of_mem _ hm₁) (hv ▸ Finset.mem_image_of_mem _ hm₂) · have hv : m₁.1 = dom m₂.2 := (congrArg Subtype.val hb).symm exact (Finset.mem_compl.mp (hMin m₁ hm₁).1) (hv ▸ hdom_mem m₂.2) have h4_le : TS.edgeFinset.card + 3 * M.card ≤ TW.edgeFinset.card := by have hsub : E_S ∪ (E_M ∪ (E_1 ∪ E_2)) ⊆ TW.edgeFinset := Finset.union_subset hES_sub (Finset.union_subset hEM_sub (Finset.union_subset hE1_sub hE2_sub)) have hcard_u : (E_S ∪ (E_M ∪ (E_1 ∪ E_2))).card = TS.edgeFinset.card + 3 * M.card := by rw [Finset.card_union_of_disjoint (Finset.disjoint_union_right.mpr ⟨hES_EM, Finset.disjoint_union_right.mpr ⟨hES_E1, hES_E2⟩⟩), Finset.card_union_of_disjoint (Finset.disjoint_union_right.mpr ⟨hEM_E1, hEM_E2⟩), Finset.card_union_of_disjoint hE1_E2, hES_card, hEM_card, hE1_card, hE2_card] omega rw [← hcard_u] exact Finset.card_le_card hsub omega /-- Corollary: `2 * τ(T) + 2 ≤ 3 * γ_t(T)` for every tree `T` of order `≥ 2`. -/ theorem tree_vertexCover_le_three_halves_totalDom (T : SimpleGraph α) (hT : T.IsTree) (hn : 2 ≤ Fintype.card α) : 2 * T.vertexCoverNum.toNat + 2 ≤ 3 * totalDominationNumber T := by obtain ⟨S, hS, hScard⟩ := exists_min_totalDominating hT.connected hn rw [← hScard] exact two_mul_vertexCoverNum_add_two_le_three_mul_card T hT hn S hS end UniversalBound section TwoPaths /-- Path neighborhood of index `r` inside `{0, ..., m - 1}`. -/ def pathNbrs (m r : ℕ) : Finset ℕ := (Finset.range m).filter (fun t => t + 1 = r ∨ r + 1 = t) lemma mem_pathNbrs {m r t : ℕ} : t ∈ pathNbrs m r ↔ t < m ∧ (t + 1 = r ∨ r + 1 = t) := by simp [pathNbrs] lemma card_pathNbrs_le_two (m r : ℕ) : (pathNbrs m r).card ≤ 2 := by have hsub : pathNbrs m r ⊆ ({r - 1, r + 1} : Finset ℕ) := by intro t ht rw [mem_pathNbrs] at ht simp only [Finset.mem_insert, Finset.mem_singleton] omega exact le_trans (Finset.card_le_card hsub) Finset.card_le_two lemma card_pathNbrs_eq_two_iff {m r : ℕ} (hr : r < m) : (pathNbrs m r).card = 2 ↔ 0 < r ∧ r + 1 < m := by constructor · intro hcard by_contra h push Not at h by_cases hr0 : r = 0 · have hsub : pathNbrs m r ⊆ {1} := by intro t ht; rw [mem_pathNbrs] at ht; simp; omega have := le_trans (Finset.card_le_card hsub) (by simp : ({1} : Finset ℕ).card ≤ 1) omega · have hrm : m ≤ r + 1 := h (by omega) have hsub : pathNbrs m r ⊆ {r - 1} := by intro t ht; rw [mem_pathNbrs] at ht; simp; omega have := le_trans (Finset.card_le_card hsub) (by simp : ({r - 1} : Finset ℕ).card ≤ 1) omega · rintro ⟨h1, h2⟩ have heq : pathNbrs m r = {r - 1, r + 1} := by ext t rw [mem_pathNbrs] simp only [Finset.mem_insert, Finset.mem_singleton] omega rw [heq, Finset.card_pair (by omega)] /-- Key parity obstruction on an odd-length path `0, ..., 2a`: if `I ⊆ range (2a + 1)` has `I.card = a`, covers `(range (2a + 1)).erase (2k)` via `pathNbrs`, and contains `2k`, we obtain a contradiction (the prefix `{0, ..., 2k - 2}` of odd cardinality `2k - 1` is partitioned into pairwise disjoint 2-element neighborhoods!). -/ lemma odd_path_parity_obstruction (a k : ℕ) (hk : 2 * k < 2 * a + 1) (I : Finset ℕ) (hIcard : I.card = a) (hcov : (Finset.range (2 * a + 1)).erase (2 * k) ⊆ I.biUnion (pathNbrs (2 * a + 1))) (hk_mem : 2 * k ∈ I) : False := by let m := 2 * a + 1 have hm_eq : m = 2 * a + 1 := rfl have hcard_er : ((Finset.range m).erase (2 * k)).card = 2 * a := by rw [Finset.card_erase_of_mem (Finset.mem_range.mpr hk), Finset.card_range] omega have h1 : 2 * a ≤ (I.biUnion (pathNbrs m)).card := by rw [← hcard_er] exact Finset.card_le_card hcov have h2 : (I.biUnion (pathNbrs m)).card ≤ ∑ r ∈ I, (pathNbrs m r).card := Finset.card_biUnion_le have h3 : ∑ r ∈ I, (pathNbrs m r).card ≤ 2 * a := by calc ∑ r ∈ I, (pathNbrs m r).card ≤ ∑ _r ∈ I, 2 := Finset.sum_le_sum fun r _ => card_pathNbrs_le_two m r _ = 2 * a := by simp [hIcard, mul_comm] have hcard2 : ∀ r ∈ I, (pathNbrs m r).card = 2 := by by_contra hnot push Not at hnot obtain ⟨r₀, hr₀, hne⟩ := hnot have hlt : (pathNbrs m r₀).card < 2 := lt_of_le_of_ne (card_pathNbrs_le_two m r₀) hne have hstrict : ∑ r ∈ I, (pathNbrs m r).card < ∑ _r ∈ I, 2 := Finset.sum_lt_sum (fun r _ => card_pathNbrs_le_two m r) ⟨r₀, hr₀, hlt⟩ simp only [Finset.sum_const, smul_eq_mul, hIcard] at hstrict omega have hbi_eq : (I.biUnion (pathNbrs m)).card = ∑ r ∈ I, (pathNbrs m r).card := by omega have hdisj : (I : Set ℕ).PairwiseDisjoint (pathNbrs m) := by intro r₁ hr₁ r₂ hr₂ hne by_contra hndisj rw [Finset.not_disjoint_iff] at hndisj obtain ⟨t, ht₁, ht₂⟩ := hndisj have hr₁_mem : r₁ ∈ I := Finset.mem_coe.mp hr₁ have hr₂_mem : r₂ ∈ I.erase r₁ := Finset.mem_erase.mpr ⟨hne.symm, Finset.mem_coe.mp hr₂⟩ have hsplit : I.biUnion (pathNbrs m) = pathNbrs m r₁ ∪ (I.erase r₁).biUnion (pathNbrs m) := by rw [← Finset.biUnion_insert, Finset.insert_erase hr₁_mem] have ht_in_er : t ∈ (I.erase r₁).biUnion (pathNbrs m) := Finset.mem_biUnion.mpr ⟨r₂, hr₂_mem, ht₂⟩ have hinter_pos : 0 < (pathNbrs m r₁ ∩ (I.erase r₁).biUnion (pathNbrs m)).card := Finset.card_pos.mpr ⟨t, Finset.mem_inter.mpr ⟨ht₁, ht_in_er⟩⟩ have hlt_u : (I.biUnion (pathNbrs m)).card < (pathNbrs m r₁).card + ((I.erase r₁).biUnion (pathNbrs m)).card := by rw [hsplit] have := Finset.card_union_add_card_inter (pathNbrs m r₁) ((I.erase r₁).biUnion (pathNbrs m)) omega have hle_er : ((I.erase r₁).biUnion (pathNbrs m)).card ≤ ∑ r ∈ I.erase r₁, (pathNbrs m r).card := Finset.card_biUnion_le have hsum_split : ∑ r ∈ I, (pathNbrs m r).card = (pathNbrs m r₁).card + ∑ r ∈ I.erase r₁, (pathNbrs m r).card := (Finset.add_sum_erase I (fun r => (pathNbrs m r).card) hr₁_mem).symm omega have hbi_eq_set : I.biUnion (pathNbrs m) = (Finset.range m).erase (2 * k) := by symm exact Finset.eq_of_subset_of_card_le hcov (by omega) have hk_not_bi : 2 * k ∉ I.biUnion (pathNbrs m) := by rw [hbi_eq_set]; exact Finset.notMem_erase _ _ have hk_pos : 0 < 2 * k := ((card_pathNbrs_eq_two_iff hk).mp (hcard2 (2 * k) hk_mem)).1 let IL := I.filter (fun r => r < 2 * k) have hIL_eq : IL.biUnion (pathNbrs m) = Finset.range (2 * k - 1) := by ext t rw [Finset.mem_biUnion, Finset.mem_range] constructor · rintro ⟨r, hrIL, ht⟩ rcases Finset.mem_filter.mp hrIL with ⟨hrI, hrlt⟩ rw [mem_pathNbrs] at ht have hr_ne : r ≠ 2 * k - 1 := by intro heq apply hk_not_bi exact Finset.mem_biUnion.mpr ⟨r, hrI, mem_pathNbrs.mpr ⟨hk, Or.inr (by omega)⟩⟩ have hr_ne2 : r ≠ 2 * k - 2 := by intro heq have hdisj_r := hdisj (Finset.mem_coe.mpr hrI) (Finset.mem_coe.mpr hk_mem) (by omega) have hmem_r : 2 * k - 1 ∈ pathNbrs m r := mem_pathNbrs.mpr ⟨by omega, Or.inr (by omega)⟩ have hmem_k : 2 * k - 1 ∈ pathNbrs m (2 * k) := mem_pathNbrs.mpr ⟨by omega, Or.inl (by omega)⟩ exact Finset.disjoint_left.mp hdisj_r hmem_r hmem_k omega · intro ht have htm : t < m := by omega have ht_ne : t ≠ 2 * k := by omega have ht_in : t ∈ I.biUnion (pathNbrs m) := by rw [hbi_eq_set] exact Finset.mem_erase.mpr ⟨ht_ne, Finset.mem_range.mpr htm⟩ rcases Finset.mem_biUnion.mp ht_in with ⟨r, hrI, htr⟩ rw [mem_pathNbrs] at htr refine ⟨r, Finset.mem_filter.mpr ⟨hrI, ?_⟩, mem_pathNbrs.mpr htr⟩ omega have hdisj_IL : (IL : Set ℕ).PairwiseDisjoint (pathNbrs m) := hdisj.subset (Finset.coe_subset.mpr (Finset.filter_subset _ _)) have hcount : (Finset.range (2 * k - 1)).card = 2 * IL.card := by rw [← hIL_eq, Finset.card_biUnion hdisj_IL] have hsum2 : ∑ r ∈ IL, (pathNbrs m r).card = ∑ _r ∈ IL, 2 := Finset.sum_congr rfl fun r hr => hcard2 r (Finset.mem_filter.mp hr).1 rw [hsum2] simp [mul_comm] rw [Finset.card_range] at hcount omega /-- Every walk that is a path of length `L.length - 1` gives `L.length - 1` distinct edges in `G.edgeFinset`, all having both endpoints in `L.toFinset`. -/ lemma path_consecutive_edges_card {α : Type*} [Fintype α] [DecidableEq α] (G : SimpleGraph α) [DecidableRel G.Adj] {u v : α} (p : G.Walk u v) (hp : p.IsPath) : let L := p.support let E : Finset (Sym2 α) := (Finset.range (L.length - 1)).image (fun i => s(L.getD i u, L.getD (i + 1) u)) E.card = L.length - 1 ∧ E ⊆ G.edgeFinset ∧ (∀ e ∈ E, ∀ x ∈ e, x ∈ L.toFinset) := by intro L E have hnd : L.Nodup := hp.support_nodup have hgetD : ∀ i (hi : i < L.length), L.getD i u = L[i] := fun i hi => by simp [List.getD_eq_getElem?_getD, List.getElem?_eq_getElem hi] have hadj : ∀ i, (hi : i + 1 < L.length) → G.Adj (L.getD i u) (L.getD (i + 1) u) := by intro i hi rw [hgetD i (by omega), hgetD (i + 1) hi] have hlen_sup : p.support.length = p.length + 1 := Walk.length_support p have hL_eq : L.length = p.support.length := rfl have hi' : i < p.length := by omega have h1 := p.adj_getVert_succ hi' rw [walk_getVert_eq_support_getElem p i (by omega), walk_getVert_eq_support_getElem p (i + 1) hi] at h1 exact h1 have hcard : E.card = L.length - 1 := by rw [← Finset.card_range (L.length - 1)] apply Finset.card_image_of_injOn intro i hi j hj heq dsimp only at heq rw [Finset.mem_coe, Finset.mem_range] at hi hj rw [hgetD i (by omega), hgetD (i + 1) (by omega), hgetD j (by omega), hgetD (j + 1) (by omega), Sym2.eq_iff] at heq rcases heq with ⟨h1, _⟩ | ⟨h1, h2⟩ · exact (List.Nodup.getElem_inj_iff hnd).mp h1 · have e1 := (List.Nodup.getElem_inj_iff hnd).mp h1 have e2 := (List.Nodup.getElem_inj_iff hnd).mp h2 omega have hsub : E ⊆ G.edgeFinset := by intro e he rcases Finset.mem_image.mp he with ⟨i, hi, rfl⟩ rw [Finset.mem_range] at hi exact G.mem_edgeFinset.mpr (hadj i (by omega)) have hends : ∀ e ∈ E, ∀ x ∈ e, x ∈ L.toFinset := by intro e he x hx rcases Finset.mem_image.mp he with ⟨i, hi, rfl⟩ rw [Finset.mem_range] at hi rw [Sym2.mem_iff] at hx rcases hx with rfl | rfl · rw [hgetD i (by omega)]; exact List.mem_toFinset.mpr (List.getElem_mem _) · rw [hgetD (i + 1) (by omega)]; exact List.mem_toFinset.mpr (List.getElem_mem _) exact ⟨hcard, hsub, hends⟩ /-- Cardinality of even or odd indices in `Finset.range m`. -/ lemma card_filter_mod_two_range (m r : ℕ) (hr : r = 0 ∨ r = 1) : ((Finset.range m).filter (fun i => i % 2 = r)).card = if r = 1 then m / 2 else (m + 1) / 2 := by induction m with | zero => simp | succ k ih => rw [Finset.range_add_one, Finset.filter_insert] split_ifs with h1 h2 <;> simp_all <;> omega /-- **Two-Path Tree Theorem (`WOWII Conjecture 372`, two-path variant)**: Every finite tree `T` of order `≥ 2` with `p(T) ≤ 2` satisfies `τ(T) ≤ γ_t(T)`. -/ theorem conjecture372_two_paths {α : Type*} [Fintype α] [DecidableEq α] (T : SimpleGraph α) (hT : T.IsTree) (hn : 2 ≤ Fintype.card α) (hp : pathCoverNumber T ≤ 2) : T.vertexCoverNum.toNat ≤ totalDominationNumber T := by classical obtain ⟨S, hS, hScard⟩ := exists_min_totalDominating hT.connected hn rw [← hScard] obtain ⟨P, hPcard, hPdisj, hPcov, hPpaths⟩ := exists_min_pathCover T have hPle2 : P.card ≤ 2 := hPcard.symm ▸ hp have hPpos : 1 ≤ P.card := by by_contra h0 have hPempty : P = ∅ := Finset.card_eq_zero.mp (by omega) have : Nonempty α := Fintype.card_pos_iff.mp (by omega) obtain ⟨v⟩ := ‹Nonempty α› have hv := hPcov (Finset.mem_univ v) simp [hPempty] at hv have hT_edges : T.edgeFinset.card + 1 = Fintype.card α := hT.card_edgeFinset by_cases hP1 : P.card = 1 · -- Case `p(T) = 1`: `T` is a single path `P_n` (`n ≥ 2`). obtain ⟨s, rfl⟩ := Finset.card_eq_one.mp hP1 obtain ⟨u, v, p, hp_path, hs_eq⟩ := hPpaths s (Finset.mem_singleton_self s) let L := p.support have hLnd : L.Nodup := hp_path.support_nodup have hs_univ : s = Finset.univ := by apply Finset.eq_univ_of_forall intro x have hx := hPcov (Finset.mem_univ x) simpa using hx have hLlen : L.length = Fintype.card α := by have := congrArg Finset.card hs_univ rw [hs_eq, List.toFinset_card_of_nodup hLnd, Finset.card_univ] at this exact this obtain ⟨hEcard, hEsub, _⟩ := path_consecutive_edges_card T p hp_path let E : Finset (Sym2 α) := (Finset.range (L.length - 1)).image (fun i => s(L.getD i u, L.getD (i + 1) u)) have hEcard' : E.card = L.length - 1 := hEcard have hE_eq : E = T.edgeFinset := by apply Finset.eq_of_subset_of_card_le hEsub change T.edgeFinset.card ≤ E.card omega let C : Finset α := ((Finset.range L.length).filter (fun i => i % 2 = 1)).image (fun i => L.getD i u) have hC_cov : T.IsVertexCover (C : Set α) := by intro a b hab have heE : s(a, b) ∈ E := hE_eq.symm ▸ (T.mem_edgeFinset.mpr hab) rcases Finset.mem_image.mp heE with ⟨i, hi, heq⟩ rw [Finset.mem_range] at hi rw [Sym2.eq_iff] at heq have hcov_pair : L.getD i u ∈ C ∨ L.getD (i + 1) u ∈ C := by by_cases hip : i % 2 = 1 · exact Or.inl (Finset.mem_image.mpr ⟨i, Finset.mem_filter.mpr ⟨Finset.mem_range.mpr (by omega), hip⟩, rfl⟩) · exact Or.inr (Finset.mem_image.mpr ⟨i + 1, Finset.mem_filter.mpr ⟨Finset.mem_range.mpr (by omega), by omega⟩, rfl⟩) rcases heq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ · exact hcov_pair.imp Finset.mem_coe.mpr Finset.mem_coe.mpr · exact hcov_pair.symm.imp Finset.mem_coe.mpr Finset.mem_coe.mpr have hC_card : C.card ≤ L.length / 2 := by calc C.card ≤ ((Finset.range L.length).filter (fun i => i % 2 = 1)).card := Finset.card_image_le _ = L.length / 2 := by simpa using card_filter_mod_two_range L.length 1 (Or.inr rfl) let IS : Finset ℕ := (Finset.range L.length).filter (fun i => L.getD i u ∈ S) have hgetD : ∀ i (hi : i < L.length), L.getD i u = L[i] := fun i hi => by simp [List.getD_eq_getElem?_getD, List.getElem?_eq_getElem hi] have hIS_card : IS.card = S.card := by have himg : IS.image (fun i => L.getD i u) = S := by ext x rw [Finset.mem_image] constructor · rintro ⟨i, hi, rfl⟩; exact (Finset.mem_filter.mp hi).2 · intro hxS have hxL : x ∈ L := List.mem_toFinset.mp (hs_eq ▸ hs_univ ▸ Finset.mem_univ x) obtain ⟨i, hi, hix⟩ := List.getElem_of_mem hxL exact ⟨i, Finset.mem_filter.mpr ⟨Finset.mem_range.mpr hi, by rw [hgetD i hi, hix]; exact hxS⟩, by rw [hgetD i hi, hix]⟩ rw [← himg]; symm apply Finset.card_image_of_injOn intro i hi j hj heq dsimp only at heq have hi' := Finset.mem_range.mp (Finset.mem_filter.mp (Finset.mem_coe.mp hi)).1 have hj' := Finset.mem_range.mp (Finset.mem_filter.mp (Finset.mem_coe.mp hj)).1 rw [hgetD i hi', hgetD j hj'] at heq exact (List.Nodup.getElem_inj_iff hLnd).mp heq have hcov_all : Finset.range L.length ⊆ IS.biUnion (pathNbrs L.length) := by intro t ht rw [Finset.mem_range] at ht obtain ⟨w, hwS, htw⟩ := hS (L.getD t u) have heE : s(L.getD t u, w) ∈ E := hE_eq.symm ▸ (T.mem_edgeFinset.mpr htw) rcases Finset.mem_image.mp heE with ⟨i, hi, heq⟩ rw [Finset.mem_range] at hi rw [Sym2.eq_iff] at heq rcases heq with ⟨h1, h2⟩ | ⟨h1, h2⟩ · rw [hgetD i (by omega), hgetD t ht] at h1 have hit : i = t := (List.Nodup.getElem_inj_iff hLnd).mp h1 subst hit refine Finset.mem_biUnion.mpr ⟨i + 1, ?_, mem_pathNbrs.mpr ⟨ht, Or.inl rfl⟩⟩ exact Finset.mem_filter.mpr ⟨Finset.mem_range.mpr (by omega), h2 ▸ Finset.mem_coe.mp hwS⟩ · rw [hgetD (i + 1) (by omega), hgetD t ht] at h2 have hit : i + 1 = t := (List.Nodup.getElem_inj_iff hLnd).mp h2 refine Finset.mem_biUnion.mpr ⟨i, ?_, mem_pathNbrs.mpr ⟨ht, Or.inr hit⟩⟩ exact Finset.mem_filter.mpr ⟨Finset.mem_range.mpr (by omega), h1 ▸ Finset.mem_coe.mp hwS⟩ have hlen_le : L.length ≤ 2 * S.card := by calc L.length = (Finset.range L.length).card := (Finset.card_range _).symm _ ≤ (IS.biUnion (pathNbrs L.length)).card := Finset.card_le_card hcov_all _ ≤ ∑ r ∈ IS, (pathNbrs L.length r).card := Finset.card_biUnion_le _ ≤ ∑ _r ∈ IS, 2 := Finset.sum_le_sum fun r _ => card_pathNbrs_le_two _ _ _ = 2 * S.card := by simp [hIS_card, mul_comm] have htau := vertexCoverNum_toNat_le_card T C hC_cov omega · -- Case `p(T) = 2`: `P = {s₁, s₂}`, disjoint paths covering `V(T)`. have hP2 : P.card = 2 := by omega obtain ⟨s₁, s₂, hs12_ne, rfl⟩ := Finset.card_eq_two.mp hP2 have hdisj12 : Disjoint s₁ s₂ := hPdisj s₁ (by simp) s₂ (by simp) hs12_ne have hunion12 : s₁ ∪ s₂ = Finset.univ := by apply Finset.eq_univ_of_forall intro x have hx := hPcov (Finset.mem_univ x) simpa using hx obtain ⟨u₁, v₁, p₁, hp₁, hs₁_eq⟩ := hPpaths s₁ (by simp) obtain ⟨u₂, v₂, p₂, hp₂, hs₂_eq⟩ := hPpaths s₂ (by simp) let L₁ := p₁.support let L₂ := p₂.support let m₁ := L₁.length let m₂ := L₂.length have hnd₁ : L₁.Nodup := hp₁.support_nodup have hnd₂ : L₂.Nodup := hp₂.support_nodup have hm₁_pos : 1 ≤ m₁ := by simp [m₁, L₁, Walk.length_support] have hm₂_pos : 1 ≤ m₂ := by simp [m₂, L₂, Walk.length_support] have hs₁_card : s₁.card = m₁ := by rw [hs₁_eq, List.toFinset_card_of_nodup hnd₁] have hs₂_card : s₂.card = m₂ := by rw [hs₂_eq, List.toFinset_card_of_nodup hnd₂] have hsum_m : m₁ + m₂ = Fintype.card α := by rw [← hs₁_card, ← hs₂_card, ← Finset.card_union_of_disjoint hdisj12, hunion12, Finset.card_univ] have hex_bridge : ∃ x ∈ s₁, ∃ y ∈ s₂, T.Adj x y := by have hu₁s₁ : u₁ ∈ s₁ := hs₁_eq ▸ List.mem_toFinset.mpr (Walk.start_mem_support p₁) have hu₂s₂ : u₂ ∈ s₂ := hs₂_eq ▸ List.mem_toFinset.mpr (Walk.start_mem_support p₂) obtain ⟨w⟩ := hT.connected u₁ u₂ suffices hwalk : ∀ {a b : α} (q : T.Walk a b), a ∈ s₁ → b ∈ s₂ → ∃ x ∈ s₁, ∃ y ∈ s₂, T.Adj x y from hwalk w hu₁s₁ hu₂s₂ intro a b q induction q with | nil => intro ha hb; exact (Finset.disjoint_left.mp hdisj12 ha hb).elim | @cons a c b hac q' ih => intro ha hb by_cases hc : c ∈ s₁ · exact ih hc hb · have hc2 : c ∈ s₂ := by have := hunion12 ▸ Finset.mem_univ c rw [Finset.mem_union] at this exact this.resolve_left hc exact ⟨a, ha, c, hc2, hac⟩ obtain ⟨x, hxs₁, y, hys₂, hxy⟩ := hex_bridge obtain ⟨hE₁_card, hE₁_sub, hE₁_ends⟩ := path_consecutive_edges_card T p₁ hp₁ obtain ⟨hE₂_card, hE₂_sub, hE₂_ends⟩ := path_consecutive_edges_card T p₂ hp₂ let E₁ : Finset (Sym2 α) := (Finset.range (m₁ - 1)).image (fun i => s(L₁.getD i u₁, L₁.getD (i + 1) u₁)) let E₂ : Finset (Sym2 α) := (Finset.range (m₂ - 1)).image (fun i => s(L₂.getD i u₂, L₂.getD (i + 1) u₂)) have hE₁_card' : E₁.card = m₁ - 1 := hE₁_card have hE₂_card' : E₂.card = m₂ - 1 := hE₂_card have hE₁₂_disj : Disjoint E₁ E₂ := by rw [Finset.disjoint_left] intro e he₁ he₂ obtain ⟨a, b⟩ := e have ha₁ : a ∈ s₁ := hs₁_eq ▸ hE₁_ends s(a, b) he₁ a (Sym2.mem_mk_left a b) have ha₂ : a ∈ s₂ := hs₂_eq ▸ hE₂_ends s(a, b) he₂ a (Sym2.mem_mk_left a b) exact Finset.disjoint_left.mp hdisj12 ha₁ ha₂ have hxy_not_E₁ : s(x, y) ∉ E₁ := fun h => Finset.disjoint_left.mp hdisj12 (hs₁_eq ▸ hE₁_ends _ h y (Sym2.mem_mk_right x y)) hys₂ have hxy_not_E₂ : s(x, y) ∉ E₂ := fun h => Finset.disjoint_left.mp hdisj12 hxs₁ (hs₂_eq ▸ hE₂_ends _ h x (Sym2.mem_mk_left x y)) have hE_total : insert s(x, y) (E₁ ∪ E₂) = T.edgeFinset := by apply Finset.eq_of_subset_of_card_le · exact Finset.insert_subset (T.mem_edgeFinset.mpr hxy) (Finset.union_subset hE₁_sub hE₂_sub) · rw [Finset.card_insert_of_notMem (by simp [hxy_not_E₁, hxy_not_E₂]), Finset.card_union_of_disjoint hE₁₂_disj] omega have hgetD₁ : ∀ t (ht : t < m₁), L₁.getD t u₁ = L₁[t] := fun t ht => by simp [List.getD_eq_getElem?_getD, List.getElem?_eq_getElem ht] have hgetD₂ : ∀ t (ht : t < m₂), L₂.getD t u₂ = L₂[t] := fun t ht => by simp [List.getD_eq_getElem?_getD, List.getElem?_eq_getElem ht] obtain ⟨i₀, hi₀, hx_eq⟩ := List.getElem_of_mem (List.mem_toFinset.mp (hs₁_eq ▸ hxs₁)) obtain ⟨j₀, hj₀, hy_eq⟩ := List.getElem_of_mem (List.mem_toFinset.mp (hs₂_eq ▸ hys₂)) let S₁ : Finset α := S ∩ s₁ let S₂ : Finset α := S ∩ s₂ have hS_split : S.card = S₁.card + S₂.card := by have hdisjS : Disjoint S₁ S₂ := hdisj12.mono Finset.inter_subset_right Finset.inter_subset_right have huS : S₁ ∪ S₂ = S := by rw [← Finset.inter_union_distrib_left, hunion12, Finset.inter_univ] rw [← huS, Finset.card_union_of_disjoint hdisjS] let I₁ : Finset ℕ := (Finset.range m₁).filter (fun t => L₁.getD t u₁ ∈ S₁) let I₂ : Finset ℕ := (Finset.range m₂).filter (fun t => L₂.getD t u₂ ∈ S₂) have hI₁_card : I₁.card = S₁.card := by have himg : I₁.image (fun t => L₁.getD t u₁) = S₁ := by ext z; rw [Finset.mem_image]; constructor · rintro ⟨t, ht, rfl⟩; exact (Finset.mem_filter.mp ht).2 · intro hz have hzL : z ∈ L₁ := List.mem_toFinset.mp (hs₁_eq ▸ (Finset.mem_inter.mp hz).2) obtain ⟨t, ht, htz⟩ := List.getElem_of_mem hzL exact ⟨t, Finset.mem_filter.mpr ⟨Finset.mem_range.mpr ht, by rw [hgetD₁ t ht, htz]; exact hz⟩, by rw [hgetD₁ t ht, htz]⟩ rw [← himg]; symm apply Finset.card_image_of_injOn intro a ha b hb heq dsimp only at heq have ha' := Finset.mem_range.mp (Finset.mem_filter.mp (Finset.mem_coe.mp ha)).1 have hb' := Finset.mem_range.mp (Finset.mem_filter.mp (Finset.mem_coe.mp hb)).1 rw [hgetD₁ a ha', hgetD₁ b hb'] at heq exact (List.Nodup.getElem_inj_iff hnd₁).mp heq have hI₂_card : I₂.card = S₂.card := by have himg : I₂.image (fun t => L₂.getD t u₂) = S₂ := by ext z; rw [Finset.mem_image]; constructor · rintro ⟨t, ht, rfl⟩; exact (Finset.mem_filter.mp ht).2 · intro hz have hzL : z ∈ L₂ := List.mem_toFinset.mp (hs₂_eq ▸ (Finset.mem_inter.mp hz).2) obtain ⟨t, ht, htz⟩ := List.getElem_of_mem hzL exact ⟨t, Finset.mem_filter.mpr ⟨Finset.mem_range.mpr ht, by rw [hgetD₂ t ht, htz]; exact hz⟩, by rw [hgetD₂ t ht, htz]⟩ rw [← himg]; symm apply Finset.card_image_of_injOn intro a ha b hb heq dsimp only at heq have ha' := Finset.mem_range.mp (Finset.mem_filter.mp (Finset.mem_coe.mp ha)).1 have hb' := Finset.mem_range.mp (Finset.mem_filter.mp (Finset.mem_coe.mp hb)).1 rw [hgetD₂ a ha', hgetD₂ b hb'] at heq exact (List.Nodup.getElem_inj_iff hnd₂).mp heq have hcov₁ : (Finset.range m₁).erase i₀ ⊆ I₁.biUnion (pathNbrs m₁) := by intro t ht rcases Finset.mem_erase.mp ht with ⟨ht_ne, htm⟩ rw [Finset.mem_range] at htm have htx_ne : L₁.getD t u₁ ≠ x := by rw [hgetD₁ t htm, ← hx_eq] exact fun h => ht_ne ((List.Nodup.getElem_inj_iff hnd₁).mp h) obtain ⟨w, hwS, htw⟩ := hS (L₁.getD t u₁) have heT : s(L₁.getD t u₁, w) ∈ insert s(x, y) (E₁ ∪ E₂) := hE_total.symm ▸ (T.mem_edgeFinset.mpr htw) rw [Finset.mem_insert, Finset.mem_union] at heT rcases heT with hbr | he₁ | he₂ · rw [Sym2.eq_iff] at hbr rcases hbr with ⟨h1, _⟩ | ⟨h1, _⟩ · exact (htx_ne h1).elim · have ht1 : L₁.getD t u₁ ∈ s₁ := hs₁_eq ▸ List.mem_toFinset.mpr (hgetD₁ t htm ▸ List.getElem_mem _) exact (Finset.disjoint_left.mp hdisj12 ht1 (h1 ▸ hys₂)).elim · rcases Finset.mem_image.mp he₁ with ⟨r, hr, heq⟩ rw [Finset.mem_range] at hr rw [Sym2.eq_iff] at heq rcases heq with ⟨h1, h2⟩ | ⟨h1, h2⟩ · rw [hgetD₁ r (by omega), hgetD₁ t htm] at h1 have hrt : r = t := (List.Nodup.getElem_inj_iff hnd₁).mp h1 subst hrt refine Finset.mem_biUnion.mpr ⟨r + 1, ?_, mem_pathNbrs.mpr ⟨htm, Or.inl rfl⟩⟩ have hw1 : L₁.getD (r + 1) u₁ ∈ s₁ := hs₁_eq ▸ List.mem_toFinset.mpr (hgetD₁ (r + 1) (by omega) ▸ List.getElem_mem _) exact Finset.mem_filter.mpr ⟨Finset.mem_range.mpr (by omega), Finset.mem_inter.mpr ⟨h2 ▸ Finset.mem_coe.mp hwS, hw1⟩⟩ · rw [hgetD₁ (r + 1) (by omega), hgetD₁ t htm] at h2 have hrt : r + 1 = t := (List.Nodup.getElem_inj_iff hnd₁).mp h2 refine Finset.mem_biUnion.mpr ⟨r, ?_, mem_pathNbrs.mpr ⟨htm, Or.inr hrt⟩⟩ have hw1 : L₁.getD r u₁ ∈ s₁ := hs₁_eq ▸ List.mem_toFinset.mpr (hgetD₁ r (by omega) ▸ List.getElem_mem _) exact Finset.mem_filter.mpr ⟨Finset.mem_range.mpr (by omega), Finset.mem_inter.mpr ⟨h1 ▸ Finset.mem_coe.mp hwS, hw1⟩⟩ · have ht1 : L₁.getD t u₁ ∈ s₁ := hs₁_eq ▸ List.mem_toFinset.mpr (hgetD₁ t htm ▸ List.getElem_mem _) have ht2 : L₁.getD t u₁ ∈ s₂ := hs₂_eq ▸ hE₂_ends _ he₂ _ (Sym2.mem_mk_left _ _) exact (Finset.disjoint_left.mp hdisj12 ht1 ht2).elim have hcov₂ : (Finset.range m₂).erase j₀ ⊆ I₂.biUnion (pathNbrs m₂) := by intro t ht rcases Finset.mem_erase.mp ht with ⟨ht_ne, htm⟩ rw [Finset.mem_range] at htm have hty_ne : L₂.getD t u₂ ≠ y := by rw [hgetD₂ t htm, ← hy_eq] exact fun h => ht_ne ((List.Nodup.getElem_inj_iff hnd₂).mp h) obtain ⟨w, hwS, htw⟩ := hS (L₂.getD t u₂) have heT : s(L₂.getD t u₂, w) ∈ insert s(x, y) (E₁ ∪ E₂) := hE_total.symm ▸ (T.mem_edgeFinset.mpr htw) rw [Finset.mem_insert, Finset.mem_union] at heT rcases heT with hbr | he₁ | he₂ · rw [Sym2.eq_iff] at hbr rcases hbr with ⟨h1, _⟩ | ⟨h1, _⟩ · have ht2 : L₂.getD t u₂ ∈ s₂ := hs₂_eq ▸ List.mem_toFinset.mpr (hgetD₂ t htm ▸ List.getElem_mem _) exact (Finset.disjoint_left.mp hdisj12 (h1 ▸ hxs₁) ht2).elim · exact (hty_ne h1).elim · have ht2 : L₂.getD t u₂ ∈ s₂ := hs₂_eq ▸ List.mem_toFinset.mpr (hgetD₂ t htm ▸ List.getElem_mem _) have ht1 : L₂.getD t u₂ ∈ s₁ := hs₁_eq ▸ hE₁_ends _ he₁ _ (Sym2.mem_mk_left _ _) exact (Finset.disjoint_left.mp hdisj12 ht1 ht2).elim · rcases Finset.mem_image.mp he₂ with ⟨r, hr, heq⟩ rw [Finset.mem_range] at hr rw [Sym2.eq_iff] at heq rcases heq with ⟨h1, h2⟩ | ⟨h1, h2⟩ · rw [hgetD₂ r (by omega), hgetD₂ t htm] at h1 have hrt : r = t := (List.Nodup.getElem_inj_iff hnd₂).mp h1 subst hrt refine Finset.mem_biUnion.mpr ⟨r + 1, ?_, mem_pathNbrs.mpr ⟨htm, Or.inl rfl⟩⟩ have hw2 : L₂.getD (r + 1) u₂ ∈ s₂ := hs₂_eq ▸ List.mem_toFinset.mpr (hgetD₂ (r + 1) (by omega) ▸ List.getElem_mem _) exact Finset.mem_filter.mpr ⟨Finset.mem_range.mpr (by omega), Finset.mem_inter.mpr ⟨h2 ▸ Finset.mem_coe.mp hwS, hw2⟩⟩ · rw [hgetD₂ (r + 1) (by omega), hgetD₂ t htm] at h2 have hrt : r + 1 = t := (List.Nodup.getElem_inj_iff hnd₂).mp h2 refine Finset.mem_biUnion.mpr ⟨r, ?_, mem_pathNbrs.mpr ⟨htm, Or.inr hrt⟩⟩ have hw2 : L₂.getD r u₂ ∈ s₂ := hs₂_eq ▸ List.mem_toFinset.mpr (hgetD₂ r (by omega) ▸ List.getElem_mem _) exact Finset.mem_filter.mpr ⟨Finset.mem_range.mpr (by omega), Finset.mem_inter.mpr ⟨h1 ▸ Finset.mem_coe.mp hwS, hw2⟩⟩ have hS₁_lb : m₁ / 2 ≤ S₁.card := by have h1 : m₁ - 1 ≤ (I₁.biUnion (pathNbrs m₁)).card := by have hce : ((Finset.range m₁).erase i₀).card = m₁ - 1 := by rw [Finset.card_erase_of_mem (Finset.mem_range.mpr hi₀), Finset.card_range] rw [← hce]; exact Finset.card_le_card hcov₁ have h2 : (I₁.biUnion (pathNbrs m₁)).card ≤ 2 * S₁.card := by calc (I₁.biUnion (pathNbrs m₁)).card ≤ ∑ r ∈ I₁, (pathNbrs m₁ r).card := Finset.card_biUnion_le _ ≤ ∑ _r ∈ I₁, 2 := Finset.sum_le_sum fun r _ => card_pathNbrs_le_two _ _ _ = 2 * S₁.card := by simp [hI₁_card, mul_comm] omega have hS₂_lb : m₂ / 2 ≤ S₂.card := by have h1 : m₂ - 1 ≤ (I₂.biUnion (pathNbrs m₂)).card := by have hce : ((Finset.range m₂).erase j₀).card = m₂ - 1 := by rw [Finset.card_erase_of_mem (Finset.mem_range.mpr hj₀), Finset.card_range] rw [← hce]; exact Finset.card_le_card hcov₂ have h2 : (I₂.biUnion (pathNbrs m₂)).card ≤ 2 * S₂.card := by calc (I₂.biUnion (pathNbrs m₂)).card ≤ ∑ r ∈ I₂, (pathNbrs m₂ r).card := Finset.card_biUnion_le _ ≤ ∑ _r ∈ I₂, 2 := Finset.sum_le_sum fun r _ => card_pathNbrs_le_two _ _ _ = 2 * S₂.card := by simp [hI₂_card, mul_comm] omega let cov₁ (r : ℕ) : Finset α := ((Finset.range m₁).filter (fun t => t % 2 = r)).image (fun t => L₁.getD t u₁) let cov₂ (r : ℕ) : Finset α := ((Finset.range m₂).filter (fun t => t % 2 = r)).image (fun t => L₂.getD t u₂) have hcov₁_E₁ : ∀ r, (r = 0 ∨ r = 1) → ∀ a b, s(a, b) ∈ E₁ → a ∈ cov₁ r ∨ b ∈ cov₁ r := by intro r hr a b he rcases Finset.mem_image.mp he with ⟨t, ht, heq⟩ rw [Finset.mem_range] at ht rw [Sym2.eq_iff] at heq have hpair : L₁.getD t u₁ ∈ cov₁ r ∨ L₁.getD (t + 1) u₁ ∈ cov₁ r := by by_cases htp : t % 2 = r · exact Or.inl (Finset.mem_image.mpr ⟨t, Finset.mem_filter.mpr ⟨Finset.mem_range.mpr (by omega), htp⟩, rfl⟩) · exact Or.inr (Finset.mem_image.mpr ⟨t + 1, Finset.mem_filter.mpr ⟨Finset.mem_range.mpr (by omega), by omega⟩, rfl⟩) rcases heq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ · exact hpair · exact hpair.symm have hcov₂_E₂ : ∀ r, (r = 0 ∨ r = 1) → ∀ a b, s(a, b) ∈ E₂ → a ∈ cov₂ r ∨ b ∈ cov₂ r := by intro r hr a b he rcases Finset.mem_image.mp he with ⟨t, ht, heq⟩ rw [Finset.mem_range] at ht rw [Sym2.eq_iff] at heq have hpair : L₂.getD t u₂ ∈ cov₂ r ∨ L₂.getD (t + 1) u₂ ∈ cov₂ r := by by_cases htp : t % 2 = r · exact Or.inl (Finset.mem_image.mpr ⟨t, Finset.mem_filter.mpr ⟨Finset.mem_range.mpr (by omega), htp⟩, rfl⟩) · exact Or.inr (Finset.mem_image.mpr ⟨t + 1, Finset.mem_filter.mpr ⟨Finset.mem_range.mpr (by omega), by omega⟩, rfl⟩) rcases heq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ · exact hpair · exact hpair.symm by_cases hgood₁ : m₁ % 2 = 0 ∨ i₀ % 2 = 1 · let r₁ := i₀ % 2 have hr₁ : r₁ = 0 ∨ r₁ = 1 := by omega let C := cov₁ r₁ ∪ cov₂ 1 have hC_cov : T.IsVertexCover (C : Set α) := by intro a b hab have heT : s(a, b) ∈ insert s(x, y) (E₁ ∪ E₂) := hE_total.symm ▸ (T.mem_edgeFinset.mpr hab) rw [Finset.mem_insert, Finset.mem_union] at heT rcases heT with hbr | he₁ | he₂ · have hxC : x ∈ cov₁ r₁ := Finset.mem_image.mpr ⟨i₀, Finset.mem_filter.mpr ⟨Finset.mem_range.mpr hi₀, rfl⟩, by rw [hgetD₁ i₀ hi₀, hx_eq]⟩ rw [Sym2.eq_iff] at hbr rcases hbr with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ · exact Or.inl (Finset.mem_coe.mpr (Finset.mem_union_left _ hxC)) · exact Or.inr (Finset.mem_coe.mpr (Finset.mem_union_left _ hxC)) · exact (hcov₁_E₁ r₁ hr₁ a b he₁).imp (fun h => Finset.mem_coe.mpr (Finset.mem_union_left _ h)) (fun h => Finset.mem_coe.mpr (Finset.mem_union_left _ h)) · exact (hcov₂_E₂ 1 (Or.inr rfl) a b he₂).imp (fun h => Finset.mem_coe.mpr (Finset.mem_union_right _ h)) (fun h => Finset.mem_coe.mpr (Finset.mem_union_right _ h)) have hC1_le : (cov₁ r₁).card ≤ m₁ / 2 := by calc (cov₁ r₁).card ≤ ((Finset.range m₁).filter (fun t => t % 2 = r₁)).card := Finset.card_image_le _ = if r₁ = 1 then m₁ / 2 else (m₁ + 1) / 2 := card_filter_mod_two_range m₁ r₁ hr₁ _ ≤ m₁ / 2 := by split_ifs <;> omega have hC2_le : (cov₂ 1).card ≤ m₂ / 2 := by calc (cov₂ 1).card ≤ ((Finset.range m₂).filter (fun t => t % 2 = 1)).card := Finset.card_image_le _ = m₂ / 2 := by simpa using card_filter_mod_two_range m₂ 1 (Or.inr rfl) have htau : T.vertexCoverNum.toNat ≤ (cov₁ r₁ ∪ cov₂ 1).card := vertexCoverNum_toNat_le_card T C hC_cov have hu := Finset.card_union_le (cov₁ r₁) (cov₂ 1) omega · by_cases hgood₂ : m₂ % 2 = 0 ∨ j₀ % 2 = 1 · let r₂ := j₀ % 2 have hr₂ : r₂ = 0 ∨ r₂ = 1 := by omega let C := cov₁ 1 ∪ cov₂ r₂ have hC_cov : T.IsVertexCover (C : Set α) := by intro a b hab have heT : s(a, b) ∈ insert s(x, y) (E₁ ∪ E₂) := hE_total.symm ▸ (T.mem_edgeFinset.mpr hab) rw [Finset.mem_insert, Finset.mem_union] at heT rcases heT with hbr | he₁ | he₂ · have hyC : y ∈ cov₂ r₂ := Finset.mem_image.mpr ⟨j₀, Finset.mem_filter.mpr ⟨Finset.mem_range.mpr hj₀, rfl⟩, by rw [hgetD₂ j₀ hj₀, hy_eq]⟩ rw [Sym2.eq_iff] at hbr rcases hbr with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ · exact Or.inr (Finset.mem_coe.mpr (Finset.mem_union_right _ hyC)) · exact Or.inl (Finset.mem_coe.mpr (Finset.mem_union_right _ hyC)) · exact (hcov₁_E₁ 1 (Or.inr rfl) a b he₁).imp (fun h => Finset.mem_coe.mpr (Finset.mem_union_left _ h)) (fun h => Finset.mem_coe.mpr (Finset.mem_union_left _ h)) · exact (hcov₂_E₂ r₂ hr₂ a b he₂).imp (fun h => Finset.mem_coe.mpr (Finset.mem_union_right _ h)) (fun h => Finset.mem_coe.mpr (Finset.mem_union_right _ h)) have hC1_le : (cov₁ 1).card ≤ m₁ / 2 := by calc (cov₁ 1).card ≤ ((Finset.range m₁).filter (fun t => t % 2 = 1)).card := Finset.card_image_le _ = m₁ / 2 := by simpa using card_filter_mod_two_range m₁ 1 (Or.inr rfl) have hC2_le : (cov₂ r₂).card ≤ m₂ / 2 := by calc (cov₂ r₂).card ≤ ((Finset.range m₂).filter (fun t => t % 2 = r₂)).card := Finset.card_image_le _ = if r₂ = 1 then m₂ / 2 else (m₂ + 1) / 2 := card_filter_mod_two_range m₂ r₂ hr₂ _ ≤ m₂ / 2 := by split_ifs <;> omega have htau : T.vertexCoverNum.toNat ≤ (cov₁ 1 ∪ cov₂ r₂).card := vertexCoverNum_toNat_le_card T C hC_cov have hu := Finset.card_union_le (cov₁ 1) (cov₂ r₂) omega · push Not at hgood₁ hgood₂ let C := insert x (cov₁ 1 ∪ cov₂ 1) have hC_cov : T.IsVertexCover (C : Set α) := by intro a b hab have heT : s(a, b) ∈ insert s(x, y) (E₁ ∪ E₂) := hE_total.symm ▸ (T.mem_edgeFinset.mpr hab) rw [Finset.mem_insert, Finset.mem_union] at heT rcases heT with hbr | he₁ | he₂ · rw [Sym2.eq_iff] at hbr rcases hbr with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ · exact Or.inl (Finset.mem_coe.mpr (Finset.mem_insert_self _ _)) · exact Or.inr (Finset.mem_coe.mpr (Finset.mem_insert_self _ _)) · exact (hcov₁_E₁ 1 (Or.inr rfl) a b he₁).imp (fun h => Finset.mem_coe.mpr (Finset.mem_insert_of_mem (Finset.mem_union_left _ h))) (fun h => Finset.mem_coe.mpr (Finset.mem_insert_of_mem (Finset.mem_union_left _ h))) · exact (hcov₂_E₂ 1 (Or.inr rfl) a b he₂).imp (fun h => Finset.mem_coe.mpr (Finset.mem_insert_of_mem (Finset.mem_union_right _ h))) (fun h => Finset.mem_coe.mpr (Finset.mem_insert_of_mem (Finset.mem_union_right _ h))) have hC1_le : (cov₁ 1).card ≤ m₁ / 2 := by calc (cov₁ 1).card ≤ ((Finset.range m₁).filter (fun t => t % 2 = 1)).card := Finset.card_image_le _ = m₁ / 2 := by simpa using card_filter_mod_two_range m₁ 1 (Or.inr rfl) have hC2_le : (cov₂ 1).card ≤ m₂ / 2 := by calc (cov₂ 1).card ≤ ((Finset.range m₂).filter (fun t => t % 2 = 1)).card := Finset.card_image_le _ = m₂ / 2 := by simpa using card_filter_mod_two_range m₂ 1 (Or.inr rfl) have htau_le : T.vertexCoverNum.toNat ≤ m₁ / 2 + m₂ / 2 + 1 := by have h1 : T.vertexCoverNum.toNat ≤ (insert x (cov₁ 1 ∪ cov₂ 1)).card := vertexCoverNum_toNat_le_card T C hC_cov have h2 := Finset.card_insert_le x (cov₁ 1 ∪ cov₂ 1) have h3 := Finset.card_union_le (cov₁ 1) (cov₂ 1) omega by_contra hlt push Not at hlt have hS₁_eq : S₁.card = m₁ / 2 := by omega have hS₂_eq : S₂.card = m₂ / 2 := by omega have hj₀_not_bi : j₀ ∉ I₂.biUnion (pathNbrs m₂) := by have hcard_er : ((Finset.range m₂).erase j₀).card = m₂ - 1 := by rw [Finset.card_erase_of_mem (Finset.mem_range.mpr hj₀), Finset.card_range] have hbi_le : (I₂.biUnion (pathNbrs m₂)).card ≤ m₂ - 1 := by calc (I₂.biUnion (pathNbrs m₂)).card ≤ ∑ r ∈ I₂, (pathNbrs m₂ r).card := Finset.card_biUnion_le _ ≤ ∑ _r ∈ I₂, 2 := Finset.sum_le_sum fun r _ => card_pathNbrs_le_two _ _ _ = 2 * I₂.card := by simp [mul_comm] _ = m₂ - 1 := by omega have heq_set : I₂.biUnion (pathNbrs m₂) = (Finset.range m₂).erase j₀ := by symm exact Finset.eq_of_subset_of_card_le hcov₂ (by omega) rw [heq_set] exact Finset.notMem_erase _ _ have hi₀_mem : i₀ ∈ I₁ := by obtain ⟨w, hwS, hyw⟩ := hS y have heT : s(y, w) ∈ insert s(x, y) (E₁ ∪ E₂) := hE_total.symm ▸ (T.mem_edgeFinset.mpr hyw) rw [Finset.mem_insert, Finset.mem_union] at heT rcases heT with hbr | he₁ | he₂ · rw [Sym2.eq_iff] at hbr rcases hbr with ⟨h1, _⟩ | ⟨_, h2⟩ · exact (Finset.disjoint_left.mp hdisj12 (h1 ▸ hxs₁) hys₂).elim · have hxS : x ∈ S := h2 ▸ Finset.mem_coe.mp hwS exact Finset.mem_filter.mpr ⟨Finset.mem_range.mpr hi₀, by rw [hgetD₁ i₀ hi₀, hx_eq]; exact Finset.mem_inter.mpr ⟨hxS, hxs₁⟩⟩ · have hy1 : y ∈ s₁ := hs₁_eq ▸ hE₁_ends _ he₁ y (Sym2.mem_mk_left y w) exact (Finset.disjoint_left.mp hdisj12 hy1 hys₂).elim · exfalso apply hj₀_not_bi rcases Finset.mem_image.mp he₂ with ⟨r, hr, heq⟩ rw [Finset.mem_range] at hr rw [Sym2.eq_iff] at heq rcases heq with ⟨h1, h2⟩ | ⟨h1, h2⟩ · rw [hgetD₂ r (by omega), ← hy_eq] at h1 have hrj : r = j₀ := (List.Nodup.getElem_inj_iff hnd₂).mp h1 subst hrj refine Finset.mem_biUnion.mpr ⟨r + 1, ?_, mem_pathNbrs.mpr ⟨hj₀, Or.inl rfl⟩⟩ have hw2 : L₂.getD (r + 1) u₂ ∈ s₂ := hs₂_eq ▸ List.mem_toFinset.mpr (hgetD₂ (r + 1) (by omega) ▸ List.getElem_mem _) exact Finset.mem_filter.mpr ⟨Finset.mem_range.mpr (by omega), Finset.mem_inter.mpr ⟨h2 ▸ Finset.mem_coe.mp hwS, hw2⟩⟩ · rw [hgetD₂ (r + 1) (by omega), ← hy_eq] at h2 have hrj : r + 1 = j₀ := (List.Nodup.getElem_inj_iff hnd₂).mp h2 refine Finset.mem_biUnion.mpr ⟨r, ?_, mem_pathNbrs.mpr ⟨hj₀, Or.inr hrj⟩⟩ have hw2 : L₂.getD r u₂ ∈ s₂ := hs₂_eq ▸ List.mem_toFinset.mpr (hgetD₂ r (by omega) ▸ List.getElem_mem _) exact Finset.mem_filter.mpr ⟨Finset.mem_range.mpr (by omega), Finset.mem_inter.mpr ⟨h1 ▸ Finset.mem_coe.mp hwS, hw2⟩⟩ let a := m₁ / 2 let k := i₀ / 2 have hm₁_eq : m₁ = 2 * a + 1 := by omega have hi₀_eq : i₀ = 2 * k := by omega have hk_lt : 2 * k < 2 * a + 1 := by rw [← hm₁_eq, ← hi₀_eq]; exact hi₀ exact odd_path_parity_obstruction a k hk_lt I₁ (by rw [hI₁_card, hS₁_eq]) (by rw [← hm₁_eq, ← hi₀_eq]; exact hcov₁) (hi₀_eq ▸ hi₀_mem) end TwoPaths section MainTheorems variable {α : Type*} [Fintype α] [DecidableEq α] /-- **Complete Resolution of WOWII Conjecture 372 (regularized / division-free form)**: For every tree `T` of order at least two, `τ(T) ≤ γ_t(T) * max 1 (p(T) - 1)`. -/ theorem conjecture372_regularized_solved (T : SimpleGraph α) (hT : T.IsTree) (hn : 2 ≤ Fintype.card α) : T.vertexCoverNum.toNat ≤ totalDominationNumber T * max 1 (pathCoverNumber T - 1) := by by_cases hp : pathCoverNumber T ≤ 2 · have hmax : max 1 (pathCoverNumber T - 1) = 1 := by omega rw [hmax, mul_one] exact conjecture372_two_paths T hT hn hp · have hmax : 2 ≤ max 1 (pathCoverNumber T - 1) := by omega have huniv := tree_vertexCover_le_three_halves_totalDom T hT hn have hle2 : T.vertexCoverNum.toNat ≤ totalDominationNumber T * 2 := by omega exact le_trans hle2 (Nat.mul_le_mul_left _ hmax) /-- **Complete Resolution of WOWII Conjecture 372 (original real-valued ratio form)**: For every tree `T` with more than two vertices and `p(T) ≥ 2`, `τ(T) / (p(T) - 1) ≤ γ_t(T)`. -/ theorem conjecture372_solved (T : SimpleGraph α) (hT : T.IsTree) (hn : 2 < Fintype.card α) (hp : 2 ≤ pathCoverNumber T) : (T.vertexCoverNum.toNat : ℝ) / ((pathCoverNumber T : ℝ) - 1) ≤ (totalDominationNumber T : ℝ) := by have hpos : (0 : ℝ) < (pathCoverNumber T : ℝ) - 1 := by have : (2 : ℝ) ≤ (pathCoverNumber T : ℝ) := by exact_mod_cast hp linarith rw [div_le_iff₀ hpos] have hreg := conjecture372_regularized_solved T hT (by omega) have hmax : max 1 (pathCoverNumber T - 1) = pathCoverNumber T - 1 := by omega rw [hmax] at hreg have hcast : (T.vertexCoverNum.toNat : ℝ) ≤ ((totalDominationNumber T * (pathCoverNumber T - 1) : ℕ) : ℝ) := by exact_mod_cast hreg have hsub : ((pathCoverNumber T - 1 : ℕ) : ℝ) = (pathCoverNumber T : ℝ) - 1 := by rw [Nat.cast_sub (by omega), Nat.cast_one] simpa [Nat.cast_mul, hsub] using hcast end MainTheorems #print axioms tree_vertexCover_le_three_halves_totalDom #print axioms conjecture372_two_paths #print axioms conjecture372_regularized_solved #print axioms conjecture372_solved end AutoDiscovery.GraphConjecture372