AFTD Auto-Formalizing Theoretical Domains

six_class_cut_elimination

theoremverified

In the displayed balanced six-class partition, the separator, degree and anticompleteness conditions force all vertices into the two designated classes.

Statement

theorem six_class_cut_elimination
    (k : ℕ) (G : SimpleGraph (Fin (4*k))) [DecidableRel G.Adj]
    (hsep : ∀ S P Q : Finset (Fin (4*k)), P.Nonempty → Q.Nonempty →
      Disjoint S P → Disjoint S Q → Disjoint P Q → S ∪ P ∪ Q = Finset.univ →
      (∀ u ∈ P, ∀ v ∈ Q, ¬ G.Adj u v) → 2*k ≤ S.card)
    (f : Fin (4*k) → Fin 6)
    (hside : ((Finset.univ : Finset (Fin (4*k))).filter (fun v => f v < 3)).card = 2*k)
    (hd1 : ∃ v, f v = 0) (hd2 : ∃ v, f v = 3)
    (hanti : ∀ u v, G.Adj u v →
      ¬ ((f u = 0 ∧ (f v = 2 ∨ f v = 4 ∨ f v = 5)) ∨
         (f u = 3 ∧ (f v = 1 ∨ f v = 2 ∨ f v = 5))))
    (hind : ∀ u v, G.Adj u v → ¬ ((f u = 1 ∧ f v = 1) ∨ (f u = 4 ∧ f v = 4)))
    (hdeg : ∀ v, 2*k+1 ≤ (G.neighborFinset v).card) :
    ∀ v, f v = 0 ∨ f v = 3
Source
Separator arithmetic for OP-1957; https://arxiv.org/abs/1011.3384.
Verified
26 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • is_k_extendableFor a finite vertex type V (with [Fintype V]), a simple graph G : SimpleGraph V and k : ℕ, is_k_extendable G k is the Prop that is the…

The proof, explained

