AFTD Auto-Formalizing Theoretical Domains

boundary_saturated_block_cross_edge_residual_reachable

theoremverified

Under the displayed four-block, saturation, degree, and 2k-separator hypotheses, if A has at least three vertices and the opposite block C has at most k vertices, every 2k-vertex residual containing a cross edge from A to C has an alternate path between its endpoints.

Statement

theorem boundary_saturated_block_cross_edge_residual_reachable
    (k : ℕ) (hk : 4 ≤ k) (G : SimpleGraph (Fin (4*k))) [DecidableRel G.Adj]
    (A B C D : Finset (Fin (4*k)))
    (hAB : Disjoint A B) (hAC : Disjoint A C) (hAD : Disjoint A D)
    (hBC : Disjoint B C) (hBD : Disjoint B D) (hCD : Disjoint C D)
    (hcover : A ∪ B ∪ C ∪ D = Finset.univ)
    (hsizeAB : A.card+B.card=2*k) (hsizeCD : C.card+D.card=2*k)
    (hA : 3 ≤ A.card) (hC : C.card ≤ k)
    (hnoAB : ∀ a ∈ A, ∀ b ∈ B, ¬ G.Adj a b)
    (hnoCD : ∀ c ∈ C, ∀ d ∈ D, ¬ G.Adj c d)
    (hAsat : ∀ a ∈ A, ∀ w ∈ A ∪ C ∪ D, a ≠ w → G.Adj a w)
    (hdegree : ∀ v, 2*k+2 ≤ (G.neighborFinset v).card)
    (hsep : ∀ X U V : Finset (Fin (4*k)), U.Nonempty → V.Nonempty →
      Disjoint X U → Disjoint X V → Disjoint U V → X ∪ U ∪ V = Finset.univ →
      (∀ u ∈ U, ∀ v ∈ V, ¬ G.Adj u v) → 2*k ≤ X.card)
    (R : Finset (Fin (4*k))) (hR : R.card = 2*k)
    (x y : Fin (4*k)) (hx : x ∈ A) (hy : y ∈ C) (hxy : G.Adj x y)
    (hxR : x ∈ R) (hyR : y ∈ R) :
    ((G.induce {a | a ∈ R}).deleteEdges {s(⟨x,hxR⟩,⟨y,hyR⟩)}).Reachable ⟨x,hxR⟩ ⟨y,hyR⟩
Source
OP-1957; bridge exclusion for the one-three-vertex-block boundary route, session IN-1122.
Verified
23 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
Used by 1

The proof, explained

