AFTD Auto-Formalizing Theoretical Domains

op874_locally_maximal_cut_tight_structure

theoremverified

At equality in the 1:2 balance bound for a locally maximal matching cut, every matching pair in the larger bit class has exactly two same-bit factor incidences, and every pair in the smaller class has none.

Statement

theorem op874_locally_maximal_cut_tight_structure {V : Type*} [Fintype V] [DecidableEq V]
    (G : SimpleGraph V) [DecidableRel G.Adj] (hcubic : G.IsRegularOfDegree 3)
    (M : Finset (Sym2 V)) (hsub : M ⊆ G.edgeFinset)
    (hperfect : ∀ v : V, ∃! e : Sym2 V, e ∈ M ∧ v ∈ e)
    (b : V → Bool) (hmatching : ∀ u v, G.Adj u v → s(u,v) ∈ M → b u = b v)
    (hcut : ∀ u v, G.Adj u v → s(u,v) ∈ M →
      ((G.neighborFinset u).filter fun w => b w = b u ∧ s(u,w) ∉ M).card +
      ((G.neighborFinset v).filter fun w => b w = b v ∧ s(v,w) ∉ M).card ≤ 2)
    (htight : (Finset.univ.filter fun v : V => b v = true).card =
      2 * (Finset.univ.filter fun v : V => b v = false).card) :
    ∀ u v, G.Adj u v → s(u,v) ∈ M →
      ((G.neighborFinset u).filter fun w => b w = b u ∧ s(u,w) ∉ M).card +
      ((G.neighborFinset v).filter fun w => b w = b v ∧ s(v,w) ∉ M).card =
        if b u then 2 else 0
Source
Equality case of the matching-cut balance count for OP-874; https://arxiv.org/abs/2610.41950.
Verified
27 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1

The proof, explained