The theorem shows that in a balanced 6-partition of a graph on 4k vertices with minimum degree at least 2k + 1, the cut-separator condition forces all vertices into classes B₀ and B₃. If B₁ ∪ B₂ were nonempty, separator bounds on both sides would force |B₂| = |B₅| = 0 and leave B₁ nonempty. But every vertex in B₁ would have all its neighbors restricted to B₀ ∪ B₄ of total size at most 2k, contradicting the minimum degree at least 2k + 1. Once B₁ ∪ B₂ is eliminated, B₄ ∪ B₅ is eliminated by a similar arithmetic contradiction, leaving only B₀ and B₃.

  1. The fiber sets B₀, ..., B₅ partition the vertex set into pairwise disjoint classes.

    We define each class Bᵢ as the set of vertices v with f(v) = i. For distinct indices i ≠ j, Bᵢ and Bⱼ are disjoint because no vertex can map to two distinct values under f.

    lines 15–23

    uses Finset.disjoint_left.mpr

      set_option maxHeartbeats 4000000 in
        classical
        let B : Fin 6 → Finset (Fin (4*k)) := fun i => Finset.univ.filter (fun v => f v = i)
        have hB : ∀ i v, v ∈ B i ↔ f v = i := by intro i v; simp [B]
        have hdis : ∀ i j, i ≠ j → Disjoint (B i) (B j) := by
          intro i j hij
          apply Finset.disjoint_left.mpr
          intro v hv hw
          exact hij ((hB i v).mp hv |>.symm.trans ((hB j v).mp hw))
  2. The first three classes and the last three classes each have cardinalities summing to 2k: |B₀| + |B₁| + |B₂| = 2k and |B₃| + |B₄| + |B₅| = 2k.

    The hypothesis `hside` states that the vertices with f(v) < 3 form a set of size 2k, which is the disjoint union B₀ ∪ B₁ ∪ B₂. Its complement is the disjoint union B₃ ∪ B₄ ∪ B₅, whose cardinality is 4k - 2k = 2k.

    lines 24–46

    uses Finset.mem_union, Finset.mem_filter, Finset.mem_univ, true_and, Finset.disjoint_union_left.mpr, congrArg, Finset.card_union_of_disjoint, Finset.mem_compl, Finset.card_compl, Fintype.card_fin

        have hside' : (B 0).card + (B 1).card + (B 2).card = 2*k := by
          have hs : B 0 ∪ B 1 ∪ B 2 = Finset.univ.filter (fun v => f v < 3) := by
            ext v
            simp only [Finset.mem_union,hB,Finset.mem_filter,Finset.mem_univ,true_and]
            generalize f v = t
            fin_cases t <;> decide
          have hd01 : Disjoint (B 0) (B 1) := hdis 0 1 (by decide)
          have hd012 : Disjoint (B 0 ∪ B 1) (B 2) := Finset.disjoint_union_left.mpr ⟨hdis 0 2 (by decide), hdis 1 2 (by decide)⟩
          have hc := congrArg Finset.card hs
          rw [Finset.card_union_of_disjoint hd012, Finset.card_union_of_disjoint hd01,hside] at hc
          exact hc
        have hside2 : (B 3).card + (B 4).card + (B 5).card = 2*k := by
          have hs : B 3 ∪ B 4 ∪ B 5 = (Finset.univ.filter (fun v => f v < 3))ᶜ := by
            ext v
            simp only [Finset.mem_union,hB,Finset.mem_compl,Finset.mem_filter,Finset.mem_univ,true_and]
            generalize f v = t
            fin_cases t <;> decide
          have hd34 : Disjoint (B 3) (B 4) := hdis 3 4 (by decide)
          have hd345 : Disjoint (B 3 ∪ B 4) (B 5) := Finset.disjoint_union_left.mpr ⟨hdis 3 5 (by decide), hdis 4 5 (by decide)⟩
          have hc := congrArg Finset.card hs
          rw [Finset.card_union_of_disjoint hd345, Finset.card_union_of_disjoint hd34,Finset.card_compl,hside] at hc
          simp only [Fintype.card_fin] at hc
          omega
  3. If B₁ ∪ B₂ is nonempty, then |B₀| + |B₄| ≥ 2k.

    Assuming B₁ ∪ B₂ is nonempty, consider the tripartition S = B₀ ∪ B₄, P = B₃, and Q = (S ∪ P)ᶜ. The set P is nonempty by hypothesis `hd2`, and Q is nonempty because it contains the nonempty set B₁ ∪ B₂. By the anticompleteness assumption `hanti`, vertices in P = B₃ have no neighbors in Q ⊆ B₁ ∪ B₂ ∪ B₅. Thus (S, P, Q) forms an edge cut with no edges between P and Q, so the separator hypothesis `hsep` requires 2k ≤ |S| ≤ |B₀| + |B₄|.

    lines 47–71

    uses Finset.mem_union, Finset.mem_compl, Finset.disjoint_union_left.mpr, Finset.disjoint_left.mpr, Finset.mem_compl.mp, Finset.mem_union_left, Finset.mem_union_right, Finset.mem_univ, iff_true, le_trans, Finset.card_union_le

        have cut1 : (B 1 ∪ B 2).Nonempty → 2*k ≤ (B 0).card + (B 4).card := by
          intro hne
          let S := B 0 ∪ B 4
          let P := B 3
          let Q := (S ∪ P)ᶜ
          have hp : P.Nonempty := by obtain ⟨v,hv⟩ := hd2; exact ⟨v,(hB 3 v).mpr hv⟩
          have hq : Q.Nonempty := by
            obtain ⟨v,hv⟩ := hne
            refine ⟨v,?_⟩
            simp only [Finset.mem_union,hB] at hv
            simp only [Q,S,P,Finset.mem_compl,Finset.mem_union,hB]
            rcases hv with hv | hv <;> simp [hv]
          have hsp : Disjoint S P := Finset.disjoint_union_left.mpr ⟨hdis 0 3 (by decide),hdis 4 3 (by decide)⟩
          have hsq : Disjoint S Q := by apply Finset.disjoint_left.mpr; intro v hv hw; exact (Finset.mem_compl.mp hw) (Finset.mem_union_left P hv)
          have hpq : Disjoint P Q := by apply Finset.disjoint_left.mpr; intro v hv hw; exact (Finset.mem_compl.mp hw) (Finset.mem_union_right S hv)
          have huniv : S ∪ P ∪ Q = Finset.univ := by ext v; simp only [Q,Finset.mem_union,Finset.mem_compl,Finset.mem_univ, iff_true]; tauto
          have ha : ∀ u ∈ P, ∀ v ∈ Q, ¬ G.Adj u v := by
            intro u hu v hv hadj
            have hu' : f u = 3 := (hB 3 u).mp hu
            have hv' : f v ≠ 0 ∧ f v ≠ 4 ∧ f v ≠ 3 := by simpa [Q,S,P,hB] using hv
            have hc := hanti u v hadj
            generalize hfv : f v = t at *
            fin_cases t <;> simp_all
          have hh := hsep S P Q hp hq hsp hsq hpq huniv ha
          exact le_trans hh (Finset.card_union_le _ _)
  4. If B₄ ∪ B₅ is nonempty, then |B₃| + |B₁| ≥ 2k.

    Symmetrically, if B₄ ∪ B₅ is nonempty, we choose P = B₀, S = B₃ ∪ B₁, and Q = (S ∪ P)ᶜ. The set P is nonempty by `hd1`, and Q contains B₄ ∪ B₅. By `hanti`, vertices in B₀ have no edges to Q ⊆ B₂ ∪ B₄ ∪ B₅. Hence (S, P, Q) is a valid separator tripartition, so 2k ≤ |S| ≤ |B₃| + |B₁|.

    lines 72–96

    uses Finset.mem_union, Finset.mem_compl, Finset.disjoint_union_left.mpr, Finset.disjoint_left.mpr, Finset.mem_compl.mp, Finset.mem_union_left, Finset.mem_union_right, Finset.mem_univ, iff_true, le_trans, Finset.card_union_le

        have cut2 : (B 4 ∪ B 5).Nonempty → 2*k ≤ (B 3).card + (B 1).card := by
          intro hne
          let S := B 3 ∪ B 1
          let P := B 0
          let Q := (S ∪ P)ᶜ
          have hp : P.Nonempty := by obtain ⟨v,hv⟩ := hd1; exact ⟨v,(hB 0 v).mpr hv⟩
          have hq : Q.Nonempty := by
            obtain ⟨v,hv⟩ := hne
            refine ⟨v,?_⟩
            simp only [Finset.mem_union,hB] at hv
            simp only [Q,S,P,Finset.mem_compl,Finset.mem_union,hB]
            rcases hv with hv | hv <;> simp [hv]
          have hsp : Disjoint S P := Finset.disjoint_union_left.mpr ⟨hdis 3 0 (by decide),hdis 1 0 (by decide)⟩
          have hsq : Disjoint S Q := by apply Finset.disjoint_left.mpr; intro v hv hw; exact (Finset.mem_compl.mp hw) (Finset.mem_union_left P hv)
          have hpq : Disjoint P Q := by apply Finset.disjoint_left.mpr; intro v hv hw; exact (Finset.mem_compl.mp hw) (Finset.mem_union_right S hv)
          have huniv : S ∪ P ∪ Q = Finset.univ := by ext v; simp only [Q,Finset.mem_union,Finset.mem_compl,Finset.mem_univ, iff_true]; tauto
          have ha : ∀ u ∈ P, ∀ v ∈ Q, ¬ G.Adj u v := by
            intro u hu v hv hadj
            have hu' : f u = 0 := (hB 0 u).mp hu
            have hv' : f v ≠ 3 ∧ f v ≠ 1 ∧ f v ≠ 0 := by simpa [Q,S,P,hB] using hv
            have hc := hanti u v hadj
            generalize hfv : f v = t at *
            fin_cases t <;> simp_all
          have hh := hsep S P Q hp hq hsp hsq hpq huniv ha
          exact le_trans hh (Finset.card_union_le _ _)
  5. A union of two disjoint classes has strictly positive cardinality if and only if it is nonempty; otherwise both individual classes have size zero.

    For each pair (B₁, B₂) and (B₄, B₅), nonemptiness implies that the union has cardinality at least 1, so the sum of their individual sizes is strictly positive. Conversely, when the union is not nonempty, it is the empty set, which forces both constituent sizes to be zero.

    lines 97–118

    uses Finset.card_pos.mpr, Finset.card_union_le, Finset.not_nonempty_iff_eq_empty.mp, congrArg, Finset.card_union_of_disjoint, Finset.card_empty

        have pos1 : (B 1 ∪ B 2).Nonempty → 0 < (B 1).card + (B 2).card := by
          intro hh
          have hpos := Finset.card_pos.mpr hh
          have hle := Finset.card_union_le (B 1) (B 2)
          omega
        have pos2 : (B 4 ∪ B 5).Nonempty → 0 < (B 4).card + (B 5).card := by
          intro hh
          have hpos := Finset.card_pos.mpr hh
          have hle := Finset.card_union_le (B 4) (B 5)
          omega
        have zero1 : ¬ (B 1 ∪ B 2).Nonempty → (B 1).card = 0 ∧ (B 2).card = 0 := by
          intro hh
          have he := Finset.not_nonempty_iff_eq_empty.mp hh
          have hc := congrArg Finset.card he
          rw [Finset.card_union_of_disjoint (hdis 1 2 (by decide)),Finset.card_empty] at hc
          omega
        have zero2 : ¬ (B 4 ∪ B 5).Nonempty → (B 4).card = 0 ∧ (B 5).card = 0 := by
          intro hh
          have he := Finset.not_nonempty_iff_eq_empty.mp hh
          have hc := congrArg Finset.card he
          rw [Finset.card_union_of_disjoint (hdis 4 5 (by decide)),Finset.card_empty] at hc
          omega
  6. The union B₁ ∪ B₂ must be empty.

    Suppose for contradiction that B₁ ∪ B₂ is nonempty. If B₄ ∪ B₅ were empty, then |B₄| = 0, so the first cut inequality would force |B₀| ≥ 2k, contradicting |B₀| + |B₁| + |B₂| = 2k with |B₁ ∪ B₂| > 0. Hence B₄ ∪ B₅ is also nonempty. Both cut inequalities 2k ≤ |B₀| + |B₄| and 2k ≤ |B₃| + |B₁| must hold simultaneously. Summing them yields 4k ≤ |B₀| + |B₄| + |B₃| + |B₁|, which matches the total number of vertices 4k. Therefore, the remaining classes must be empty (|B₂| = 0 and |B₅| = 0), and |B₁| > 0. Picking a vertex u ∈ B₁, its neighbors cannot belong to B₁ (by the independent set condition `hind`), nor to B₃ (by anticompleteness `hanti`), nor to B₂ or B₅ (since both are empty). All neighbors of u must therefore lie in B₀ ∪ B₄, giving deg(u) ≤ |B₀| + |B₄| = 2k. This contradicts the minimum degree condition deg(u) ≥ 2k + 1. Thus B₁ ∪ B₂ is empty.

    lines 119–157

    uses Finset.card_pos.mp, Finset.card_pos.mpr, Finset.mem_union, Finset.card_le_card, Finset.card_union_le

        have none1 : ¬ (B 1 ∪ B 2).Nonempty := by
          intro hh1
          have hh2 : (B 4 ∪ B 5).Nonempty := by
            by_contra hh
            have hz := zero2 hh
            have hp := pos1 hh1
            have hc := cut1 hh1
            omega
          have hp1 := pos1 hh1
          have hp2 := pos2 hh2
          have hc1 := cut1 hh1
          have hc2 := cut2 hh2
          have hz2 : (B 2).card = 0 := by omega
          have hz5 : (B 5).card = 0 := by omega
          have hB1 : (B 1).Nonempty := Finset.card_pos.mp (by omega)
          obtain ⟨u,hu⟩ := hB1
          have hu1 : f u = 1 := (hB 1 u).mp hu
          have hsub : G.neighborFinset u ⊆ B 0 ∪ B 4 := by
            intro v hv
            have huv : G.Adj u v := by simpa using hv
            have hz2' : f v ≠ 2 := by
              intro h
              have hh : v ∈ B 2 := (hB 2 v).mpr h
              have hp := Finset.card_pos.mpr ⟨v,hh⟩
              omega
            have hz5' : f v ≠ 5 := by
              intro h
              have hh : v ∈ B 5 := (hB 5 v).mpr h
              have hp := Finset.card_pos.mpr ⟨v,hh⟩
              omega
            have hi := hind u v huv
            have ha := hanti v u huv.symm
            simp only [Finset.mem_union,hB]
            generalize hfv : f v = t at *
            fin_cases t <;> simp_all
          have hc := Finset.card_le_card hsub
          have hu := Finset.card_union_le (B 0) (B 4)
          have hd := hdeg u
          omega
  7. The union B₄ ∪ B₅ must be empty.

    If B₄ ∪ B₅ were nonempty, the second cut bound would give 2k ≤ |B₃| + |B₁|. But B₁ ∪ B₂ is already known to be empty, so |B₁| = 0. Furthermore, |B₄| + |B₅| > 0 implies |B₃| = 2k - (|B₄| + |B₅|) < 2k, leading to 2k ≤ |B₃| < 2k, a contradiction.

    lines 158–163

        have none2 : ¬ (B 4 ∪ B 5).Nonempty := by
          intro hh2
          have hz := zero1 none1
          have hp := pos2 hh2
          have hc := cut2 hh2
          omega
  8. Every vertex v satisfies f(v) = 0 or f(v) = 3.

    Since B₁ ∪ B₂ and B₄ ∪ B₅ are both empty, all four classes B₁, B₂, B₄, B₅ have size zero and contain no elements. Therefore, every vertex in the graph must belong to B₀ or B₃, meaning f(v) = 0 or f(v) = 3.

    lines 164–174

    uses Finset.card_pos.mpr

        intro v
        by_contra hh
        push Not at hh
        have hz1 := zero1 none1
        have hz2 := zero2 none2
        have hnot1 : f v ≠ 1 := by intro h; have hp := Finset.card_pos.mpr ⟨v,(hB 1 v).mpr h⟩; omega
        have hnot2 : f v ≠ 2 := by intro h; have hp := Finset.card_pos.mpr ⟨v,(hB 2 v).mpr h⟩; omega
        have hnot4 : f v ≠ 4 := by intro h; have hp := Finset.card_pos.mpr ⟨v,(hB 4 v).mpr h⟩; omega
        have hnot5 : f v ≠ 5 := by intro h; have hp := Finset.card_pos.mpr ⟨v,(hB 5 v).mpr h⟩; omega
        generalize hfv : f v = t at *
        fin_cases t <;> simp_all