The proof proceeds by contradiction, assuming that removing the cross edge $\{x, y\}$ disconnects $x$ from $y$ within the residual subgraph $G[R]$. Letting $S \subseteq R$ be the component of $x$ in $G[R] \setminus \{xy\}$, the saturation of $A$ forces $A \cap R = \{x\}$ and shows that all remaining vertices of $R \setminus S$ belong to $B$. The minimum degree hypothesis implies that $y$ has another neighbor $w \in R \setminus \{x\}$, which necessarily lies in $(R \setminus S) \setminus \{y\}$. This allows constructing a valid separator $X = \{y\} \cup ((V \setminus R) \setminus A)$ that disconnects $S \cup (A \setminus R)$ from $(R \setminus S) \setminus \{y\}$, but counting vertices using $|A| \ge 3$ reveals $|X| \le 2k - 1$, contradicting the separator bound $|X| \ge 2k$.

  1. Assume for contradiction that $x$ cannot reach $y$ in the residual subgraph $H = G[R] \setminus \{xy\}$.

    We invoke classical logic and assume the negation of the goal, namely that there is no path between $x$ and $y$ in $H$, the graph induced on $R$ with the edge $\{x, y\}$ deleted.

    lines 20–22

      classical
      set H := (G.induce {a | a ∈ R}).deleteEdges {s(⟨x,hxR⟩,⟨y,hyR⟩)} with hH
      by_contra hnot
  2. The set $S \subseteq R$ of vertices reachable from $x$ in $H$ contains $x$, does not contain $y$, and satisfies $x \ne y$.

    We define $S$ as the set of vertices in $R$ reachable from $x$ in $H$. By reflexivity of reachability, $x \in S$. By definition, every vertex of $S$ belongs to $R$. By our contradiction hypothesis, $y \notin S$. Since $x$ and $y$ are adjacent in $G$, they are distinct vertices.

    lines 23–38

    uses SimpleGraph.Reachable.refl, Finset.mem_filter

      -- S: vertices of R reachable from x in the residual
      set S : Finset (Fin (4*k)) :=
        Finset.univ.filter (fun v => ∃ h : v ∈ R, H.Reachable ⟨x,hxR⟩ ⟨v,h⟩) with hS
      have hxS : x ∈ S := by
        simp only [hS, Finset.mem_filter, Finset.mem_univ, true_and]
        exact ⟨hxR, SimpleGraph.Reachable.refl _⟩
      have hSR : ∀ v ∈ S, v ∈ R := by
        intro v hv
        simp only [hS, Finset.mem_filter, Finset.mem_univ, true_and] at hv
        exact hv.1
      have hyS : y ∉ S := by
        intro h
        simp only [hS, Finset.mem_filter, Finset.mem_univ, true_and] at h
        obtain ⟨_, hr⟩ := h
        exact hnot hr
      have hxy_ne : x ≠ y := hxy.ne
  3. Any edge in $G[R]$ incident to a vertex in $S$ other than $\{x, y\}$ has its other endpoint in $S$.

    Given $u \in S$ and $w \in R$ adjacent in $G$ with $\{u, w\} \ne \{x, y\}$, the edge belongs to $H$. Concatenating the path from $x$ to $u$ in $H$ with this edge yields a path in $H$ from $x$ to $w$, so $w \in S$.

    lines 39–50

    uses SimpleGraph.Adj.reachable, SimpleGraph.deleteEdges_adj, Set.mem_singleton_iff, Sym2.eq, Sym2.rel_iff'

      -- key propagation lemma
      have hstep : ∀ u ∈ S, ∀ w ∈ R, G.Adj u w → ¬ (u = x ∧ w = y) → ¬ (u = y ∧ w = x) → w ∈ S := by
        intro u hu w hw hadj h1 h2
        have huR := hSR u hu
        simp only [hS, Finset.mem_filter, Finset.mem_univ, true_and] at hu ⊢
        obtain ⟨huR', hr⟩ := hu
        refine ⟨hw, hr.trans (SimpleGraph.Adj.reachable ?_)⟩
        rw [SimpleGraph.deleteEdges_adj]
        refine ⟨by simpa using hadj, ?_⟩
        simp only [Set.mem_singleton_iff, Sym2.eq, Sym2.rel_iff', Prod.mk.injEq, Prod.swap_prod_mk,
          Subtype.mk.injEq]
        tauto
  4. The vertex $x$ is the only vertex of $A$ in $R$, so $A \cap R = \{x\}$.

    Suppose there exists another vertex $a \in A \cap R$ with $a \ne x$. Since $A$ and $C$ are disjoint, $a \ne y$. By the saturation of $A$, $x$ is adjacent to $a$, and this edge is not $\{x, y\}$ because $a \ne y$, so $a \in S$. Applying the saturation of $A$ again, $a$ is adjacent to $y \in C$, and this edge is not $\{x, y\}$ because $a \ne x$, which forces $y \in S$, contradicting $y \notin S$.

    lines 51–59

    uses Finset.disjoint_left.mp, Ne.symm

      -- A ∩ R = {x}
      have hAR : ∀ a ∈ A, a ∈ R → a = x := by
        intro a ha haR
        by_contra hax
        have hay : a ≠ y := fun h => Finset.disjoint_left.mp hAC ha (h ▸ hy)
        have haS : a ∈ S := hstep x hxS a haR (hAsat x hx a (by simp [ha]) (Ne.symm hax))
          (fun h => hay h.2) (fun h => hxy_ne h.1)
        exact hyS (hstep a haS y hyR (hAsat a ha y (by simp [hy]) hay) (fun h => hax h.1)
          (fun h => hay h.1))
  5. Every vertex in $R \setminus S$ other than $y$ belongs to block $B$.

    Let $w \in R$ with $w \notin S$ and $w \ne y$. Since $x \in S$, $w \ne x$. The four blocks cover the entire vertex set: $w$ cannot belong to $A$ since $A \cap R = \{x\}$ and $w \ne x$; and $w$ cannot belong to $C$ or $D$ because $x \in A$ is adjacent to all other vertices in $A \cup C \cup D$, which would make $w \in S$ via the propagation lemma. Hence $w \in B$.

    lines 60–72

    uses Finset.mem_univ, Finset.mem_union, Ne.symm

      -- vertices of R outside S, other than y, lie in B
      have hWB : ∀ w ∈ R, w ∉ S → w ≠ y → w ∈ B := by
        intro w hwR hwS hwy
        have hwx : w ≠ x := fun h => hwS (h ▸ hxS)
        have hw : w ∈ A ∪ B ∪ C ∪ D := by rw [hcover]; exact Finset.mem_univ _
        simp only [Finset.mem_union] at hw
        rcases hw with ((hwA | hwB) | hwC) | hwD
        · exact absurd (hAR w hwA hwR) hwx
        · exact hwB
        · exact absurd (hstep x hxS w hwR (hAsat x hx w (by simp [hwC]) (Ne.symm hwx))
            (fun h => hwy h.2) (fun h => hxy_ne h.1)) hwS
        · exact absurd (hstep x hxS w hwR (hAsat x hx w (by simp [hwD]) (Ne.symm hwx))
            (fun h => hwy h.2) (fun h => hxy_ne h.1)) hwS
  6. The vertex $y$ has a neighbor $w \in R$ distinct from $x$, and this neighbor satisfies $w \ne y$ and $w \notin S$.

    If $y$ had no neighbor in $R \setminus \{x\}$, all its neighbors would lie in $\{x\} \cup (V(G) \setminus R)$. Since $|R| = 2k$ and the total number of vertices is $4k$, the complement has size $2k$, meaning $y$ would have degree at most $2k + 1$, contradicting the minimum degree hypothesis $2k + 2$. Thus $y$ has a neighbor $w \in R \setminus \{x\}$. Because graphs are loopless, $w \ne y$. If $w$ were in $S$, then since $w$ is adjacent to $y$ and $w \ne x$, the propagation lemma would place $y \in S$, a contradiction. Hence $w \notin S$.

    lines 73–93

    uses Finset.card_le_card, Finset.card_insert_le, Finset.card_sdiff_of_subset, Finset.subset_univ, Finset.card_univ, Fintype.card_fin

      -- y has a neighbour w ∈ R with w ≠ x
      obtain ⟨w, hwN, hwR, hwx⟩ : ∃ w ∈ G.neighborFinset y, w ∈ R ∧ w ≠ x := by
        by_contra hno
        push Not at hno
        have hsub : G.neighborFinset y ⊆ insert x (Finset.univ \ R) := by
          intro w hw
          by_cases hwR : w ∈ R
          · exact Finset.mem_insert.mpr (Or.inl (hno w hw hwR))
          · exact Finset.mem_insert_of_mem (by simp [hwR])
        have h1 := Finset.card_le_card hsub
        have h2 := Finset.card_insert_le x (Finset.univ \ R)
        have h3 : (Finset.univ \ R).card = 2*k := by
          rw [Finset.card_sdiff_of_subset (Finset.subset_univ R), Finset.card_univ, Fintype.card_fin, hR]
          omega
        have := hdegree y
        omega
      have hyw : G.Adj y w := by simpa using hwN
      have hwy : w ≠ y := fun h => G.irrefl (h ▸ hyw)
      have hwS : w ∉ S := by
        intro h
        exact hyS (hstep w h y hyR hyw.symm (fun h' => hwx h'.1) (fun h' => hwy h'.1))
  7. Defining $X = \{y\} \cup ((V(G) \setminus R) \setminus A)$, $U = S \cup (A \setminus R)$, and $V = (R \setminus S) \setminus \{y\}$, both $U$ and $V$ are nonempty.

    We define $X, U$, and $V$. The set $U$ is nonempty because $x \in S \subseteq U$. The set $V$ is nonempty because the neighbor $w$ found in the previous step belongs to $R$, is not in $S$, and is not equal to $y$.

    lines 94–100

      -- the separator
      set X : Finset (Fin (4*k)) := insert y ((Finset.univ \ R) \ A) with hX
      set U : Finset (Fin (4*k)) := S ∪ (A \ R) with hU
      set V : Finset (Fin (4*k)) := (R \ S).erase y with hV
      have hUne : U.Nonempty := ⟨x, by simp [hU, hxS]⟩
      have hwV : w ∈ V := by simp [hV, hwR, hwS, hwy]
      have hVne : V.Nonempty := ⟨w, hwV⟩
  8. The sets $X, U$, and $V$ are pairwise disjoint and together cover all vertices of $G$.

    Disjointness holds because $y \notin S$ and $y \notin A$, while $(V(G) \setminus R) \setminus A$ is disjoint from both $R$ and $A$; $y$ was erased from $V$, and $V \subseteq R$ while $X \setminus \{y\}$ is disjoint from $R$; and $S$ is disjoint from $R \setminus S$. Covering holds because every vertex in $R$ falls into $S \subseteq U$, $\{y\} \subseteq X$, or $(R \setminus S) \setminus \{y\} = V$, and every vertex outside $R$ falls into $A \setminus R \subseteq U$ or $(V(G) \setminus R) \setminus A \subseteq X$.

    lines 101–140

    uses Finset.disjoint_left, Finset.disjoint_left.mp

      have hXU : Disjoint X U := by
        rw [Finset.disjoint_left]
        intro v hvX hvU
        simp only [hX, hU, Finset.mem_insert, Finset.mem_sdiff, Finset.mem_univ, true_and,
          Finset.mem_union] at hvX hvU
        rcases hvX with rfl | ⟨hvR, hvA⟩
        · rcases hvU with h | ⟨h, _⟩
          · exact hyS h
          · exact Finset.disjoint_left.mp hAC h hy
        · rcases hvU with h | ⟨h, _⟩
          · exact hvR (hSR v h)
          · exact hvA h
      have hXV : Disjoint X V := by
        rw [Finset.disjoint_left]
        intro v hvX hvV
        simp only [hX, hV, Finset.mem_insert, Finset.mem_sdiff, Finset.mem_univ, true_and,
          Finset.mem_erase] at hvX hvV
        rcases hvX with rfl | ⟨hvR, _⟩
        · exact hvV.1 rfl
        · exact hvR hvV.2.1
      have hUV : Disjoint U V := by
        rw [Finset.disjoint_left]
        intro v hvU hvV
        simp only [hU, hV, Finset.mem_union, Finset.mem_sdiff, Finset.mem_erase] at hvU hvV
        rcases hvU with h | ⟨_, h⟩
        · exact hvV.2.2 h
        · exact h hvV.2.1
      have hcov : X ∪ U ∪ V = Finset.univ := by
        ext v
        simp only [hX, hU, hV, Finset.mem_union, Finset.mem_insert, Finset.mem_sdiff,
          Finset.mem_univ, true_and, Finset.mem_erase, iff_true]
        by_cases hvR : v ∈ R
        · by_cases hvS : v ∈ S
          · tauto
          · by_cases hvy : v = y
            · tauto
            · tauto
        · by_cases hvA : v ∈ A
          · tauto
          · tauto
  9. There are no edges between $U$ and $V$, so $X$ separates $U$ and $V$, implying $|X| \ge 2k$.

    Take $u \in U$ and $v \in V$. By definition of $V$, $v \in R \setminus S$ and $v \ne y$, so $v \in B$. If $u \in A \setminus R$, there is no edge because no edges connect $A$ and $B$. If $u \in S$, an edge would imply $v \in S$ by the propagation lemma, a contradiction. Thus no edges connect $U$ and $V$. By the separator hypothesis, $|X| \ge 2k$.

    lines 141–149

      have hnoUV : ∀ u ∈ U, ∀ v ∈ V, ¬ G.Adj u v := by
        intro u hu v hv hadj
        simp only [hU, hV, Finset.mem_union, Finset.mem_sdiff, Finset.mem_erase] at hu hv
        obtain ⟨hvy, hvR, hvS⟩ := hv
        rcases hu with huS | ⟨huA, _⟩
        · have hvx : v ≠ x := fun h => hvS (h ▸ hxS)
          exact hvS (hstep u huS v hvR hadj (fun h => hvy h.2) (fun h => hvx h.2))
        · exact hnoAB u huA v (hWB v hvR hvS hvy) hadj
      have hbound := hsep X U V hUne hVne hXU hXV hUV hcov hnoUV
  10. The size of $X$ is at most $2k - 1$, which contradicts $|X| \ge 2k$ and completes the proof.

    Since $A \cap R = \{x\}$, we have $A \subseteq \{x\} \cup (A \setminus R)$, so $|A \setminus R| \ge |A| - 1 \ge 2$ because $|A| \ge 3$. The set $V(G) \setminus R$ has size $2k$ and is the disjoint union of $(V(G) \setminus R) \setminus A$ and $A \setminus R$, so $|(V(G) \setminus R) \setminus A| = 2k - |A \setminus R| \le 2k - 2$. Therefore $|X| \le 1 + (2k - 2) = 2k - 1$. Linear arithmetic detects the contradiction with $|X| \ge 2k$.

    lines 150–171

    uses Finset.card_le_card, Finset.card_insert_le, Finset.card_union_of_disjoint, Finset.card_sdiff_of_subset, Finset.subset_univ, Finset.card_univ, Fintype.card_fin, Finset.disjoint_left

      -- counting: |X| ≤ 1 + (2k - (|A| - 1)) < 2k
      have hAsub : A ⊆ insert x (A \ R) := by
        intro a ha
        by_cases haR : a ∈ R
        · exact Finset.mem_insert.mpr (Or.inl (hAR a ha haR))
        · exact Finset.mem_insert_of_mem (by simp [ha, haR])
      have c1 := Finset.card_le_card hAsub
      have c2 := Finset.card_insert_le x (A \ R)
      have c3 : X.card ≤ ((Finset.univ \ R) \ A).card + 1 := by
        rw [hX]; exact Finset.card_insert_le _ _
      have hsplit : (Finset.univ \ R) = ((Finset.univ \ R) \ A) ∪ (A \ R) := by
        ext v; simp only [Finset.mem_sdiff, Finset.mem_univ, true_and, Finset.mem_union]; tauto
      have hdisj : Disjoint ((Finset.univ \ R) \ A) (A \ R) := by
        rw [Finset.disjoint_left]; intro v h1 h2
        simp only [Finset.mem_sdiff] at h1 h2; exact h1.2 h2.1
      have c4 : (Finset.univ \ R).card = ((Finset.univ \ R) \ A).card + (A \ R).card := by
        rw [← Finset.card_union_of_disjoint hdisj, ← hsplit]
      have c5 : (Finset.univ \ R).card = 2*k := by
        rw [Finset.card_sdiff_of_subset (Finset.subset_univ R), Finset.card_univ, Fintype.card_fin, hR]
        omega
      clear_value S X U V
      omega