The theorem determines the exact local structure of a cubic graph cut that achieves the tight 1:2 balance bound |T| = 2|S|. Since matching edges are monochromatic and each vertex has degree 3, every vertex has 2 non-matching edges partitioned into same-bit and opposite-bit incidences. Double-counting the non-matching cut edges between S and T yields |T| ≤ ∑_{v ∈ T} oppInc(v) = ∑_{v ∈ S} oppInc(v) ≤ 2|S|. Under the equality |T| = 2|S|, these inequalities collapse to term-by-term equalities, forcing every vertex in S to have 0 same-bit non-matching neighbors and every matching pair in T to have exactly 2.

  1. Every vertex v has a unique matching partner mate(v), forming an adjacent, monochromatic pair, and mate is an involution on V.

    Using the hypothesis that M is a perfect matching, for each vertex v we choose the unique edge containing v and extract its other endpoint mate(v). Because M is a subset of the graph edges and matching edges are monochromatic, v and mate(v) are adjacent and share the same bit b(mate(v)) = b(v). The uniqueness of the matching edge implies that mate is an involution (mate(mate(v)) = v) and that any neighbor w of v along a matching edge must be mate(v).

    lines 15–44

    uses Classical.choose_spec, Sym2.other_spec, Sym2.other_mem, SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet, Sym2.eq_swap, Sym2.congr_right

      classical
      let me : V → Sym2 V := fun v => Classical.choose (hperfect v)
      have me_mem : ∀ v, me v ∈ M := fun v => (Classical.choose_spec (hperfect v)).1.1
      have v_mem_me : ∀ v, v ∈ me v := fun v => (Classical.choose_spec (hperfect v)).1.2
      have me_uniq : ∀ v e, e ∈ M → v ∈ e → e = me v := fun v e he hv =>
        (Classical.choose_spec (hperfect v)).2 e ⟨he, hv⟩
      let mate : V → V := fun v => Sym2.Mem.other (v_mem_me v)
      have me_eq : ∀ v, me v = s(v, mate v) := fun v => (Sym2.other_spec (v_mem_me v)).symm
      have mate_mem_me : ∀ v, mate v ∈ me v := fun v => Sym2.other_mem (v_mem_me v)
      have match_mem : ∀ v, s(v, mate v) ∈ M := by
        intro v; rw [← me_eq v]; exact me_mem v
      have match_adj : ∀ v, G.Adj v (mate v) := by
        intro v
        have h : s(v, mate v) ∈ G.edgeFinset := hsub (match_mem v)
        rwa [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet] at h
      have b_mate : ∀ v, b (mate v) = b v :=
        fun v => (hmatching v (mate v) (match_adj v) (match_mem v)).symm
      have me_mate : ∀ v, me (mate v) = me v :=
        fun v => (me_uniq (mate v) (me v) (me_mem v) (mate_mem_me v)).symm
      have mate_invol : ∀ v, mate (mate v) = v := by
        intro v
        have h1 : s(mate v, mate (mate v)) = me (mate v) := by
          simpa [mate] using (Sym2.other_spec (mate_mem_me (mate v))).symm
        have h2 : me (mate v) = s(mate v, v) := by rw [me_mate v, me_eq v, Sym2.eq_swap]
        exact (Sym2.congr_right).mp (h1.trans h2)
      have unique_match_nbhd : ∀ v w, G.Adj v w → s(v,w) ∈ M → w = mate v := by
        intro v w _ hmem
        have heq : s(v,w) = me v := me_uniq v (s(v,w)) hmem (by simp)
        rw [me_eq v] at heq
        exact (Sym2.congr_right).mp heq
  2. Each vertex has exactly 2 non-matching neighbors, so its same-bit and opposite-bit non-matching neighbor counts satisfy sameInc(v) + oppInc(v) = 2.

    In a 3-regular graph, each vertex v has degree 3. Exactly one of its neighbors is its matching partner mate(v), so removing mate(v) leaves 3 - 1 = 2 non-matching neighbors. Partitioning these 2 neighbors according to whether their bit matches b(v) shows that sameInc(v) + oppInc(v) = 2.

    lines 45–83

    uses Finset.mem_filter, Finset.mem_erase, SimpleGraph.mem_neighborFinset, SimpleGraph.neighborFinset_eq_filter, Finset.card_erase_of_mem, SimpleGraph.card_neighborFinset_eq_degree, Finset.filter_filter, Finset.card_filter_add_card_filter_not

      let sameInc : V → ℕ := fun v =>
        (Finset.univ.filter fun w : V => G.Adj v w ∧ b w = b v ∧ s(v,w) ∉ M).card
      let oppInc : V → ℕ := fun v =>
        (Finset.univ.filter fun w : V => G.Adj v w ∧ b w ≠ b v ∧ s(v,w) ∉ M).card
      have hfilter2 : ∀ v,
          (G.neighborFinset v).filter (fun w => s(v,w) ∉ M) = (G.neighborFinset v).erase (mate v) := by
        intro v
        ext w
        simp only [Finset.mem_filter, Finset.mem_erase]
        constructor
        · rintro ⟨hwn, hnm⟩
          exact ⟨fun h => hnm (h ▸ match_mem v), hwn⟩
        · rintro ⟨hne, hwn⟩
          exact ⟨hwn, fun hmem =>
            hne (unique_match_nbhd v w ((SimpleGraph.mem_neighborFinset G v w).mp hwn) hmem)⟩
      have nonmatch_deg : ∀ v, (Finset.univ.filter fun w : V => G.Adj v w ∧ s(v,w) ∉ M).card = 2 := by
        intro v
        have h1 : (Finset.univ.filter fun w : V => G.Adj v w ∧ s(v,w) ∉ M) =
            (G.neighborFinset v).filter (fun w => s(v,w) ∉ M) := by
          rw [SimpleGraph.neighborFinset_eq_filter]
          ext w; simp
        rw [h1, hfilter2 v, Finset.card_erase_of_mem]
        · have h2 : (G.neighborFinset v).card = 3 := by
            rw [SimpleGraph.card_neighborFinset_eq_degree, hcubic.degree_eq v]
          omega
        · rw [SimpleGraph.mem_neighborFinset]
          exact match_adj v
      have same_add_opp : ∀ v, sameInc v + oppInc v = 2 := by
        intro v
        simp only [sameInc, oppInc]
        let A : Finset V := Finset.univ.filter fun w : V => G.Adj v w ∧ s(v,w) ∉ M
        have hsame : (Finset.univ.filter fun w : V => G.Adj v w ∧ b w = b v ∧ s(v,w) ∉ M) =
            A.filter (fun w => b w = b v) := by
          simp [A, Finset.filter_filter, and_assoc, and_comm]
        have hopp : (Finset.univ.filter fun w : V => G.Adj v w ∧ b w ≠ b v ∧ s(v,w) ∉ M) =
            A.filter (fun w => ¬ b w = b v) := by
          simp [A, Finset.filter_filter, and_assoc, and_comm, Ne]
        rw [hsame, hopp, Finset.card_filter_add_card_filter_not]
        exact nonmatch_deg v
  3. The cut condition sameInc(v) + sameInc(mate(v)) ≤ 2 is equivalent to oppInc(v) + oppInc(mate(v)) ≥ 2.

    The local cut hypothesis asserts that across any matching edge, the sum of same-bit non-matching neighbors is at most 2. Using sameInc = 2 - oppInc for both endpoints, this inequality becomes (2 - oppInc(v)) + (2 - oppInc(mate(v))) ≤ 2, which rearranges by linear arithmetic to 2 ≤ oppInc(v) + oppInc(mate(v)).

    lines 84–102

    uses SimpleGraph.neighborFinset_eq_filter

      have same_eq : ∀ v, sameInc v =
          ((G.neighborFinset v).filter fun w => b w = b v ∧ s(v,w) ∉ M).card := by
        intro v
        simp only [sameInc]
        rw [SimpleGraph.neighborFinset_eq_filter]
        congr 1
        ext w
        simp
      have hcut' : ∀ v, sameInc v + sameInc (mate v) ≤ 2 := by
        intro v
        have h1 := hcut v (mate v) (match_adj v) (match_mem v)
        rw [← same_eq v, ← same_eq (mate v)] at h1
        exact h1
      have pair_opp : ∀ v, 2 ≤ oppInc v + oppInc (mate v) := by
        intro v
        have h1 := hcut' v
        have h2 := same_add_opp v
        have h3 := same_add_opp (mate v)
        omega
  4. The bit classes S = b⁻¹(false) and T = b⁻¹(true) are mate-invariant, and any mate-invariant set A satisfies |A| ≤ ∑_{v ∈ A} oppInc(v) ≤ 2|A|.

    Since b(mate(v)) = b(v), both S and T are closed under mate. Because mate is an involution on any mate-invariant set A, reindexing the sum shows ∑_{v ∈ A} oppInc(mate(v)) = ∑_{v ∈ A} oppInc(v). Summing 2 ≤ oppInc(v) + oppInc(mate(v)) over A therefore gives 2|A| ≤ 2 ∑_{v ∈ A} oppInc(v), which simplifies to |A| ≤ ∑_{v ∈ A} oppInc(v). Summing oppInc(v) ≤ 2 gives the upper bound ∑_{v ∈ A} oppInc(v) ≤ 2|A|.

    lines 103–141

    uses Finset.mem_filter, Finset.mem_univ, true_and, Finset.sum_nbij', Finset.induction, Finset.sum_insert, Finset.card_insert_of_notMem, Finset.sum_add_distrib, Finset.sum_le_sum

      let S : Finset V := Finset.univ.filter (fun v => b v = false)
      let T : Finset V := Finset.univ.filter (fun v => b v = true)
      have hSmate : ∀ v ∈ S, mate v ∈ S := by
        intro v hv
        have hv' : b v = false := by simpa [S] using hv
        simp only [S, Finset.mem_filter, Finset.mem_univ, true_and]
        rw [b_mate v]; exact hv'
      have hTmate : ∀ v ∈ T, mate v ∈ T := by
        intro v hv
        have hv' : b v = true := by simpa [T] using hv
        simp only [T, Finset.mem_filter, Finset.mem_univ, true_and]
        rw [b_mate v]; exact hv'
      have hsum_inv : ∀ A : Finset V, (∀ v ∈ A, mate v ∈ A) →
          ∑ v ∈ A, oppInc (mate v) = ∑ v ∈ A, oppInc v := by
        intro A hA
        refine Finset.sum_nbij' mate mate hA hA (fun v _ => mate_invol v) (fun v _ => mate_invol v)
          (fun v _ => rfl)
      have hcard2' : ∀ A : Finset V, ∑ _v ∈ A, (2:ℕ) = 2 * A.card := by
        intro A
        induction A using Finset.induction with
        | empty => simp
        | insert a s ha ih => rw [Finset.sum_insert ha, ih, Finset.card_insert_of_notMem ha]; ring
      have hA_le : ∀ A : Finset V, (∀ v ∈ A, mate v ∈ A) → A.card ≤ ∑ v ∈ A, oppInc v := by
        intro A hA
        have h1 : ∑ v ∈ A, (oppInc v + oppInc (mate v)) =
            ∑ v ∈ A, oppInc v + ∑ v ∈ A, oppInc v := by
          rw [Finset.sum_add_distrib, hsum_inv A hA]
        have h2 : ∑ v ∈ A, (2:ℕ) ≤ ∑ v ∈ A, (oppInc v + oppInc (mate v)) :=
          Finset.sum_le_sum fun v _ => pair_opp v
        have h3 : ∑ v ∈ A, (2:ℕ) = 2 * A.card := hcard2' A
        omega
      have hB_le : ∀ A : Finset V, ∑ v ∈ A, oppInc v ≤ 2 * A.card := by
        intro A
        have h2 : ∑ v ∈ A, oppInc v ≤ ∑ v ∈ A, (2:ℕ) := by
          refine Finset.sum_le_sum fun v _ => ?_
          have h := same_add_opp v
          omega
        have h3 : ∑ v ∈ A, (2:ℕ) = 2 * A.card := hcard2' A
        omega
  5. Double counting the non-matching edges crossing the cut gives ∑_{v ∈ S} oppInc(v) = ∑_{w ∈ T} oppInc(w).

    Let g(v, w) be the indicator function of an undirected non-matching edge between v and w. Graph symmetry implies g(v, w) = g(w, v). For v ∈ S, its opposite-bit neighbors all lie in T, so oppInc(v) = ∑_{w ∈ T} g(v, w). Likewise, for w ∈ T, oppInc(w) = ∑_{v ∈ S} g(w, v). Summing over v ∈ S and swapping the order of summation establishes that ∑_{v ∈ S} oppInc(v) = ∑_{w ∈ T} oppInc(w).

    lines 142–197

    uses Sym2.eq_swap, Finset.card_filter, Finset.sum_subset, Finset.filter_subset, Finset.mem_filter, Finset.mem_univ, Finset.sum_congr, Finset.sum_comm

      let g : V → V → ℕ := fun v w =>
        (if (G.Adj v w ∧ s(v,w) ∉ M) then (1:ℕ) else 0)
      have gsymm : ∀ v w : V, g v w = g w v := by
        intro v w
        by_cases h : G.Adj v w
        · by_cases hm : s(v,w) ∈ M
          · have hm' : s(w,v) ∈ M := by rwa [Sym2.eq_swap]
            simp [g, h, h.symm, hm, hm']
          · have hm' : s(w,v) ∉ M := by rwa [Sym2.eq_swap]
            simp [g, h, h.symm, hm, hm']
        · have h' : ¬ G.Adj w v := fun hh => h hh.symm
          simp [g, h, h']
      have fiberS : ∀ v ∈ S, oppInc v = ∑ w ∈ T, g v w := by
        intro v hv
        have hbv : b v = false := by simpa [S] using hv
        show (Finset.univ.filter fun w : V => G.Adj v w ∧ b w ≠ b v ∧ s(v,w) ∉ M).card = ∑ w ∈ T, g v w
        rw [Finset.card_filter]
        have step : (∑ w ∈ Finset.univ, (if (G.Adj v w ∧ b w ≠ b v ∧ s(v,w) ∉ M) then (1:ℕ) else 0))
            = ∑ w ∈ T, (if (G.Adj v w ∧ b w ≠ b v ∧ s(v,w) ∉ M) then (1:ℕ) else 0) := by
          refine (Finset.sum_subset (Finset.filter_subset _ _) ?_).symm
          intro w _ hw
          have hbw : ¬ (b w = true) := fun h => hw (Finset.mem_filter.mpr ⟨Finset.mem_univ w, h⟩)
          have hne : ¬ (b w ≠ b v) := by cases hw' : b w <;> simp_all
          simp [hne]
        rw [step]
        refine Finset.sum_congr rfl fun w hw => ?_
        have hbw : b w = true := by simpa [T] using hw
        show (if (G.Adj v w ∧ b w ≠ b v ∧ s(v,w) ∉ M) then (1:ℕ) else 0) = g v w
        simp [g, hbv, hbw]
      have fiberT : ∀ w ∈ T, oppInc w = ∑ v ∈ S, g w v := by
        intro w hw
        have hbw : b w = true := by simpa [T] using hw
        show (Finset.univ.filter fun v : V => G.Adj w v ∧ b v ≠ b w ∧ s(w,v) ∉ M).card = ∑ v ∈ S, g w v
        rw [Finset.card_filter]
        have step : (∑ v ∈ Finset.univ, (if (G.Adj w v ∧ b v ≠ b w ∧ s(w,v) ∉ M) then (1:ℕ) else 0))
            = ∑ v ∈ S, (if (G.Adj w v ∧ b v ≠ b w ∧ s(w,v) ∉ M) then (1:ℕ) else 0) := by
          refine (Finset.sum_subset (Finset.filter_subset _ _) ?_).symm
          intro v _ hv
          have hbv : ¬ (b v = false) := fun h => hv (Finset.mem_filter.mpr ⟨Finset.mem_univ v, h⟩)
          have hne : ¬ (b v ≠ b w) := by cases hv' : b v <;> simp_all
          simp [hne]
        rw [step]
        refine Finset.sum_congr rfl fun v hv => ?_
        have hbv : b v = false := by simpa [S] using hv
        show (if (G.Adj w v ∧ b v ≠ b w ∧ s(w,v) ∉ M) then (1:ℕ) else 0) = g w v
        simp [g, hbv, hbw]
      have hcross : ∑ v ∈ S, oppInc v = ∑ w ∈ T, oppInc w := by
        have e1 : ∑ v ∈ S, oppInc v = ∑ v ∈ S, ∑ w ∈ T, g v w :=
          Finset.sum_congr rfl fun v hv => fiberS v hv
        have e2 : ∑ v ∈ S, ∑ w ∈ T, g v w = ∑ w ∈ T, ∑ v ∈ S, g v w := Finset.sum_comm
        have e3 : ∑ w ∈ T, ∑ v ∈ S, g v w = ∑ w ∈ T, ∑ v ∈ S, g w v := by
          refine Finset.sum_congr rfl fun w _ => Finset.sum_congr rfl fun v _ => ?_
          exact gsymm v w
        have e4 : ∑ w ∈ T, ∑ v ∈ S, g w v = ∑ w ∈ T, oppInc w :=
          Finset.sum_congr rfl fun w hw => (fiberT w hw).symm
        exact e1.trans (e2.trans (e3.trans e4))
  6. Tightness |T| = 2|S| forces the sum of opposite incidences to match the extreme bounds: ∑_{v ∈ S} oppInc(v) = 2|S| and ∑_{w ∈ T} oppInc(w) = |T|.

    From the lower bound on T and the cross-cut equality, we have |T| ≤ ∑_{w ∈ T} oppInc(w) = ∑_{v ∈ S} oppInc(v). From the upper bound on S, ∑_{v ∈ S} oppInc(v) ≤ 2|S|. Since |T| = 2|S|, these bounds pinch the sum to exactly 2|S|, and consequently ∑_{w ∈ T} oppInc(w) = |T|.

    lines 198–206

      have htight' : T.card = 2 * S.card := by
        simpa [S, T] using htight
      have hXeq : ∑ v ∈ S, oppInc v = 2 * S.card := by
        have h1 : T.card ≤ ∑ v ∈ S, oppInc v := by
          rw [hcross]; exact hA_le T hTmate
        have h2 : ∑ v ∈ S, oppInc v ≤ 2 * S.card := hB_le S
        omega
      have hXeqT : ∑ v ∈ T, oppInc v = T.card := by
        rw [← hcross, hXeq, ← htight']
  7. Pointwise equality holds: every vertex in S has sameInc(v) = 0, and every matching pair in T has sameInc(v) + sameInc(mate(v)) = 2.

    Each vertex in S has oppInc(v) ≤ 2, and their sum over S is 2|S| = ∑_{v ∈ S} 2. When a sum of bounded terms achieves its theoretical maximum, each term must equal the bound, forcing oppInc(v) = 2 and sameInc(v) = 0 for all v ∈ S. Similarly, for matching pairs in T, each pair sum oppInc(w) + oppInc(mate(w)) is at least 2, and the sum over all w ∈ T is 2|T| = ∑_{w ∈ T} 2. Thus every pair in T must achieve equality: oppInc(v) + oppInc(mate(v)) = 2, which gives sameInc(v) + sameInc(mate(v)) = 2.

    lines 207–230

    uses Finset.sum_eq_sum_iff_of_le, Finset.sum_add_distrib

      have hS_opp2 : ∀ v ∈ S, oppInc v = 2 := by
        have hle : ∀ v ∈ S, oppInc v ≤ (2:ℕ) := by
          intro v _; have := same_add_opp v; omega
        have hsum2 : ∑ v ∈ S, oppInc v = ∑ v ∈ S, (2:ℕ) := by
          rw [hXeq, hcard2' S]
        exact (Finset.sum_eq_sum_iff_of_le hle).mp hsum2
      have hS_same0 : ∀ v ∈ S, sameInc v = 0 := by
        intro v hv
        have h1 := same_add_opp v
        have h2 := hS_opp2 v hv
        omega
      have hTpair : ∀ v ∈ T, sameInc v + sameInc (mate v) = 2 := by
        have hle : ∀ w ∈ T, (2:ℕ) ≤ oppInc w + oppInc (mate w) := fun w _ => pair_opp w
        have hall : ∀ w ∈ T, oppInc w + oppInc (mate w) = 2 := by
          have hsum_eq : ∑ w ∈ T, (2:ℕ) = ∑ w ∈ T, (oppInc w + oppInc (mate w)) := by
            rw [Finset.sum_add_distrib, hsum_inv T hTmate, hXeqT, hcard2' T]
            ring
          intro w hw
          exact ((Finset.sum_eq_sum_iff_of_le hle).mp hsum_eq w hw).symm
        intro v hv
        have h1 := same_add_opp v
        have h2 := same_add_opp (mate v)
        have h3 := hall v hv
        omega
  8. For any matching edge uv ∈ M, the sum of same-bit non-matching neighbors of u and v equals 2 if b(u) = true and 0 if b(u) = false.

    Given an edge s(u, v) ∈ M, uniqueness of matching edges shows v = mate(u). We split on the boolean value of b(u): if b(u) = false, then u, v ∈ S, so sameInc(u) + sameInc(v) = 0 + 0 = 0. If b(u) = true, then u ∈ T, so the pair sum is 2. This matches the conditional expression if b u then 2 else 0.

    lines 231–248

    uses Finset.mem_filter, Finset.mem_univ, true_and

      intro u v hAdj hmem
      have hv : v = mate u := unique_match_nbhd u v hAdj hmem
      rw [← same_eq u, ← same_eq v, hv]
      cases hb : b u with
      | false =>
          have huS : u ∈ S := by
            simp only [S, Finset.mem_filter, Finset.mem_univ, true_and]
            exact hb
          have h1 := hS_same0 u huS
          have h2 := hS_same0 (mate u) (hSmate u huS)
          rw [h1, h2]
          simp
      | true =>
          have huT : u ∈ T := by
            simp only [T, Finset.mem_filter, Finset.mem_univ, true_and]
            exact hb
          have h := hTpair u huT
          simpa using h
Classical.choose_spec
The element chosen by Classical.choose satisfies the given existential predicate.
Sym2.other_spec
For an element a in an unordered pair z, the pair formed by a and the other element of z equals z.
Sym2.other_mem
The other element of an unordered pair z containing a also belongs to z.
SimpleGraph.mem_edgeFinset
An unordered pair belongs to the edge finset of a graph if and only if it belongs to its edge set.
SimpleGraph.mem_edgeSet
An unordered pair s(v, w) belongs to the edge set of a graph if and only if v and w are adjacent.
Sym2.eq_swap
An unordered pair is symmetric: s(a, b) = s(b, a).
Sym2.congr_right
Two unordered pairs sharing one element are equal if and only if their other elements are equal.
Finset.mem_filter
An element belongs to a filtered finset if and only if it belongs to the original finset and satisfies the predicate.
Finset.mem_erase
An element belongs to s.erase b if and only if it belongs to s and is not equal to b.
SimpleGraph.mem_neighborFinset
A vertex w belongs to the neighbor finset of v if and only if v and w are adjacent.
SimpleGraph.neighborFinset_eq_filter
The neighbor finset of a vertex equals the finset of all vertices adjacent to it.
Finset.card_erase_of_mem
Removing an element from a finset decreases its cardinality by 1.
SimpleGraph.card_neighborFinset_eq_degree
The cardinality of the neighbor finset of a vertex equals its degree.
Finset.filter_filter
Successively filtering a finset by two predicates is equivalent to filtering by their conjunction.
Finset.card_filter_add_card_filter_not
The cardinality of a finset is the sum of the cardinalities of the elements satisfying a predicate and those that do not.
Finset.mem_univ
Every element of a finite type belongs to the universal finset.
true_and
Conjunction of True with a proposition p is equivalent to p.
Finset.sum_nbij'
A sum over a finset is invariant under a bijection of the index set that preserves summands.
Finset.induction
A property holds for all finsets if it holds for the empty set and is preserved under adjoining a new element.
Finset.sum_insert
Summing a function over insert a s with a ∉ s equals the value at a plus the sum over s.
Finset.card_insert_of_notMem
Adjoining an element not already in a finset increases its cardinality by 1.
Finset.sum_add_distrib
The sum of a sum of functions over a finset equals the sum of their individual sums.
Finset.sum_le_sum
If f(i) ≤ g(i) pointwise on a finset, then the sum of f is at most the sum of g.
Finset.card_filter
The cardinality of a filtered finset equals the sum over the finset of the indicator of the filtering condition.
Finset.sum_subset
If s₁ ⊆ s₂ and the summand vanishes outside s₁, then the sum over s₁ equals the sum over s₂.
Finset.filter_subset
Filtering a finset produces a subset of the original finset.
Finset.sum_congr
If two finsets are equal and their summands agree on every element, their sums are equal.
Finset.sum_comm
The order of summation in a finite double sum can be interchanged.
Finset.sum_eq_sum_iff_of_le
If f ≤ g pointwise on a finset, their sums are equal if and only if f = g everywhere on that finset.

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 op874_locally_maximal_cut_tight_structure {V : Type*} [Fintype V] [DecidableEq V]    (G : SimpleGraph V) [DecidableRel G.Adj] (hcubic : G.IsRegularOfDegree 3)    (M : Finset (Sym2 V)) (hsub : M ⊆ G.edgeFinset)    (hperfect : ∀ v : V, ∃! e : Sym2 V, e ∈ M ∧ v ∈ e)    (b : V → Bool) (hmatching : ∀ u v, G.Adj u v → s(u,v) ∈ M → b u = b v)    (hcut : ∀ u v, G.Adj u v → s(u,v) ∈ M →      ((G.neighborFinset u).filter fun w => b w = b u ∧ s(u,w) ∉ M).card +      ((G.neighborFinset v).filter fun w => b w = b v ∧ s(v,w) ∉ M).card ≤ 2)    (htight : (Finset.univ.filter fun v : V => b v = true).card =      2 * (Finset.univ.filter fun v : V => b v = false).card) :    ∀ u v, G.Adj u v → s(u,v) ∈ M →      ((G.neighborFinset u).filter fun w => b w = b u ∧ s(u,w) ∉ M).card +      ((G.neighborFinset v).filter fun w => b w = b v ∧ s(v,w) ∉ M).card =        if b u then 2 else 0 := by  classical  let me : V → Sym2 V := fun v => Classical.choose (hperfect v)  have me_mem : ∀ v, me v ∈ M := fun v => (Classical.choose_spec (hperfect v)).1.1  have v_mem_me : ∀ v, v ∈ me v := fun v => (Classical.choose_spec (hperfect v)).1.2  have me_uniq : ∀ v e, e ∈ M → v ∈ e → e = me v := fun v e he hv =>    (Classical.choose_spec (hperfect v)).2 e ⟨he, hv⟩  let mate : V → V := fun v => Sym2.Mem.other (v_mem_me v)  have me_eq : ∀ v, me v = s(v, mate v) := fun v => (Sym2.other_spec (v_mem_me v)).symm  have mate_mem_me : ∀ v, mate v ∈ me v := fun v => Sym2.other_mem (v_mem_me v)  have match_mem : ∀ v, s(v, mate v) ∈ M := by    intro v; rw [← me_eq v]; exact me_mem v  have match_adj : ∀ v, G.Adj v (mate v) := by    intro v    have h : s(v, mate v) ∈ G.edgeFinset := hsub (match_mem v)    rwa [SimpleGraph.mem_edgeFinset, SimpleGraph.mem_edgeSet] at h  have b_mate : ∀ v, b (mate v) = b v :=    fun v => (hmatching v (mate v) (match_adj v) (match_mem v)).symm  have me_mate : ∀ v, me (mate v) = me v :=    fun v => (me_uniq (mate v) (me v) (me_mem v) (mate_mem_me v)).symm  have mate_invol : ∀ v, mate (mate v) = v := by    intro v    have h1 : s(mate v, mate (mate v)) = me (mate v) := by      simpa [mate] using (Sym2.other_spec (mate_mem_me (mate v))).symm    have h2 : me (mate v) = s(mate v, v) := by rw [me_mate v, me_eq v, Sym2.eq_swap]    exact (Sym2.congr_right).mp (h1.trans h2)  have unique_match_nbhd : ∀ v w, G.Adj v w → s(v,w) ∈ M → w = mate v := by    intro v w _ hmem    have heq : s(v,w) = me v := me_uniq v (s(v,w)) hmem (by simp)    rw [me_eq v] at heq    exact (Sym2.congr_right).mp heq  let sameInc : V → ℕ := fun v =>    (Finset.univ.filter fun w : V => G.Adj v w ∧ b w = b v ∧ s(v,w) ∉ M).card  let oppInc : V → ℕ := fun v =>    (Finset.univ.filter fun w : V => G.Adj v w ∧ b w ≠ b v ∧ s(v,w) ∉ M).card  have hfilter2 : ∀ v,      (G.neighborFinset v).filter (fun w => s(v,w) ∉ M) = (G.neighborFinset v).erase (mate v) := by    intro v    ext w    simp only [Finset.mem_filter, Finset.mem_erase]    constructor    · rintro ⟨hwn, hnm⟩      exact ⟨fun h => hnm (h ▸ match_mem v), hwn⟩    · rintro ⟨hne, hwn⟩      exact ⟨hwn, fun hmem =>        hne (unique_match_nbhd v w ((SimpleGraph.mem_neighborFinset G v w).mp hwn) hmem)⟩  have nonmatch_deg : ∀ v, (Finset.univ.filter fun w : V => G.Adj v w ∧ s(v,w) ∉ M).card = 2 := by    intro v    have h1 : (Finset.univ.filter fun w : V => G.Adj v w ∧ s(v,w) ∉ M) =        (G.neighborFinset v).filter (fun w => s(v,w) ∉ M) := by      rw [SimpleGraph.neighborFinset_eq_filter]      ext w; simp    rw [h1, hfilter2 v, Finset.card_erase_of_mem]    · have h2 : (G.neighborFinset v).card = 3 := by        rw [SimpleGraph.card_neighborFinset_eq_degree, hcubic.degree_eq v]      omega    · rw [SimpleGraph.mem_neighborFinset]      exact match_adj v  have same_add_opp : ∀ v, sameInc v + oppInc v = 2 := by    intro v    simp only [sameInc, oppInc]    let A : Finset V := Finset.univ.filter fun w : V => G.Adj v w ∧ s(v,w) ∉ M    have hsame : (Finset.univ.filter fun w : V => G.Adj v w ∧ b w = b v ∧ s(v,w) ∉ M) =        A.filter (fun w => b w = b v) := by      simp [A, Finset.filter_filter, and_assoc, and_comm]    have hopp : (Finset.univ.filter fun w : V => G.Adj v w ∧ b w ≠ b v ∧ s(v,w) ∉ M) =        A.filter (fun w => ¬ b w = b v) := by      simp [A, Finset.filter_filter, and_assoc, and_comm, Ne]    rw [hsame, hopp, Finset.card_filter_add_card_filter_not]    exact nonmatch_deg v  have same_eq : ∀ v, sameInc v =      ((G.neighborFinset v).filter fun w => b w = b v ∧ s(v,w) ∉ M).card := by    intro v    simp only [sameInc]    rw [SimpleGraph.neighborFinset_eq_filter]    congr 1    ext w    simp  have hcut' : ∀ v, sameInc v + sameInc (mate v) ≤ 2 := by    intro v    have h1 := hcut v (mate v) (match_adj v) (match_mem v)    rw [← same_eq v, ← same_eq (mate v)] at h1    exact h1  have pair_opp : ∀ v, 2 ≤ oppInc v + oppInc (mate v) := by    intro v    have h1 := hcut' v    have h2 := same_add_opp v    have h3 := same_add_opp (mate v)    omega  let S : Finset V := Finset.univ.filter (fun v => b v = false)  let T : Finset V := Finset.univ.filter (fun v => b v = true)  have hSmate : ∀ v ∈ S, mate v ∈ S := by    intro v hv    have hv' : b v = false := by simpa [S] using hv    simp only [S, Finset.mem_filter, Finset.mem_univ, true_and]    rw [b_mate v]; exact hv'  have hTmate : ∀ v ∈ T, mate v ∈ T := by    intro v hv    have hv' : b v = true := by simpa [T] using hv    simp only [T, Finset.mem_filter, Finset.mem_univ, true_and]    rw [b_mate v]; exact hv'  have hsum_inv : ∀ A : Finset V, (∀ v ∈ A, mate v ∈ A) →      ∑ v ∈ A, oppInc (mate v) = ∑ v ∈ A, oppInc v := by    intro A hA    refine Finset.sum_nbij' mate mate hA hA (fun v _ => mate_invol v) (fun v _ => mate_invol v)      (fun v _ => rfl)  have hcard2' : ∀ A : Finset V, ∑ _v ∈ A, (2:ℕ) = 2 * A.card := by    intro A    induction A using Finset.induction with    | empty => simp    | insert a s ha ih => rw [Finset.sum_insert ha, ih, Finset.card_insert_of_notMem ha]; ring  have hA_le : ∀ A : Finset V, (∀ v ∈ A, mate v ∈ A) → A.card ≤ ∑ v ∈ A, oppInc v := by    intro A hA    have h1 : ∑ v ∈ A, (oppInc v + oppInc (mate v)) =        ∑ v ∈ A, oppInc v + ∑ v ∈ A, oppInc v := by      rw [Finset.sum_add_distrib, hsum_inv A hA]    have h2 : ∑ v ∈ A, (2:ℕ) ≤ ∑ v ∈ A, (oppInc v + oppInc (mate v)) :=      Finset.sum_le_sum fun v _ => pair_opp v    have h3 : ∑ v ∈ A, (2:ℕ) = 2 * A.card := hcard2' A    omega  have hB_le : ∀ A : Finset V, ∑ v ∈ A, oppInc v ≤ 2 * A.card := by    intro A    have h2 : ∑ v ∈ A, oppInc v ≤ ∑ v ∈ A, (2:ℕ) := by      refine Finset.sum_le_sum fun v _ => ?_      have h := same_add_opp v      omega    have h3 : ∑ v ∈ A, (2:ℕ) = 2 * A.card := hcard2' A    omega  let g : V → V → ℕ := fun v w =>    (if (G.Adj v w ∧ s(v,w) ∉ M) then (1:ℕ) else 0)  have gsymm : ∀ v w : V, g v w = g w v := by    intro v w    by_cases h : G.Adj v w    · by_cases hm : s(v,w) ∈ M      · have hm' : s(w,v) ∈ M := by rwa [Sym2.eq_swap]        simp [g, h, h.symm, hm, hm']      · have hm' : s(w,v) ∉ M := by rwa [Sym2.eq_swap]        simp [g, h, h.symm, hm, hm']    · have h' : ¬ G.Adj w v := fun hh => h hh.symm      simp [g, h, h']  have fiberS : ∀ v ∈ S, oppInc v = ∑ w ∈ T, g v w := by    intro v hv    have hbv : b v = false := by simpa [S] using hv    show (Finset.univ.filter fun w : V => G.Adj v w ∧ b w ≠ b v ∧ s(v,w) ∉ M).card = ∑ w ∈ T, g v w    rw [Finset.card_filter]    have step : (∑ w ∈ Finset.univ, (if (G.Adj v w ∧ b w ≠ b v ∧ s(v,w) ∉ M) then (1:ℕ) else 0))        = ∑ w ∈ T, (if (G.Adj v w ∧ b w ≠ b v ∧ s(v,w) ∉ M) then (1:ℕ) else 0) := by      refine (Finset.sum_subset (Finset.filter_subset _ _) ?_).symm      intro w _ hw      have hbw : ¬ (b w = true) := fun h => hw (Finset.mem_filter.mpr ⟨Finset.mem_univ w, h⟩)      have hne : ¬ (b w ≠ b v) := by cases hw' : b w <;> simp_all      simp [hne]    rw [step]    refine Finset.sum_congr rfl fun w hw => ?_    have hbw : b w = true := by simpa [T] using hw    show (if (G.Adj v w ∧ b w ≠ b v ∧ s(v,w) ∉ M) then (1:ℕ) else 0) = g v w    simp [g, hbv, hbw]  have fiberT : ∀ w ∈ T, oppInc w = ∑ v ∈ S, g w v := by    intro w hw    have hbw : b w = true := by simpa [T] using hw    show (Finset.univ.filter fun v : V => G.Adj w v ∧ b v ≠ b w ∧ s(w,v) ∉ M).card = ∑ v ∈ S, g w v    rw [Finset.card_filter]    have step : (∑ v ∈ Finset.univ, (if (G.Adj w v ∧ b v ≠ b w ∧ s(w,v) ∉ M) then (1:ℕ) else 0))        = ∑ v ∈ S, (if (G.Adj w v ∧ b v ≠ b w ∧ s(w,v) ∉ M) then (1:ℕ) else 0) := by      refine (Finset.sum_subset (Finset.filter_subset _ _) ?_).symm      intro v _ hv      have hbv : ¬ (b v = false) := fun h => hv (Finset.mem_filter.mpr ⟨Finset.mem_univ v, h⟩)      have hne : ¬ (b v ≠ b w) := by cases hv' : b v <;> simp_all      simp [hne]    rw [step]    refine Finset.sum_congr rfl fun v hv => ?_    have hbv : b v = false := by simpa [S] using hv    show (if (G.Adj w v ∧ b v ≠ b w ∧ s(w,v) ∉ M) then (1:ℕ) else 0) = g w v    simp [g, hbv, hbw]  have hcross : ∑ v ∈ S, oppInc v = ∑ w ∈ T, oppInc w := by    have e1 : ∑ v ∈ S, oppInc v = ∑ v ∈ S, ∑ w ∈ T, g v w :=      Finset.sum_congr rfl fun v hv => fiberS v hv    have e2 : ∑ v ∈ S, ∑ w ∈ T, g v w = ∑ w ∈ T, ∑ v ∈ S, g v w := Finset.sum_comm    have e3 : ∑ w ∈ T, ∑ v ∈ S, g v w = ∑ w ∈ T, ∑ v ∈ S, g w v := by      refine Finset.sum_congr rfl fun w _ => Finset.sum_congr rfl fun v _ => ?_      exact gsymm v w    have e4 : ∑ w ∈ T, ∑ v ∈ S, g w v = ∑ w ∈ T, oppInc w :=      Finset.sum_congr rfl fun w hw => (fiberT w hw).symm    exact e1.trans (e2.trans (e3.trans e4))  have htight' : T.card = 2 * S.card := by    simpa [S, T] using htight  have hXeq : ∑ v ∈ S, oppInc v = 2 * S.card := by    have h1 : T.card ≤ ∑ v ∈ S, oppInc v := by      rw [hcross]; exact hA_le T hTmate    have h2 : ∑ v ∈ S, oppInc v ≤ 2 * S.card := hB_le S    omega  have hXeqT : ∑ v ∈ T, oppInc v = T.card := by    rw [← hcross, hXeq, ← htight']  have hS_opp2 : ∀ v ∈ S, oppInc v = 2 := by    have hle : ∀ v ∈ S, oppInc v ≤ (2:ℕ) := by      intro v _; have := same_add_opp v; omega    have hsum2 : ∑ v ∈ S, oppInc v = ∑ v ∈ S, (2:ℕ) := by      rw [hXeq, hcard2' S]    exact (Finset.sum_eq_sum_iff_of_le hle).mp hsum2  have hS_same0 : ∀ v ∈ S, sameInc v = 0 := by    intro v hv    have h1 := same_add_opp v    have h2 := hS_opp2 v hv    omega  have hTpair : ∀ v ∈ T, sameInc v + sameInc (mate v) = 2 := by    have hle : ∀ w ∈ T, (2:ℕ) ≤ oppInc w + oppInc (mate w) := fun w _ => pair_opp w    have hall : ∀ w ∈ T, oppInc w + oppInc (mate w) = 2 := by      have hsum_eq : ∑ w ∈ T, (2:ℕ) = ∑ w ∈ T, (oppInc w + oppInc (mate w)) := by        rw [Finset.sum_add_distrib, hsum_inv T hTmate, hXeqT, hcard2' T]        ring      intro w hw      exact ((Finset.sum_eq_sum_iff_of_le hle).mp hsum_eq w hw).symm    intro v hv    have h1 := same_add_opp v    have h2 := same_add_opp (mate v)    have h3 := hall v hv    omega  intro u v hAdj hmem  have hv : v = mate u := unique_match_nbhd u v hAdj hmem  rw [← same_eq u, ← same_eq v, hv]  cases hb : b u with  | false =>      have huS : u ∈ S := by        simp only [S, Finset.mem_filter, Finset.mem_univ, true_and]        exact hb      have h1 := hS_same0 u huS      have h2 := hS_same0 (mate u) (hSmate u huS)      rw [h1, h2]      simp  | true =>      have huT : u ∈ T := by        simp only [T, Finset.mem_filter, Finset.mem_univ, true_and]        exact hb      have h := hTpair u huT      simpa using h
See it in the graphDiscuss this resultChallenge it