op874_locally_maximal_matching_cut_balance
Every locally maximal matching-constant cut in a finite simple cubic graph has each bit class at most twice the size of the other. This is a cut-structure fact independent of strong coloring.
Statement
theorem op874_locally_maximal_matching_cut_balance {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) : (Finset.univ.filter fun v : V => b v = false).card ≤ 2 * (Finset.univ.filter fun v : V => b v = true).card ∧ (Finset.univ.filter fun v : V => b v = true).card ≤ 2 * (Finset.univ.filter fun v : V => b v = false).card
- Source
- Locally maximal matching-cut incidence count for OP-874; https://arxiv.org/abs/2610.41950.
- Verified
- 26 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Used by 1
- op874_locally_maximal_cut_tight_structureAt equality in the 1:2 balance bound for a locally maximal matching cut, every matching pair in the larger bit class has exactly two…
The proof, explained
In a 3-regular graph with a perfect matching M and a matching-constant 2-coloring b, each vertex has exactly 1 matching neighbor and 2 non-matching neighbors. The local maximality condition states that across each matching edge, at most 2 non-matching incident edges have matching endpoint colors, which forces at least 2 non-matching incident edges to have differing endpoint colors. Summing across each color class shows that the number of non-matching cut edges bounds each class's size from below by |A| and from above by 2 * |A|. Since the total number of non-matching cut edges can be computed from either side of the cut, the two class sizes are mutually bounded by a factor of 2.
For any finite set A of natural numbers, summing the constant 2 over A gives 2 * |A|.
This auxiliary lemma is proved by induction on the finite set A using `Finset.induction`. For the empty set, the sum is 0. In the inductive step, adjoining an element a ∉ s increases the sum by 2 via `sum_insert` and increases the cardinality by 1 via `card_insert_of_notMem`, and `ring` concludes by the induction hypothesis.
uses
Finset.induction,sum_insert,card_insert_of_notMemprivate lemma op874_locally_maximal_matching_cut_balance_sum_const_two (A : Finset ℕ) : ∑ _v ∈ A, (2:ℕ) = 2 * A.card := by induction A using Finset.induction with | empty => simp | insert a s ha ih => rw [sum_insert ha, ih, card_insert_of_notMem ha]; ring
The perfect matching M defines a fixed-point-free involution mate on V along graph edges, and the coloring b is constant on each mate pair.
By the perfect matching hypothesis `hperfect`, each vertex v belongs to a unique edge `me v` in M. Defining `mate v` as the other endpoint of `me v` via `Sym2.Mem.other` gives an edge s(v, mate v) in M, which is an edge in G. The matching-constant condition ensures b(mate v) = b v. Because `me(mate v) = me v`, `mate` is an involution (`mate(mate v) = v`), and `mate v` is the unique neighbor of v whose edge with v lies in M.
uses
Classical.choose,Classical.choose_spec,Sym2.Mem.other,Sym2.other_spec,Sym2.other_mem,SimpleGraph.mem_edgeFinset,SimpleGraph.mem_edgeSet,Sym2.eq_swap,Sym2.congr_rightclassical 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
Every vertex has degree 3, of which exactly 1 neighbor is its matching mate and the remaining 2 are non-matching neighbors. automation
The non-matching neighbors of v are precisely the neighbors other than `mate v`. Erasing `mate v` from the neighbor set of size 3 (since G is cubic) leaves exactly 2 non-matching neighbors, as verified by `card_erase_of_mem` and `omega`.
uses
mem_filter,mem_erase,SimpleGraph.mem_neighborFinset,SimpleGraph.neighborFinset_eq_filter,card_erase_of_mem,SimpleGraph.card_neighborFinset_eq_degreelet sameInc : V → ℕ := fun v => (univ.filter fun w : V => G.Adj v w ∧ b w = b v ∧ s(v,w) ∉ M).card let oppInc : V → ℕ := fun v => (univ.filter fun w : V => G.Adj v w ∧ b w ≠ b v ∧ s(v,w) ∉ M).card let g : V → V → ℕ := fun v w => (if (G.Adj v w ∧ s(v,w) ∉ M) then (1:ℕ) else 0) 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 [mem_filter, 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, (univ.filter fun w : V => G.Adj v w ∧ s(v,w) ∉ M).card = 2 := by intro v have h1 : (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, 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
For every vertex v, sameInc v + oppInc v = 2, and the local maximality hypothesis implies oppInc v + oppInc (mate v) ≥ 2. automation
The 2 non-matching neighbors of v partition into those with the same color (`sameInc v`) and those with the opposite color (`oppInc v`), giving sameInc v + oppInc v = 2. The local maximality hypothesis `hcut` on the matching edge s(v, mate v) asserts sameInc v + sameInc (mate v) ≤ 2. Combining these with linear arithmetic (`omega`) gives oppInc v + oppInc (mate v) ≥ 2.
uses
filter_filter,Finset.card_filter_add_card_filter_not,SimpleGraph.neighborFinset_eq_filterhave same_add_opp : ∀ v, sameInc v + oppInc v = 2 := by intro v simp only [sameInc, oppInc] let A : Finset V := univ.filter fun w : V => G.Adj v w ∧ s(v,w) ∉ M have hsame : (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, filter_filter, and_assoc, and_comm] have hopp : (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, 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
The color classes S and T are stable under mate, and any mate-stable set A satisfies |A| ≤ ∑ v ∈ A, oppInc v ≤ 2 * |A|. automation
Since b(mate v) = b v, `mate` maps S to S and T to T. Because `mate` is an involution, reindexing via `Finset.sum_nbij'` gives ∑ v ∈ A, oppInc(mate v) = ∑ v ∈ A, oppInc v. Summing the pair bound oppInc v + oppInc(mate v) ≥ 2 over A gives 2 * |A| ≤ 2 * ∑ v ∈ A, oppInc v, hence |A| ≤ ∑ v ∈ A, oppInc v. The upper bound follows since each oppInc v ≤ 2.
uses
Finset.sum_nbij',op874_locally_maximal_matching_cut_balance_sum_const_two,Finset.induction,sum_insert,card_insert_of_notMem,Finset.sum_add_distrib,Finset.sum_le_sumlet S : Finset V := univ.filter (fun v => b v = false) let T : Finset V := 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, mem_filter, 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, mem_filter, 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 ∈ A, (2:ℕ) = 2 * A.card := fun A => op874_locally_maximal_matching_cut_balance_sum_const_two A 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 [sum_insert ha, ih, 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
The sum of oppInc over S equals the sum of oppInc over T by double counting non-matching cross-edges.
Let g(v, w) indicate whether v and w are connected by a non-matching edge; g is symmetric. For v ∈ S, its opposite-color non-matching neighbors are its neighbors in T, so oppInc v = ∑ w ∈ T, g(v, w). Similarly, for w ∈ T, oppInc w = ∑ v ∈ S, g(w, v). Exchanging summation order via `Finset.sum_comm` and using the symmetry of g yields ∑ v ∈ S, oppInc v = ∑ w ∈ T, oppInc w.
uses
Sym2.eq_swap,Finset.card_filter,Finset.sum_subset,Finset.filter_subset,Finset.mem_filter,Finset.mem_univ,Finset.sum_congr,Finset.sum_commhave 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 (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 ∈ 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 (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 ∈ 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))
Each color class has cardinality at most twice the other: |S| ≤ 2 * |T| and |T| ≤ 2 * |S|.
Combining the lower bound on |S|, the cross-sum equality, and the upper bound on |T| yields |S| ≤ ∑ v ∈ S, oppInc v = ∑ w ∈ T, oppInc w ≤ 2 * |T|. Symmetrically, |T| ≤ ∑ w ∈ T, oppInc w = ∑ v ∈ S, oppInc v ≤ 2 * |S|.
constructor · calc S.card ≤ ∑ v ∈ S, oppInc v := hA_le S hSmate _ = ∑ w ∈ T, oppInc w := hcross _ ≤ 2 * T.card := hB_le T · calc T.card ≤ ∑ w ∈ T, oppInc w := hA_le T hTmate _ = ∑ v ∈ S, oppInc v := hcross.symm _ ≤ 2 * S.card := hB_le S
Finset.induction- A property holds for all finite sets if it holds for the empty set and is preserved under adjoining a new element not in the set.
sum_insert- Summing a function over a set with an element adjoined equals the value at that element plus the sum over the original set.
card_insert_of_notMem- Adjoining an element not already in a finite set increases its cardinality by 1.
Classical.choose- Given an existence proof, returns an arbitrary witness satisfying the predicate.
Classical.choose_spec- The witness chosen by Classical.choose satisfies the given predicate.
Sym2.Mem.other- Given an element belonging to an unordered pair of two elements, returns the other element.
Sym2.other_spec- An unordered pair equals the pair formed by one of its elements and its other element.
Sym2.other_mem- The other element of an unordered pair belongs to the pair.
SimpleGraph.mem_edgeFinset- An edge belongs to the finite edge set of a graph if and only if it belongs to its edge set.
SimpleGraph.mem_edgeSet- An unordered pair of vertices belongs to the edge set of a simple graph if and only if they are adjacent.
Sym2.eq_swap- Unordered pairs are symmetric: s(a, b) = s(b, a).
Sym2.congr_right- Two unordered pairs sharing a first element are equal if and only if their second elements are equal.
mem_filter- An element belongs to a filtered set if and only if it belongs to the base set and satisfies the predicate.
mem_erase- An element belongs to a set with an element removed if and only if it is not the removed element and belongs to the base set.
SimpleGraph.mem_neighborFinset- A vertex belongs to the neighbor finset of v if and only if it is adjacent to v.
SimpleGraph.neighborFinset_eq_filter- The neighbor finset of a vertex equals the set of all vertices in the graph adjacent to it.
card_erase_of_mem- Removing an element from a finite set containing it reduces its cardinality by 1.
SimpleGraph.card_neighborFinset_eq_degree- The number of vertices in the neighbor finset of v equals the degree of v.
filter_filter- Filtering a finite set by two predicates successively is equivalent to filtering by their conjunction.
Finset.card_filter_add_card_filter_not- The size of a set filtered by a predicate plus the size filtered by its negation equals the original set's cardinality.
Finset.sum_nbij'- Two finite sums are equal if there is a bijection between their index sets with an explicit two-sided inverse that preserves summands.
op874_locally_maximal_matching_cut_balance_sum_const_two- Summing the constant 2 over a finite set of natural numbers yields 2 times the set's cardinality.
Finset.sum_add_distrib- The sum of a sum of functions over a finite set is the sum of their individual sums.
Finset.sum_le_sum- If f is pointwise at most g on a finite set, then the sum of f is at most the sum of g.
Finset.card_filter- The cardinality of a filtered subset equals the sum over the set of the indicator of the filtering condition.
Finset.sum_subset- If a finite set is a subset of another and the summand vanishes outside the subset, the sums over both sets are equal.
Finset.filter_subset- Filtering a finite set produces a subset of the original set.
Finset.mem_filter- An element belongs to a filtered 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.
Finset.sum_congr- Two sums over equal sets with pointwise equal terms are equal.
Finset.sum_comm- Exchanging the order of summation in a finite double sum preserves the total sum.
- Linear integer arithmetic deductions (such as bounding neighbor counts from degrees and deducing oppInc(v) + oppInc(mate v) ≥ 2 from sameInc(v) + sameInc(mate v) ≤ 2) are closed by Lean's `omega` automation.
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
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
open Finsetprivate lemma op874_locally_maximal_matching_cut_balance_sum_const_two (A : Finset ℕ) : ∑ _v ∈ A, (2:ℕ) = 2 * A.card := by induction A using Finset.induction with | empty => simp | insert a s ha ih => rw [sum_insert ha, ih, card_insert_of_notMem ha]; ringtheorem op874_locally_maximal_matching_cut_balance {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) : (Finset.univ.filter fun v : V => b v = false).card ≤ 2 * (Finset.univ.filter fun v : V => b v = true).card ∧ (Finset.univ.filter fun v : V => b v = true).card ≤ 2 * (Finset.univ.filter fun v : V => b v = false).card := 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 => (univ.filter fun w : V => G.Adj v w ∧ b w = b v ∧ s(v,w) ∉ M).card let oppInc : V → ℕ := fun v => (univ.filter fun w : V => G.Adj v w ∧ b w ≠ b v ∧ s(v,w) ∉ M).card let g : V → V → ℕ := fun v w => (if (G.Adj v w ∧ s(v,w) ∉ M) then (1:ℕ) else 0) 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 [mem_filter, 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, (univ.filter fun w : V => G.Adj v w ∧ s(v,w) ∉ M).card = 2 := by intro v have h1 : (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, 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 := univ.filter fun w : V => G.Adj v w ∧ s(v,w) ∉ M have hsame : (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, filter_filter, and_assoc, and_comm] have hopp : (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, 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 := univ.filter (fun v => b v = false) let T : Finset V := 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, mem_filter, 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, mem_filter, 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 ∈ A, (2:ℕ) = 2 * A.card := fun A => op874_locally_maximal_matching_cut_balance_sum_const_two A 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 [sum_insert ha, ih, 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 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 (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 ∈ 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 (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 ∈ 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)) constructor · calc S.card ≤ ∑ v ∈ S, oppInc v := hA_le S hSmate _ = ∑ w ∈ T, oppInc w := hcross _ ≤ 2 * T.card := hB_le T · calc T.card ≤ ∑ w ∈ T, oppInc w := hA_le T hTmate _ = ∑ v ∈ S, oppInc v := hcross.symm _ ≤ 2 * S.card := hB_le S