Finset.mem_univ
Every element of a finite type belongs to the universal finset `Finset.univ`.
Finset.mem_filter
An element belongs to `Finset.filter p s` if and only if it belongs to `s` and satisfies the predicate `p`.
Finset.mem_union
An element belongs to the union `s ∪ t` of two finsets if and only if it belongs to `s` or to `t`.
Finset.disjoint_left
Two finsets `s` and `t` are disjoint if and only if no element of `s` belongs to `t`.
Finset.disjoint_left.mp
If two finsets are disjoint, any element of the first finset is not contained in the second.
Finset.card_le_card
If a finset `s` is a subset of a finset `t`, then the cardinality of `s` is at most the cardinality of `t`.
Finset.card_insert_le
Inserting an element into a finset increases its cardinality by at most 1.
Finset.card_sdiff_of_subset
If `s ⊆ t`, the cardinality of the difference `t \ s` equals the cardinality of `t` minus the cardinality of `s`.
Finset.subset_univ
Every finset of elements of a finite type is a subset of the universal finset `Finset.univ`.
Finset.card_univ
The cardinality of the universal finset `Finset.univ` equals the cardinality of the underlying finite type.
Fintype.card_fin
The cardinality of the finite type `Fin n` is `n`.
Finset.card_union_of_disjoint
The cardinality of the union of two disjoint finsets is the sum of their cardinalities.
SimpleGraph.Reachable.refl
In any simple graph, every vertex is reachable from itself.
SimpleGraph.Adj.reachable
If two vertices are adjacent in a graph, then the second vertex is reachable from the first.
SimpleGraph.deleteEdges_adj
Two vertices are adjacent in an edge-deleted graph if and only if they were adjacent originally and the edge between them was not deleted.
Set.mem_singleton_iff
An element belongs to a singleton set `{b}` if and only if it equals `b`.
Sym2.eq
Two unordered pairs `s(a, b)` and `s(c, d)` are equal if and only if `(a, b)` and `(c, d)` are related by the symmetric relation on pairs.
Sym2.rel_iff'
Two pairs `p` and `q` represent the same unordered pair if and only if `p = q` or `p = q.swap`.
Ne.symm
Inequality is symmetric: if `a ≠ b`, then `b ≠ a`.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

