Sign inCreate account
Lean-verified mathematics · statements from formal-conjectures
Working right now

Loading…

[Formalized by test on 24 Nov 2026]

Title:Lemma card_le_of_cut_vertex · Written on the Wall II - Conjecture 189

Source:Written on the Wall II
Proved lemma Checked by Lean. Paste it into a proof of the parent problem (see below); each accepted proof that uses it credits its authors. See the proof by test, 24 Nov 2026.
Statement:reviewed
Reuse this lemma — paste it into your Solution.lean, before the theorem that uses it
/-- Intermediate lemma (nosorry): Cut-vertex size bound: by not_three_components_after_delete, G - c has exactly 2 components C₁, C₂; partitioning each into even/odd distance from c gives |E₁|+|E₂| ≤ σ, |O₁| ≤ σ, |O₂| ≤ σ, so n = 1 + |C₁| + |C₂| ≤ 3σ + 1. -/
theorem card_le_of_cut_vertex (G : SimpleGraph α) [DecidableRel G.Adj]
    (h : G.Connected)
    (hσ : (Finset.univ.image (distEven G)).max' (Finset.univ_nonempty.image _) ≤ 1 + secondSmallestDegree G)
    (hδ : ∀ w : α, 2 ≤ G.degree w)
    (c : α) (hcut : ¬ (G.induce {v : α | v ≠ c}).Connected) :
    Fintype.card α ≤ 3 * secondSmallestDegree G + 1 := by
  classical
  let H := G.induce {v : α | v ≠ c}
  have hHne : Nonempty {v : α | v ≠ c} := by
    obtain ⟨v, hv⟩ := exists_ne c
    exact ⟨⟨v, hv⟩⟩
  have h2comp : ∃ C₁ C₂ : H.ConnectedComponent, C₁ ≠ C₂ := by
    by_contra hall
    push Not at hall
    apply hcut
    refine ⟨fun x y => ?_⟩
    exact SimpleGraph.ConnectedComponent.eq.mp (hall (H.connectedComponentMk x) (H.connectedComponentMk y))
  obtain ⟨C₁, C₂, h12⟩ := h2comp
  let comp : H.ConnectedComponent → Finset α := fun C =>
    Finset.univ.filter fun w => ∃ hw : w ≠ c, H.connectedComponentMk ⟨w, hw⟩ = C
  have hcomp_not_c : ∀ C, c ∉ comp C := by
    intro C hc
    simp only [comp, Finset.mem_filter, Finset.mem_univ, true_and] at hc
    exact hc.1 rfl
  have hcomp_disj : ∀ {A B : H.ConnectedComponent}, A ≠ B → Disjoint (comp A) (comp B) := by
    intro A B hAB
    rw [Finset.disjoint_left]
    intro w hwA hwB
    simp only [comp, Finset.mem_filter, Finset.mem_univ, true_and] at hwA hwB
    exact hAB (hwA.2.symm.trans hwB.2)
  have huniv : (Finset.univ : Finset α) = insert c (comp C₁ ∪ comp C₂) := by
    ext w
    simp only [Finset.mem_univ, Finset.mem_insert, Finset.mem_union, comp, Finset.mem_filter,
      true_and, true_iff]
    by_cases hwc : w = c
    · exact Or.inl hwc
    · right
      rcases not_three_components_after_delete G h hσ hδ c C₁ C₂ (H.connectedComponentMk ⟨w, hwc⟩) with
        hEq | hEq | hEq
      · exact absurd hEq h12
      · exact Or.inl ⟨hwc, hEq.symm⟩
      · exact Or.inr ⟨hwc, hEq.symm⟩
  have hdist_even_le : ∀ v : α, (Finset.univ.filter fun w => Even (G.dist v w)).card ≤
      1 + secondSmallestDegree G := by
    intro v
    have hmem : distEven G v ∈ Finset.univ.image (distEven G) :=
      Finset.mem_image_of_mem _ (Finset.mem_univ v)
    simpa [distEven] using (Finset.le_max' _ _ hmem).trans hσ
  let Ec : H.ConnectedComponent → Finset α := fun C =>
    (comp C).filter fun w => Even (G.dist c w)
  let Oc : H.ConnectedComponent → Finset α := fun C =>
    (comp C).filter fun w => Odd (G.dist c w)
  have hpart : ∀ C, (Ec C).card + (Oc C).card = (comp C).card := by
    intro C
    have hOc : Oc C = (comp C).filter fun w => ¬ Even (G.dist c w) := by
      ext w; simp [Oc, Nat.not_even_iff_odd]
    rw [hOc, ← Finset.card_union_of_disjoint (Finset.disjoint_filter.mpr fun _ _ h1 h2 => h2 h1),
      Finset.filter_union_filter_not_eq]
  have hE_sum : (Ec C₁).card + (Ec C₂).card ≤ secondSmallestDegree G := by
    have hsub : insert c (Ec C₁ ∪ Ec C₂) ⊆ Finset.univ.filter fun w => Even (G.dist c w) := by
      intro w hw
      simp only [Finset.mem_insert, Finset.mem_union, Ec, Finset.mem_filter, Finset.mem_univ,
        true_and] at hw ⊢
      rcases hw with rfl | h1 | h2
      · rw [SimpleGraph.dist_self]; exact ⟨0, rfl⟩
      · exact h1.2
      · exact h2.2
    have hc_not : c ∉ Ec C₁ ∪ Ec C₂ := by
      simp only [Finset.mem_union, Ec, Finset.mem_filter]
      rintro (⟨h1, _⟩ | ⟨h2, _⟩)
      · exact hcomp_not_c C₁ h1
      · exact hcomp_not_c C₂ h2
    have hd12 : Disjoint (Ec C₁) (Ec C₂) :=
      (hcomp_disj h12).mono (Finset.filter_subset _ _) (Finset.filter_subset _ _)
    have hcard := (Finset.card_le_card hsub).trans (hdist_even_le c)
    rw [Finset.card_insert_of_notMem hc_not, Finset.card_union_of_disjoint hd12] at hcard
    omega
  have hO_bound : ∀ A B : H.ConnectedComponent, A ≠ B → (Oc B).card ≤ secondSmallestDegree G := by
    intro A B hAB
    obtain ⟨⟨v, hv⟩, hAv⟩ := Quot.exists_rep A
    obtain ⟨p⟩ := h c v
    obtain ⟨u, hu, hcu, hru⟩ := exists_adj_reachable_induce p.length p le_rfl hv
    have huA : u ∈ comp A := by
      simp only [comp, Finset.mem_filter, Finset.mem_univ, true_and]
      refine ⟨hu, ?_⟩
      rw [← hAv]
      exact SimpleGraph.ConnectedComponent.eq.mpr hru
    have hdist_other : ∀ w ∈ comp B, G.dist u w = 1 + G.dist c w := by
      intro w hwB
      simp only [comp, Finset.mem_filter, Finset.mem_univ, true_and] at hwB
      obtain ⟨hwc, hBw⟩ := hwB
      apply le_antisymm
      · obtain ⟨q, hq⟩ := (h c w).exists_walk_length_eq_dist
        have hle := G.dist_le (SimpleGraph.Walk.cons hcu.symm q)
        simp only [SimpleGraph.Walk.length_cons, hq] at hle
        omega
      · obtain ⟨q, hq⟩ := (h u w).exists_walk_length_eq_dist
        have hc_in : c ∈ q.support := by
          by_contra hnot
          have hreach := walk_lift_induce q hu hwc hnot
          have hEq : H.connectedComponentMk ⟨u, hu⟩ = H.connectedComponentMk ⟨w, hwc⟩ :=
            SimpleGraph.ConnectedComponent.eq.mpr hreach
          have huA' : H.connectedComponentMk ⟨u, hu⟩ = A := by
            simp only [comp, Finset.mem_filter, Finset.mem_univ, true_and] at huA
            exact huA.2
          exact hAB (huA'.symm.trans (hEq.trans hBw))
        let q1 := q.takeUntil c hc_in
        let q2 := q.dropUntil c hc_in
        have hsum : q1.length + q2.length = q.length :=
          (SimpleGraph.Walk.length_append q1 q2).symm.trans
            (congrArg SimpleGraph.Walk.length (SimpleGraph.Walk.take_spec q hc_in))
        have hq1_pos : 1 ≤ q1.length := by
          cases hq1 : q1 with
          | nil => exact absurd rfl hu
          | cons _ _ => simp
        have hq2_ge : G.dist c w ≤ q2.length := G.dist_le q2
        omega
    have hsub : insert u (Oc B) ⊆ Finset.univ.filter fun w => Even (G.dist u w) := by
      intro w hw
      simp only [Finset.mem_insert, Oc, Finset.mem_filter, Finset.mem_univ, true_and] at hw ⊢
      rcases hw with rfl | hB
      · rw [SimpleGraph.dist_self]; exact ⟨0, rfl⟩
      · rw [hdist_other w hB.1]
        obtain ⟨k, hk⟩ := hB.2
        exact ⟨k + 1, by omega⟩
    have hu_not : u ∉ Oc B := by
      simp only [Oc, Finset.mem_filter]
      rintro ⟨hB, _⟩
      exact Finset.disjoint_left.mp (hcomp_disj hAB) huA hB
    have hcard := (Finset.card_le_card hsub).trans (hdist_even_le u)
    rw [Finset.card_insert_of_notMem hu_not] at hcard
    omega
  have hO1 := hO_bound C₂ C₁ h12.symm
  have hO2 := hO_bound C₁ C₂ h12
  have hp1 := hpart C₁
  have hp2 := hpart C₂
  have hcard_univ : Fintype.card α = 1 + (comp C₁).card + (comp C₂).card := by
    rw [← Finset.card_univ, huniv]
    have hc_not : c ∉ comp C₁ ∪ comp C₂ := by
      rw [Finset.mem_union]; rintro (h1 | h2)
      · exact hcomp_not_c C₁ h1
      · exact hcomp_not_c C₂ h2
    rw [Finset.card_insert_of_notMem hc_not, Finset.card_union_of_disjoint (hcomp_disj h12)]
    omega
  omega

From the first verified proof, s-qpqnw39f1j (lemma proofs are public). If it relies on helper lemmas, copy them too.

Problem: Cut-vertex size bound: by not_three_components_after_delete, G - c has exactly 2 components C₁, C₂; partitioning each into even/odd distance from c gives |E₁|+|E₂| ≤ σ, |O₁| ≤ σ, |O₂| ≤ σ, so n = 1 + |C₁| + |C₂| ≤ 3σ + 1. … Full statement & Lean theorem →

Show: all ○ connecting…
  1. verifiedVerified proof by test2 d