Finset.disjoint_left.mpr
Two finite sets are disjoint if every element of the first does not belong to the second.
Finset.mem_union
An element belongs to the union of two finite sets if and only if it belongs to at least one of them.
Finset.mem_filter
An element belongs to a filtered finite set if and only if it belongs to the base set and satisfies the predicate.
Finset.mem_univ
Every element of a finite type belongs to its universal finset.
true_and
The conjunction True ∧ p is equivalent to p.
Finset.disjoint_union_left.mpr
If two finite sets are each disjoint from a third, their union is disjoint from that third set.
congrArg
Applying a function to equal inputs yields equal outputs.
Finset.card_union_of_disjoint
The cardinality of the union of two disjoint finite sets is the sum of their cardinalities.
Finset.mem_compl
An element belongs to the complement of a finite set if and only if it does not belong to the set.
Finset.card_compl
The cardinality of the complement of a finset is the total size of the ambient finite type minus the cardinality of the set.
Fintype.card_fin
The cardinality of Fin n is n.
Finset.mem_compl.mp
If an element belongs to the complement of a finite set, it does not belong to the set.
Finset.mem_union_left
If an element belongs to a finite set s, it belongs to the union s ∪ t.
Finset.mem_union_right
If an element belongs to a finite set t, it belongs to the union s ∪ t.
iff_true
The equivalence (p ↔ True) simplifies to p.
le_trans
Inequality is transitive: a ≤ b and b ≤ c imply a ≤ c.
Finset.card_union_le
The cardinality of the union of two finite sets is at most the sum of their cardinalities.
Finset.card_pos.mpr
A nonempty finite set has strictly positive cardinality.
Finset.not_nonempty_iff_eq_empty.mp
A finite set that is not nonempty is empty.
Finset.card_empty
The empty finite set has cardinality zero.
Finset.card_pos.mp
A finite set with strictly positive cardinality is nonempty.
Finset.card_le_card
A subset has cardinality at most that of its superset.

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 six_class_cut_elimination    (k : ℕ) (G : SimpleGraph (Fin (4*k))) [DecidableRel G.Adj]    (hsep : ∀ S P Q : Finset (Fin (4*k)), P.Nonempty → Q.Nonempty →      Disjoint S P → Disjoint S Q → Disjoint P Q → S ∪ P ∪ Q = Finset.univ →      (∀ u ∈ P, ∀ v ∈ Q, ¬ G.Adj u v) → 2*k ≤ S.card)    (f : Fin (4*k) → Fin 6)    (hside : ((Finset.univ : Finset (Fin (4*k))).filter (fun v => f v < 3)).card = 2*k)    (hd1 : ∃ v, f v = 0) (hd2 : ∃ v, f v = 3)    (hanti : ∀ u v, G.Adj u v →      ¬ ((f u = 0 ∧ (f v = 2 ∨ f v = 4 ∨ f v = 5)) ∨         (f u = 3 ∧ (f v = 1 ∨ f v = 2 ∨ f v = 5))))    (hind : ∀ u v, G.Adj u v → ¬ ((f u = 1 ∧ f v = 1) ∨ (f u = 4 ∧ f v = 4)))    (hdeg : ∀ v, 2*k+1 ≤ (G.neighborFinset v).card) :    ∀ v, f v = 0 ∨ f v = 3 := by  set_option maxHeartbeats 4000000 in    classical    let B : Fin 6 → Finset (Fin (4*k)) := fun i => Finset.univ.filter (fun v => f v = i)    have hB : ∀ i v, v ∈ B i ↔ f v = i := by intro i v; simp [B]    have hdis : ∀ i j, i ≠ j → Disjoint (B i) (B j) := by      intro i j hij      apply Finset.disjoint_left.mpr      intro v hv hw      exact hij ((hB i v).mp hv |>.symm.trans ((hB j v).mp hw))    have hside' : (B 0).card + (B 1).card + (B 2).card = 2*k := by      have hs : B 0 ∪ B 1 ∪ B 2 = Finset.univ.filter (fun v => f v < 3) := by        ext v        simp only [Finset.mem_union,hB,Finset.mem_filter,Finset.mem_univ,true_and]        generalize f v = t        fin_cases t <;> decide      have hd01 : Disjoint (B 0) (B 1) := hdis 0 1 (by decide)      have hd012 : Disjoint (B 0 ∪ B 1) (B 2) := Finset.disjoint_union_left.mpr ⟨hdis 0 2 (by decide), hdis 1 2 (by decide)⟩      have hc := congrArg Finset.card hs      rw [Finset.card_union_of_disjoint hd012, Finset.card_union_of_disjoint hd01,hside] at hc      exact hc    have hside2 : (B 3).card + (B 4).card + (B 5).card = 2*k := by      have hs : B 3 ∪ B 4 ∪ B 5 = (Finset.univ.filter (fun v => f v < 3))ᶜ := by        ext v        simp only [Finset.mem_union,hB,Finset.mem_compl,Finset.mem_filter,Finset.mem_univ,true_and]        generalize f v = t        fin_cases t <;> decide      have hd34 : Disjoint (B 3) (B 4) := hdis 3 4 (by decide)      have hd345 : Disjoint (B 3 ∪ B 4) (B 5) := Finset.disjoint_union_left.mpr ⟨hdis 3 5 (by decide), hdis 4 5 (by decide)⟩      have hc := congrArg Finset.card hs      rw [Finset.card_union_of_disjoint hd345, Finset.card_union_of_disjoint hd34,Finset.card_compl,hside] at hc      simp only [Fintype.card_fin] at hc      omega    have cut1 : (B 1 ∪ B 2).Nonempty → 2*k ≤ (B 0).card + (B 4).card := by      intro hne      let S := B 0 ∪ B 4      let P := B 3      let Q := (S ∪ P)ᶜ      have hp : P.Nonempty := by obtain ⟨v,hv⟩ := hd2; exact ⟨v,(hB 3 v).mpr hv⟩      have hq : Q.Nonempty := by        obtain ⟨v,hv⟩ := hne        refine ⟨v,?_⟩        simp only [Finset.mem_union,hB] at hv        simp only [Q,S,P,Finset.mem_compl,Finset.mem_union,hB]        rcases hv with hv | hv <;> simp [hv]      have hsp : Disjoint S P := Finset.disjoint_union_left.mpr ⟨hdis 0 3 (by decide),hdis 4 3 (by decide)⟩      have hsq : Disjoint S Q := by apply Finset.disjoint_left.mpr; intro v hv hw; exact (Finset.mem_compl.mp hw) (Finset.mem_union_left P hv)      have hpq : Disjoint P Q := by apply Finset.disjoint_left.mpr; intro v hv hw; exact (Finset.mem_compl.mp hw) (Finset.mem_union_right S hv)      have huniv : S ∪ P ∪ Q = Finset.univ := by ext v; simp only [Q,Finset.mem_union,Finset.mem_compl,Finset.mem_univ, iff_true]; tauto      have ha : ∀ u ∈ P, ∀ v ∈ Q, ¬ G.Adj u v := by        intro u hu v hv hadj        have hu' : f u = 3 := (hB 3 u).mp hu        have hv' : f v ≠ 0 ∧ f v ≠ 4 ∧ f v ≠ 3 := by simpa [Q,S,P,hB] using hv        have hc := hanti u v hadj        generalize hfv : f v = t at *        fin_cases t <;> simp_all      have hh := hsep S P Q hp hq hsp hsq hpq huniv ha      exact le_trans hh (Finset.card_union_le _ _)    have cut2 : (B 4 ∪ B 5).Nonempty → 2*k ≤ (B 3).card + (B 1).card := by      intro hne      let S := B 3 ∪ B 1      let P := B 0      let Q := (S ∪ P)ᶜ      have hp : P.Nonempty := by obtain ⟨v,hv⟩ := hd1; exact ⟨v,(hB 0 v).mpr hv⟩      have hq : Q.Nonempty := by        obtain ⟨v,hv⟩ := hne        refine ⟨v,?_⟩        simp only [Finset.mem_union,hB] at hv        simp only [Q,S,P,Finset.mem_compl,Finset.mem_union,hB]        rcases hv with hv | hv <;> simp [hv]      have hsp : Disjoint S P := Finset.disjoint_union_left.mpr ⟨hdis 3 0 (by decide),hdis 1 0 (by decide)⟩      have hsq : Disjoint S Q := by apply Finset.disjoint_left.mpr; intro v hv hw; exact (Finset.mem_compl.mp hw) (Finset.mem_union_left P hv)      have hpq : Disjoint P Q := by apply Finset.disjoint_left.mpr; intro v hv hw; exact (Finset.mem_compl.mp hw) (Finset.mem_union_right S hv)      have huniv : S ∪ P ∪ Q = Finset.univ := by ext v; simp only [Q,Finset.mem_union,Finset.mem_compl,Finset.mem_univ, iff_true]; tauto      have ha : ∀ u ∈ P, ∀ v ∈ Q, ¬ G.Adj u v := by        intro u hu v hv hadj        have hu' : f u = 0 := (hB 0 u).mp hu        have hv' : f v ≠ 3 ∧ f v ≠ 1 ∧ f v ≠ 0 := by simpa [Q,S,P,hB] using hv        have hc := hanti u v hadj        generalize hfv : f v = t at *        fin_cases t <;> simp_all      have hh := hsep S P Q hp hq hsp hsq hpq huniv ha      exact le_trans hh (Finset.card_union_le _ _)    have pos1 : (B 1 ∪ B 2).Nonempty → 0 < (B 1).card + (B 2).card := by      intro hh      have hpos := Finset.card_pos.mpr hh      have hle := Finset.card_union_le (B 1) (B 2)      omega    have pos2 : (B 4 ∪ B 5).Nonempty → 0 < (B 4).card + (B 5).card := by      intro hh      have hpos := Finset.card_pos.mpr hh      have hle := Finset.card_union_le (B 4) (B 5)      omega    have zero1 : ¬ (B 1 ∪ B 2).Nonempty → (B 1).card = 0 ∧ (B 2).card = 0 := by      intro hh      have he := Finset.not_nonempty_iff_eq_empty.mp hh      have hc := congrArg Finset.card he      rw [Finset.card_union_of_disjoint (hdis 1 2 (by decide)),Finset.card_empty] at hc      omega    have zero2 : ¬ (B 4 ∪ B 5).Nonempty → (B 4).card = 0 ∧ (B 5).card = 0 := by      intro hh      have he := Finset.not_nonempty_iff_eq_empty.mp hh      have hc := congrArg Finset.card he      rw [Finset.card_union_of_disjoint (hdis 4 5 (by decide)),Finset.card_empty] at hc      omega    have none1 : ¬ (B 1 ∪ B 2).Nonempty := by      intro hh1      have hh2 : (B 4 ∪ B 5).Nonempty := by        by_contra hh        have hz := zero2 hh        have hp := pos1 hh1        have hc := cut1 hh1        omega      have hp1 := pos1 hh1      have hp2 := pos2 hh2      have hc1 := cut1 hh1      have hc2 := cut2 hh2      have hz2 : (B 2).card = 0 := by omega      have hz5 : (B 5).card = 0 := by omega      have hB1 : (B 1).Nonempty := Finset.card_pos.mp (by omega)      obtain ⟨u,hu⟩ := hB1      have hu1 : f u = 1 := (hB 1 u).mp hu      have hsub : G.neighborFinset u ⊆ B 0 ∪ B 4 := by        intro v hv        have huv : G.Adj u v := by simpa using hv        have hz2' : f v ≠ 2 := by          intro h          have hh : v ∈ B 2 := (hB 2 v).mpr h          have hp := Finset.card_pos.mpr ⟨v,hh⟩          omega        have hz5' : f v ≠ 5 := by          intro h          have hh : v ∈ B 5 := (hB 5 v).mpr h          have hp := Finset.card_pos.mpr ⟨v,hh⟩          omega        have hi := hind u v huv        have ha := hanti v u huv.symm        simp only [Finset.mem_union,hB]        generalize hfv : f v = t at *        fin_cases t <;> simp_all      have hc := Finset.card_le_card hsub      have hu := Finset.card_union_le (B 0) (B 4)      have hd := hdeg u      omega    have none2 : ¬ (B 4 ∪ B 5).Nonempty := by      intro hh2      have hz := zero1 none1      have hp := pos2 hh2      have hc := cut2 hh2      omega    intro v    by_contra hh    push Not at hh    have hz1 := zero1 none1    have hz2 := zero2 none2    have hnot1 : f v ≠ 1 := by intro h; have hp := Finset.card_pos.mpr ⟨v,(hB 1 v).mpr h⟩; omega    have hnot2 : f v ≠ 2 := by intro h; have hp := Finset.card_pos.mpr ⟨v,(hB 2 v).mpr h⟩; omega    have hnot4 : f v ≠ 4 := by intro h; have hp := Finset.card_pos.mpr ⟨v,(hB 4 v).mpr h⟩; omega    have hnot5 : f v ≠ 5 := by intro h; have hp := Finset.card_pos.mpr ⟨v,(hB 5 v).mpr h⟩; omega    generalize hfv : f v = t at *    fin_cases t <;> simp_all
See it in the graphDiscuss this resultChallenge it