theorem boundary_saturated_block_cross_edge_residual_reachable    (k : ℕ) (hk : 4 ≤ k) (G : SimpleGraph (Fin (4*k))) [DecidableRel G.Adj]    (A B C D : Finset (Fin (4*k)))    (hAB : Disjoint A B) (hAC : Disjoint A C) (hAD : Disjoint A D)    (hBC : Disjoint B C) (hBD : Disjoint B D) (hCD : Disjoint C D)    (hcover : A ∪ B ∪ C ∪ D = Finset.univ)    (hsizeAB : A.card+B.card=2*k) (hsizeCD : C.card+D.card=2*k)    (hA : 3 ≤ A.card) (hC : C.card ≤ k)    (hnoAB : ∀ a ∈ A, ∀ b ∈ B, ¬ G.Adj a b)    (hnoCD : ∀ c ∈ C, ∀ d ∈ D, ¬ G.Adj c d)    (hAsat : ∀ a ∈ A, ∀ w ∈ A ∪ C ∪ D, a ≠ w → G.Adj a w)    (hdegree : ∀ v, 2*k+2 ≤ (G.neighborFinset v).card)    (hsep : ∀ X U V : Finset (Fin (4*k)), U.Nonempty → V.Nonempty →      Disjoint X U → Disjoint X V → Disjoint U V → X ∪ U ∪ V = Finset.univ →      (∀ u ∈ U, ∀ v ∈ V, ¬ G.Adj u v) → 2*k ≤ X.card)    (R : Finset (Fin (4*k))) (hR : R.card = 2*k)    (x y : Fin (4*k)) (hx : x ∈ A) (hy : y ∈ C) (hxy : G.Adj x y)    (hxR : x ∈ R) (hyR : y ∈ R) :    ((G.induce {a | a ∈ R}).deleteEdges {s(⟨x,hxR⟩,⟨y,hyR⟩)}).Reachable ⟨x,hxR⟩ ⟨y,hyR⟩ := by  classical  set H := (G.induce {a | a ∈ R}).deleteEdges {s(⟨x,hxR⟩,⟨y,hyR⟩)} with hH  by_contra hnot  -- S: vertices of R reachable from x in the residual  set S : Finset (Fin (4*k)) :=    Finset.univ.filter (fun v => ∃ h : v ∈ R, H.Reachable ⟨x,hxR⟩ ⟨v,h⟩) with hS  have hxS : x ∈ S := by    simp only [hS, Finset.mem_filter, Finset.mem_univ, true_and]    exact ⟨hxR, SimpleGraph.Reachable.refl _⟩  have hSR : ∀ v ∈ S, v ∈ R := by    intro v hv    simp only [hS, Finset.mem_filter, Finset.mem_univ, true_and] at hv    exact hv.1  have hyS : y ∉ S := by    intro h    simp only [hS, Finset.mem_filter, Finset.mem_univ, true_and] at h    obtain ⟨_, hr⟩ := h    exact hnot hr  have hxy_ne : x ≠ y := hxy.ne  -- key propagation lemma  have hstep : ∀ u ∈ S, ∀ w ∈ R, G.Adj u w → ¬ (u = x ∧ w = y) → ¬ (u = y ∧ w = x) → w ∈ S := by    intro u hu w hw hadj h1 h2    have huR := hSR u hu    simp only [hS, Finset.mem_filter, Finset.mem_univ, true_and] at hu ⊢    obtain ⟨huR', hr⟩ := hu    refine ⟨hw, hr.trans (SimpleGraph.Adj.reachable ?_)⟩    rw [SimpleGraph.deleteEdges_adj]    refine ⟨by simpa using hadj, ?_⟩    simp only [Set.mem_singleton_iff, Sym2.eq, Sym2.rel_iff', Prod.mk.injEq, Prod.swap_prod_mk,      Subtype.mk.injEq]    tauto  -- A ∩ R = {x}  have hAR : ∀ a ∈ A, a ∈ R → a = x := by    intro a ha haR    by_contra hax    have hay : a ≠ y := fun h => Finset.disjoint_left.mp hAC ha (h ▸ hy)    have haS : a ∈ S := hstep x hxS a haR (hAsat x hx a (by simp [ha]) (Ne.symm hax))      (fun h => hay h.2) (fun h => hxy_ne h.1)    exact hyS (hstep a haS y hyR (hAsat a ha y (by simp [hy]) hay) (fun h => hax h.1)      (fun h => hay h.1))  -- vertices of R outside S, other than y, lie in B  have hWB : ∀ w ∈ R, w ∉ S → w ≠ y → w ∈ B := by    intro w hwR hwS hwy    have hwx : w ≠ x := fun h => hwS (h ▸ hxS)    have hw : w ∈ A ∪ B ∪ C ∪ D := by rw [hcover]; exact Finset.mem_univ _    simp only [Finset.mem_union] at hw    rcases hw with ((hwA | hwB) | hwC) | hwD    · exact absurd (hAR w hwA hwR) hwx    · exact hwB    · exact absurd (hstep x hxS w hwR (hAsat x hx w (by simp [hwC]) (Ne.symm hwx))        (fun h => hwy h.2) (fun h => hxy_ne h.1)) hwS    · exact absurd (hstep x hxS w hwR (hAsat x hx w (by simp [hwD]) (Ne.symm hwx))        (fun h => hwy h.2) (fun h => hxy_ne h.1)) hwS  -- y has a neighbour w ∈ R with w ≠ x  obtain ⟨w, hwN, hwR, hwx⟩ : ∃ w ∈ G.neighborFinset y, w ∈ R ∧ w ≠ x := by    by_contra hno    push Not at hno    have hsub : G.neighborFinset y ⊆ insert x (Finset.univ \ R) := by      intro w hw      by_cases hwR : w ∈ R      · exact Finset.mem_insert.mpr (Or.inl (hno w hw hwR))      · exact Finset.mem_insert_of_mem (by simp [hwR])    have h1 := Finset.card_le_card hsub    have h2 := Finset.card_insert_le x (Finset.univ \ R)    have h3 : (Finset.univ \ R).card = 2*k := by      rw [Finset.card_sdiff_of_subset (Finset.subset_univ R), Finset.card_univ, Fintype.card_fin, hR]      omega    have := hdegree y    omega  have hyw : G.Adj y w := by simpa using hwN  have hwy : w ≠ y := fun h => G.irrefl (h ▸ hyw)  have hwS : w ∉ S := by    intro h    exact hyS (hstep w h y hyR hyw.symm (fun h' => hwx h'.1) (fun h' => hwy h'.1))  -- the separator  set X : Finset (Fin (4*k)) := insert y ((Finset.univ \ R) \ A) with hX  set U : Finset (Fin (4*k)) := S ∪ (A \ R) with hU  set V : Finset (Fin (4*k)) := (R \ S).erase y with hV  have hUne : U.Nonempty := ⟨x, by simp [hU, hxS]⟩  have hwV : w ∈ V := by simp [hV, hwR, hwS, hwy]  have hVne : V.Nonempty := ⟨w, hwV⟩  have hXU : Disjoint X U := by    rw [Finset.disjoint_left]    intro v hvX hvU    simp only [hX, hU, Finset.mem_insert, Finset.mem_sdiff, Finset.mem_univ, true_and,      Finset.mem_union] at hvX hvU    rcases hvX with rfl | ⟨hvR, hvA⟩    · rcases hvU with h | ⟨h, _⟩      · exact hyS h      · exact Finset.disjoint_left.mp hAC h hy    · rcases hvU with h | ⟨h, _⟩      · exact hvR (hSR v h)      · exact hvA h  have hXV : Disjoint X V := by    rw [Finset.disjoint_left]    intro v hvX hvV    simp only [hX, hV, Finset.mem_insert, Finset.mem_sdiff, Finset.mem_univ, true_and,      Finset.mem_erase] at hvX hvV    rcases hvX with rfl | ⟨hvR, _⟩    · exact hvV.1 rfl    · exact hvR hvV.2.1  have hUV : Disjoint U V := by    rw [Finset.disjoint_left]    intro v hvU hvV    simp only [hU, hV, Finset.mem_union, Finset.mem_sdiff, Finset.mem_erase] at hvU hvV    rcases hvU with h | ⟨_, h⟩    · exact hvV.2.2 h    · exact h hvV.2.1  have hcov : X ∪ U ∪ V = Finset.univ := by    ext v    simp only [hX, hU, hV, Finset.mem_union, Finset.mem_insert, Finset.mem_sdiff,      Finset.mem_univ, true_and, Finset.mem_erase, iff_true]    by_cases hvR : v ∈ R    · by_cases hvS : v ∈ S      · tauto      · by_cases hvy : v = y        · tauto        · tauto    · by_cases hvA : v ∈ A      · tauto      · tauto  have hnoUV : ∀ u ∈ U, ∀ v ∈ V, ¬ G.Adj u v := by    intro u hu v hv hadj    simp only [hU, hV, Finset.mem_union, Finset.mem_sdiff, Finset.mem_erase] at hu hv    obtain ⟨hvy, hvR, hvS⟩ := hv    rcases hu with huS | ⟨huA, _⟩    · have hvx : v ≠ x := fun h => hvS (h ▸ hxS)      exact hvS (hstep u huS v hvR hadj (fun h => hvy h.2) (fun h => hvx h.2))    · exact hnoAB u huA v (hWB v hvR hvS hvy) hadj  have hbound := hsep X U V hUne hVne hXU hXV hUV hcov hnoUV  -- counting: |X| ≤ 1 + (2k - (|A| - 1)) < 2k  have hAsub : A ⊆ insert x (A \ R) := by    intro a ha    by_cases haR : a ∈ R    · exact Finset.mem_insert.mpr (Or.inl (hAR a ha haR))    · exact Finset.mem_insert_of_mem (by simp [ha, haR])  have c1 := Finset.card_le_card hAsub  have c2 := Finset.card_insert_le x (A \ R)  have c3 : X.card ≤ ((Finset.univ \ R) \ A).card + 1 := by    rw [hX]; exact Finset.card_insert_le _ _  have hsplit : (Finset.univ \ R) = ((Finset.univ \ R) \ A) ∪ (A \ R) := by    ext v; simp only [Finset.mem_sdiff, Finset.mem_univ, true_and, Finset.mem_union]; tauto  have hdisj : Disjoint ((Finset.univ \ R) \ A) (A \ R) := by    rw [Finset.disjoint_left]; intro v h1 h2    simp only [Finset.mem_sdiff] at h1 h2; exact h1.2 h2.1  have c4 : (Finset.univ \ R).card = ((Finset.univ \ R) \ A).card + (A \ R).card := by    rw [← Finset.card_union_of_disjoint hdisj, ← hsplit]  have c5 : (Finset.univ \ R).card = 2*k := by    rw [Finset.card_sdiff_of_subset (Finset.subset_univ R), Finset.card_univ, Fintype.card_fin, hR]    omega  clear_value S X U V  omega
See it in the graphDiscuss this resultChallenge it