balanced_cut_evenly_distributed_cross_matching_sharp
The stated separator condition supplies r crossing edges whose far endpoints meet an odd number of vertices in at most r mod 2 groups.
Statement
theorem balanced_cut_evenly_distributed_cross_matching_sharp (k r : ℕ) (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) (C U : Finset (Fin (4*k))) (hcard : C.card = 2*k) (hUC : U ⊆ C) (hU : 2*r ≤ U.card) {I : Type*} [DecidableEq I] (J : Finset I) (F : I → Finset (Fin (4*k))) (hJ : r+2 ≤ J.card) (hCH : ∀ i ∈ J, Disjoint C (F i)) (hdis : ∀ i ∈ J, ∀ j ∈ J, i ≠ j → Disjoint (F i) (F j)) (hsize : ∀ i ∈ J, 2 ≤ (F i).card) (hanti : ∀ i ∈ J, ∀ u ∈ F i, ∀ v, v ∉ C → v ∉ F i → ¬ G.Adj u v) : ∃ f g : Fin r → Fin (4*k), Function.Injective f ∧ Function.Injective g ∧ (∀ a, f a ∈ U ∧ G.Adj (f a) (g a)) ∧ (∀ a, ∃ i ∈ J, g a ∈ F i) ∧ ∃ B : Finset I, B.card ≤ r % 2 ∧ ∀ i ∈ J, i ∉ B → Even (((Finset.univ : Finset (Fin r)).image g) ∩ F i).card
- Source
- Balanced-cut parity reduction for OP-1957; https://arxiv.org/abs/2611.22690.
- Verified
- 26 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 1
- balanced_cut_anticomplete_side_has_cross_matchingA balanced 2k-vertex separator forces r disjoint crossing edges from any r vertices on the separator into an anticomplete outside shore…
- Used by 2
- balanced_cut_even_component_parity_cross_matchingIn the stated separator setting, an even number of crossing endpoints may be chosen in each specified odd-side group by sending one extra…
- extendible_balanced_cut_even_component_odd_boundUnder the displayed extendibility, separator, degree, and balanced-side matching conditions, if the opposite side has an even component…
The proof, explained
The theorem is proved by two-step induction on r. The base case r = 0 is trivial using empty maps, and r = 1 is established by matching a single edge into an arbitrary group F_j and setting B = {j}. In the induction step from r to r + 2, an auxiliary lemma extracts a 2-edge cross matching into a chosen group F_j; removing these vertices from U and index j from J allows the induction hypothesis to supply an r-edge cross matching whose parity is preserved, since F_j receives exactly 2 endpoints while all other groups retain their even counts.
The goal is generalised over U and J to proceed by two-step induction on r.
We switch to classical logic and revert the choices of U and J so they can vary with each inductive step. The claim is then proven by two-step induction on r (using Nat.twoStepInduction), which requires the base cases r = 0 and r = 1, followed by the induction step from r to r + 2.
uses
Nat.twoStepInductionset_option maxHeartbeats 4000000 in classical revert U J induction r using Nat.twoStepInduction with
The theorem holds for r = 0 with empty matching maps and B = ∅.
When r = 0, the domain Fin 0 is empty, so both f and g are chosen to be Fin.elim0. Injectivity and edge conditions hold vacuously. The exception set is taken to be B = ∅, which has cardinality 0 ≤ 0 % 2. For every group F_i, the image of g is empty, so its intersection with F_i is empty and has cardinality 0, which is even.
uses
Fin.elim0| zero => intro U hUC hU J hJ hCH hdis hsize hanti refine ⟨Fin.elim0,Fin.elim0,?_,?_,?_,?_,∅,by simp,?_⟩ · intro x exact Fin.elim0 x · intro x exact Fin.elim0 x · intro x exact Fin.elim0 x · intro x exact Fin.elim0 x · intro i hi _ simpThe theorem holds for r = 1: one edge is matched into an arbitrary group F_j, and B = {j}.
Because |J| ≥ 1 + 2 = 3 > 0, we choose an index j ∈ J via Finset.card_pos.mp. Applying balanced_cut_anticomplete_side_has_cross_matching with r = 1 provides a single crossing edge between U and F_j. We define the exception set as B = {j}, which satisfies |B| = 1 ≤ 1 % 2. For every other group F_i with i ≠ j, the mutual disjointness of F_i and F_j ensures that the image of g does not intersect F_i (using Finset.eq_empty_iff_forall_notMem.mpr, Finset.mem_inter.mp, Finset.mem_image.mp, and Finset.disjoint_left.mp), so the intersection has cardinality 0, which is even.
uses
Finset.card_pos.mp,balanced_cut_anticomplete_side_has_cross_matching,Finset.eq_empty_iff_forall_notMem.mpr,Finset.mem_inter.mp,Finset.mem_image.mp,Finset.disjoint_left.mp| one => intro U hUC hU J hJ hCH hdis hsize hanti obtain ⟨j,hj⟩ := Finset.card_pos.mp (by omega : 0 < J.card) obtain ⟨f,g,hf,hg,hfg⟩ := balanced_cut_anticomplete_side_has_cross_matching k 1 (by omega) G hsep C (F j) U hcard (hCH j hj) hUC (hanti j hj) (by omega) (by have := hsize j hj; omega) refine ⟨f,g,hf,hg,(fun a => ⟨(hfg a).1,(hfg a).2.2⟩),?_,{j},by simp,?_⟩ · intro a exact ⟨j,hj,(hfg a).2.1⟩ · intro i hi hiB have hij : i ≠ j := by simpa using hiB have hnull : ((Finset.univ : Finset (Fin 1)).image g) ∩ F i = ∅ := by apply Finset.eq_empty_iff_forall_notMem.mpr intro v hv obtain ⟨hvg,hvi⟩ := Finset.mem_inter.mp hv obtain ⟨a,_,rfl⟩ := Finset.mem_image.mp hvg exact Finset.disjoint_left.mp (hdis i hi j hj hij) hvi (hfg a).2.1 rw [hnull] simpFor the step r + 2, a 2-edge matching into one group F_j is constructed and the induction hypothesis is applied to the remaining vertices and groups.
Since |J| ≥ (r + 2) + 2 > 0, we select an index j ∈ J. We invoke balanced_cut_anticomplete_side_has_cross_matching with r = 2 to obtain an injective 2-edge matching (f_0, g_0) between U and F_j. We then remove the image A of f_0 from U to form U' = U \ A, and remove j from J to form J' = J \ {j}. Since |A| = 2 (Finset.card_image_of_injective), linear arithmetic shows |U'| ≥ 2r and |J'| ≥ r + 2 (using Finset.card_sdiff_add_card_inter, Finset.card_le_card, Finset.inter_subset_right, Finset.card_erase_add_one, and Finset.sdiff_subset). All disjointness and anticompleteness assumptions restrict from J to J' (Finset.mem_erase.mp). Applying the induction hypothesis to U' and J' yields an r-edge matching (f, g) and an exception set B ⊆ J' with |B| ≤ r % 2.
uses
Finset.card_pos.mp,balanced_cut_anticomplete_side_has_cross_matching,Finset.card_image_of_injective,Finset.sdiff_subset,Finset.card_sdiff_add_card_inter,Finset.card_le_card,Finset.inter_subset_right,Finset.card_erase_add_one,Finset.mem_erase.mp| more r ih _ => intro U hUC hU J hJ hCH hdis hsize hanti obtain ⟨j,hj⟩ := Finset.card_pos.mp (by omega : 0 < J.card) obtain ⟨f0,g0,hf0,hg0,hfg0⟩ := balanced_cut_anticomplete_side_has_cross_matching k 2 (by omega) G hsep C (F j) U hcard (hCH j hj) hUC (hanti j hj) (by omega) (hsize j hj) let A : Finset (Fin (4*k)) := (Finset.univ : Finset (Fin 2)).image f0 let U' : Finset (Fin (4*k)) := U \ A let J' : Finset I := J.erase j have hAcard : A.card = 2 := by dsimp [A] rw [Finset.card_image_of_injective _ hf0] simp have hUC' : U' ⊆ C := (Finset.sdiff_subset : U' ⊆ U).trans hUC have hU' : 2*r ≤ U'.card := by have hh := Finset.card_sdiff_add_card_inter U A have hh' : (U ∩ A).card ≤ A.card := Finset.card_le_card Finset.inter_subset_right dsimp [U'] omega have hJ' : r+2 ≤ J'.card := by have hh := Finset.card_erase_add_one hj dsimp [J'] omega have hCH' : ∀ i ∈ J', Disjoint C (F i) := by intro i hi exact hCH i (Finset.mem_erase.mp hi).2 have hdis' : ∀ i ∈ J', ∀ l ∈ J', i ≠ l → Disjoint (F i) (F l) := by intro i hi l hl hil exact hdis i (Finset.mem_erase.mp hi).2 l (Finset.mem_erase.mp hl).2 hil have hsize' : ∀ i ∈ J', 2 ≤ (F i).card := by intro i hi exact hsize i (Finset.mem_erase.mp hi).2 have hanti' : ∀ i ∈ J', ∀ u ∈ F i, ∀ v, v ∉ C → v ∉ F i → ¬ G.Adj u v := by intro i hi exact hanti i (Finset.mem_erase.mp hi).2 obtain ⟨f,g,hf,hg,hfg,hgroups,B,hB,hpar⟩ := ih U' hUC' hU' J' hJ' hCH' hdis' hsize' hanti'The r-edge matching (f, g) and the 2-edge matching (f_0, g_0) have disjoint ranges, so their concatenations ff and gg are injective.
The vertices f(a) lie in U' = U \ A, whereas f_0(b) lies in A, so their ranges are disjoint (Finset.mem_sdiff.mp, Finset.mem_image.mpr, Finset.mem_univ). Similarly, each target g(a) lies in some F_i with i ∈ J' (meaning i ≠ j), which is disjoint from F_j containing g_0(b) (Finset.mem_erase.mp, Finset.disjoint_left.mp). Concatenating f with f_0 and g with g_0 via Fin.append yields injective functions ff and gg on Fin (r + 2) by Fin.append_injective_iff.mpr.
uses
Finset.mem_sdiff.mp,Finset.mem_image.mpr,Finset.mem_univ,Finset.mem_erase.mp,Finset.disjoint_left.mp,Fin.append,Fin.append_injective_iff.mprhave hfd : ∀ a b, f a ≠ f0 b := by intro a b he have hn := (Finset.mem_sdiff.mp (hfg a).1).2 apply hn dsimp [A] exact Finset.mem_image.mpr ⟨b,Finset.mem_univ _,he.symm⟩ have hgnot : ∀ a, g a ∉ F j := by intro a hgj obtain ⟨i,hi,hgi⟩ := hgroups a have hne : i ≠ j := (Finset.mem_erase.mp hi).1 exact Finset.disjoint_left.mp (hdis i (Finset.mem_erase.mp hi).2 j hj hne) hgi hgj have hgd : ∀ a b, g a ≠ g0 b := by intro a b he exact hgnot a (he.symm ▸ (hfg0 b).2.1) let ff := Fin.append f f0 let gg := Fin.append g g0 have hff : Function.Injective ff := Fin.append_injective_iff.mpr ⟨hf,hf0,hfd⟩ have hgg : Function.Injective gg := Fin.append_injective_iff.mpr ⟨hg,hg0,hgd⟩
The combined maps (ff, gg) form valid matching edges from U into the groups F_i, and the target image is the union of the two matching images.
By case analysis on indices in Fin (r + 2) using Fin.addCases, each pair (ff(a), gg(a)) comes either from (f, g) or from (f_0, g_0). In both cases, ff(a) belongs to U, ff(a) is adjacent to gg(a), and gg(a) lies in some group F_i with i ∈ J (Finset.mem_sdiff.mp, Finset.mem_erase.mp). Furthermore, using canonical embeddings Fin.castAdd and Fin.natAdd, the image of gg is proven to be the union of the images of g and g_0 (Finset.mem_image, Finset.mem_univ, true_and, Finset.mem_union).
uses
Fin.addCases,Finset.mem_sdiff.mp,Finset.mem_erase.mp,Finset.mem_image,Finset.mem_univ,true_and,Finset.mem_union,Fin.castAdd,Fin.natAddhave hboth : ∀ a, ff a ∈ U ∧ G.Adj (ff a) (gg a) := by intro a refine Fin.addCases ?_ ?_ a · intro b simpa [ff,gg] using ⟨(Finset.mem_sdiff.mp (hfg b).1).1,(hfg b).2⟩ · intro b simpa [ff,gg] using ⟨(hfg0 b).1,(hfg0 b).2.2⟩ have hwhere : ∀ a, ∃ i ∈ J, gg a ∈ F i := by intro a refine Fin.addCases ?_ ?_ a · intro b obtain ⟨i,hi,hgi⟩ := hgroups b exact ⟨i,(Finset.mem_erase.mp hi).2,by simpa [gg] using hgi⟩ · intro b exact ⟨j,hj,by simpa [gg] using (hfg0 b).2.1⟩ have himage : ((Finset.univ : Finset (Fin (r+2))).image gg) = ((Finset.univ : Finset (Fin r)).image g) ∪ ((Finset.univ : Finset (Fin 2)).image g0) := by ext v simp only [Finset.mem_image,Finset.mem_univ,true_and,Finset.mem_union] constructor · rintro ⟨a,ha⟩ cases a using Fin.addCases with | left b => left exact ⟨b,by simpa [gg] using ha⟩ | right b => right exact ⟨b,by simpa [gg] using ha⟩ · rintro (⟨b,hb⟩ | ⟨b,hb⟩) · exact ⟨Fin.castAdd 2 b,by simpa [gg] using hb⟩ · exact ⟨Fin.natAdd r b,by simpa [gg] using hb⟩
The exceptional set B satisfies |B| ≤ (r + 2) % 2, and every group outside B contains an even number of endpoints of gg.
Since (r + 2) % 2 = r % 2, the induction hypothesis bound |B| ≤ r % 2 directly gives |B| ≤ (r + 2) % 2. For any index i ∈ J \ B, we split into cases i = j and i ≠ j. If i = j, the image of g is disjoint from F_j, so the intersection with F_j is precisely the image of g_0, which has cardinality 2 (Finset.card_image_of_injective), an even number. If i ≠ j, then i ∈ J' \ B, and the image of g_0 ⊆ F_j is disjoint from F_i, so the intersection with F_i is just the intersection of the image of g with F_i, which is even by the induction hypothesis (Finset.disjoint_left.mpr, Finset.mem_image.mp, Finset.mem_inter, Finset.mem_union, False.elim, Finset.disjoint_left.mp, Or.inr, Finset.mem_erase.mpr, Or.inl).
uses
Finset.disjoint_left.mpr,Finset.mem_image.mp,Finset.mem_inter,Finset.mem_union,False.elim,Finset.disjoint_left.mp,Or.inr,Finset.card_image_of_injective,Finset.mem_erase.mpr,Or.inlrefine ⟨ff,gg,hff,hgg,hboth,hwhere,B,?_,?_⟩ · omega intro i hi hiB rw [himage] by_cases hij : i = j · subst i have hzero : Disjoint ((Finset.univ : Finset (Fin r)).image g) (F j) := by apply Finset.disjoint_left.mpr intro v hvg hvj obtain ⟨a,_,rfl⟩ := Finset.mem_image.mp hvg exact hgnot a hvj have hsub : ((Finset.univ : Finset (Fin 2)).image g0) ⊆ F j := by intro v hv obtain ⟨a,_,rfl⟩ := Finset.mem_image.mp hv exact (hfg0 a).2.1 have heq : (((Finset.univ : Finset (Fin r)).image g) ∪ ((Finset.univ : Finset (Fin 2)).image g0)) ∩ F j = ((Finset.univ : Finset (Fin 2)).image g0) := by ext v simp only [Finset.mem_inter,Finset.mem_union] constructor · rintro ⟨hv | hv,hvj⟩ · exact False.elim (Finset.disjoint_left.mp hzero hv hvj) · exact hv · intro hv exact ⟨Or.inr hv,hsub hv⟩ rw [heq,Finset.card_image_of_injective _ hg0] simp · have hi' : i ∈ J' := Finset.mem_erase.mpr ⟨hij,hi⟩ have hzero : Disjoint ((Finset.univ : Finset (Fin 2)).image g0) (F i) := by apply Finset.disjoint_left.mpr intro v hvg hvi obtain ⟨a,_,rfl⟩ := Finset.mem_image.mp hvg exact Finset.disjoint_left.mp (hdis i hi j hj hij) hvi (hfg0 a).2.1 have heq : (((Finset.univ : Finset (Fin r)).image g) ∪ ((Finset.univ : Finset (Fin 2)).image g0)) ∩ F i = ((Finset.univ : Finset (Fin r)).image g) ∩ F i := by ext v simp only [Finset.mem_inter,Finset.mem_union] constructor · rintro ⟨hv | hv,hvi⟩ · exact ⟨hv,hvi⟩ · exact False.elim (Finset.disjoint_left.mp hzero hv hvi) · rintro ⟨hv,hvi⟩ exact ⟨Or.inl hv,hvi⟩ rw [heq] exact hpar i hi' hiB
Fin.elim0- The unique empty function from the empty type Fin 0
Fin.addCases- Case analysis for elements of Fin (m + n), splitting into the left segment Fin m and the right segment Fin n
Fin.append- Concatenation of two functions with domains Fin m and Fin n into a function with domain Fin (m + n)
Fin.append_injective_iff.mpr- If two functions are injective and have disjoint ranges, their concatenation is injective
Fin.castAdd- Canonical embedding of Fin n into Fin (n + m) as the initial segment
Fin.natAdd- Canonical embedding of Fin m into Fin (n + m) as the right segment shifted by n
Nat.twoStepInduction- Two-step mathematical induction on ℕ: proving a property for all n from the base cases 0 and 1 and the induction step n → n + 2
Finset.card_pos.mp- A finite set has positive cardinality if and only if it is nonempty
Finset.card_erase_add_one- Removing an element present in a finite set decreases its cardinality by 1
Finset.card_image_of_injective- The image of a finite set under an injective function has the same cardinality as the domain set
Finset.card_le_card- If one finite set is a subset of another, its cardinality is less than or equal to that of the other
Finset.card_sdiff_add_card_inter- For finite sets s and t, |s \ t| + |s ∩ t| = |s|
Finset.disjoint_left.mp- If two sets are disjoint, an element belonging to the first cannot belong to the second
Finset.disjoint_left.mpr- If no element of s belongs to t, then s and t are disjoint
Finset.eq_empty_iff_forall_notMem.mpr- A finite set is empty if no element belongs to it
Finset.inter_subset_right- The intersection s ∩ t is a subset of t
Finset.mem_image- Characterisation of membership in the image of a finite set under a function
Finset.mem_image.mp- An element in the image of a set under a function is the value of the function at some element of that set
Finset.mem_image.mpr- An element that is the value of a function at an element of s belongs to the image of s
Finset.mem_erase.mp- An element in s.erase a belongs to s and is distinct from a
Finset.mem_erase.mpr- An element belonging to s that is distinct from a belongs to s.erase a
Finset.mem_inter- Characterisation of membership in the intersection of two sets
Finset.mem_inter.mp- An element in the intersection of two sets belongs to both sets
Finset.mem_sdiff.mp- An element in the set difference s \ t belongs to s and does not belong to t
Finset.mem_union- Characterisation of membership in the union of two sets
Finset.mem_univ- Every element of a finite type belongs to Finset.univ
Finset.sdiff_subset- The set difference s \ t is a subset of s
balanced_cut_anticomplete_side_has_cross_matching- Under the balanced separator condition, if C has size 2k, H is disjoint from C and anticomplete to the rest of the graph, and |U|, |H| ≥ r, there exists an r-edge matching between U ⊆ C and H
False.elim- From False, any proposition follows (principle of explosion)
Or.inl- Disjunction introduction: if a holds, then a ∨ b holds
Or.inr- Disjunction introduction: if b holds, then a ∨ b holds
true_and- Simplification rule that True ∧ p is equivalent to p
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.
theorem balanced_cut_evenly_distributed_cross_matching_sharp (k r : ℕ) (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) (C U : Finset (Fin (4*k))) (hcard : C.card = 2*k) (hUC : U ⊆ C) (hU : 2*r ≤ U.card) {I : Type*} [DecidableEq I] (J : Finset I) (F : I → Finset (Fin (4*k))) (hJ : r+2 ≤ J.card) (hCH : ∀ i ∈ J, Disjoint C (F i)) (hdis : ∀ i ∈ J, ∀ j ∈ J, i ≠ j → Disjoint (F i) (F j)) (hsize : ∀ i ∈ J, 2 ≤ (F i).card) (hanti : ∀ i ∈ J, ∀ u ∈ F i, ∀ v, v ∉ C → v ∉ F i → ¬ G.Adj u v) : ∃ f g : Fin r → Fin (4*k), Function.Injective f ∧ Function.Injective g ∧ (∀ a, f a ∈ U ∧ G.Adj (f a) (g a)) ∧ (∀ a, ∃ i ∈ J, g a ∈ F i) ∧ ∃ B : Finset I, B.card ≤ r % 2 ∧ ∀ i ∈ J, i ∉ B → Even (((Finset.univ : Finset (Fin r)).image g) ∩ F i).card := by set_option maxHeartbeats 4000000 in classical revert U J induction r using Nat.twoStepInduction with | zero => intro U hUC hU J hJ hCH hdis hsize hanti refine ⟨Fin.elim0,Fin.elim0,?_,?_,?_,?_,∅,by simp,?_⟩ · intro x exact Fin.elim0 x · intro x exact Fin.elim0 x · intro x exact Fin.elim0 x · intro x exact Fin.elim0 x · intro i hi _ simp | one => intro U hUC hU J hJ hCH hdis hsize hanti obtain ⟨j,hj⟩ := Finset.card_pos.mp (by omega : 0 < J.card) obtain ⟨f,g,hf,hg,hfg⟩ := balanced_cut_anticomplete_side_has_cross_matching k 1 (by omega) G hsep C (F j) U hcard (hCH j hj) hUC (hanti j hj) (by omega) (by have := hsize j hj; omega) refine ⟨f,g,hf,hg,(fun a => ⟨(hfg a).1,(hfg a).2.2⟩),?_,{j},by simp,?_⟩ · intro a exact ⟨j,hj,(hfg a).2.1⟩ · intro i hi hiB have hij : i ≠ j := by simpa using hiB have hnull : ((Finset.univ : Finset (Fin 1)).image g) ∩ F i = ∅ := by apply Finset.eq_empty_iff_forall_notMem.mpr intro v hv obtain ⟨hvg,hvi⟩ := Finset.mem_inter.mp hv obtain ⟨a,_,rfl⟩ := Finset.mem_image.mp hvg exact Finset.disjoint_left.mp (hdis i hi j hj hij) hvi (hfg a).2.1 rw [hnull] simp | more r ih _ => intro U hUC hU J hJ hCH hdis hsize hanti obtain ⟨j,hj⟩ := Finset.card_pos.mp (by omega : 0 < J.card) obtain ⟨f0,g0,hf0,hg0,hfg0⟩ := balanced_cut_anticomplete_side_has_cross_matching k 2 (by omega) G hsep C (F j) U hcard (hCH j hj) hUC (hanti j hj) (by omega) (hsize j hj) let A : Finset (Fin (4*k)) := (Finset.univ : Finset (Fin 2)).image f0 let U' : Finset (Fin (4*k)) := U \ A let J' : Finset I := J.erase j have hAcard : A.card = 2 := by dsimp [A] rw [Finset.card_image_of_injective _ hf0] simp have hUC' : U' ⊆ C := (Finset.sdiff_subset : U' ⊆ U).trans hUC have hU' : 2*r ≤ U'.card := by have hh := Finset.card_sdiff_add_card_inter U A have hh' : (U ∩ A).card ≤ A.card := Finset.card_le_card Finset.inter_subset_right dsimp [U'] omega have hJ' : r+2 ≤ J'.card := by have hh := Finset.card_erase_add_one hj dsimp [J'] omega have hCH' : ∀ i ∈ J', Disjoint C (F i) := by intro i hi exact hCH i (Finset.mem_erase.mp hi).2 have hdis' : ∀ i ∈ J', ∀ l ∈ J', i ≠ l → Disjoint (F i) (F l) := by intro i hi l hl hil exact hdis i (Finset.mem_erase.mp hi).2 l (Finset.mem_erase.mp hl).2 hil have hsize' : ∀ i ∈ J', 2 ≤ (F i).card := by intro i hi exact hsize i (Finset.mem_erase.mp hi).2 have hanti' : ∀ i ∈ J', ∀ u ∈ F i, ∀ v, v ∉ C → v ∉ F i → ¬ G.Adj u v := by intro i hi exact hanti i (Finset.mem_erase.mp hi).2 obtain ⟨f,g,hf,hg,hfg,hgroups,B,hB,hpar⟩ := ih U' hUC' hU' J' hJ' hCH' hdis' hsize' hanti' have hfd : ∀ a b, f a ≠ f0 b := by intro a b he have hn := (Finset.mem_sdiff.mp (hfg a).1).2 apply hn dsimp [A] exact Finset.mem_image.mpr ⟨b,Finset.mem_univ _,he.symm⟩ have hgnot : ∀ a, g a ∉ F j := by intro a hgj obtain ⟨i,hi,hgi⟩ := hgroups a have hne : i ≠ j := (Finset.mem_erase.mp hi).1 exact Finset.disjoint_left.mp (hdis i (Finset.mem_erase.mp hi).2 j hj hne) hgi hgj have hgd : ∀ a b, g a ≠ g0 b := by intro a b he exact hgnot a (he.symm ▸ (hfg0 b).2.1) let ff := Fin.append f f0 let gg := Fin.append g g0 have hff : Function.Injective ff := Fin.append_injective_iff.mpr ⟨hf,hf0,hfd⟩ have hgg : Function.Injective gg := Fin.append_injective_iff.mpr ⟨hg,hg0,hgd⟩ have hboth : ∀ a, ff a ∈ U ∧ G.Adj (ff a) (gg a) := by intro a refine Fin.addCases ?_ ?_ a · intro b simpa [ff,gg] using ⟨(Finset.mem_sdiff.mp (hfg b).1).1,(hfg b).2⟩ · intro b simpa [ff,gg] using ⟨(hfg0 b).1,(hfg0 b).2.2⟩ have hwhere : ∀ a, ∃ i ∈ J, gg a ∈ F i := by intro a refine Fin.addCases ?_ ?_ a · intro b obtain ⟨i,hi,hgi⟩ := hgroups b exact ⟨i,(Finset.mem_erase.mp hi).2,by simpa [gg] using hgi⟩ · intro b exact ⟨j,hj,by simpa [gg] using (hfg0 b).2.1⟩ have himage : ((Finset.univ : Finset (Fin (r+2))).image gg) = ((Finset.univ : Finset (Fin r)).image g) ∪ ((Finset.univ : Finset (Fin 2)).image g0) := by ext v simp only [Finset.mem_image,Finset.mem_univ,true_and,Finset.mem_union] constructor · rintro ⟨a,ha⟩ cases a using Fin.addCases with | left b => left exact ⟨b,by simpa [gg] using ha⟩ | right b => right exact ⟨b,by simpa [gg] using ha⟩ · rintro (⟨b,hb⟩ | ⟨b,hb⟩) · exact ⟨Fin.castAdd 2 b,by simpa [gg] using hb⟩ · exact ⟨Fin.natAdd r b,by simpa [gg] using hb⟩ refine ⟨ff,gg,hff,hgg,hboth,hwhere,B,?_,?_⟩ · omega intro i hi hiB rw [himage] by_cases hij : i = j · subst i have hzero : Disjoint ((Finset.univ : Finset (Fin r)).image g) (F j) := by apply Finset.disjoint_left.mpr intro v hvg hvj obtain ⟨a,_,rfl⟩ := Finset.mem_image.mp hvg exact hgnot a hvj have hsub : ((Finset.univ : Finset (Fin 2)).image g0) ⊆ F j := by intro v hv obtain ⟨a,_,rfl⟩ := Finset.mem_image.mp hv exact (hfg0 a).2.1 have heq : (((Finset.univ : Finset (Fin r)).image g) ∪ ((Finset.univ : Finset (Fin 2)).image g0)) ∩ F j = ((Finset.univ : Finset (Fin 2)).image g0) := by ext v simp only [Finset.mem_inter,Finset.mem_union] constructor · rintro ⟨hv | hv,hvj⟩ · exact False.elim (Finset.disjoint_left.mp hzero hv hvj) · exact hv · intro hv exact ⟨Or.inr hv,hsub hv⟩ rw [heq,Finset.card_image_of_injective _ hg0] simp · have hi' : i ∈ J' := Finset.mem_erase.mpr ⟨hij,hi⟩ have hzero : Disjoint ((Finset.univ : Finset (Fin 2)).image g0) (F i) := by apply Finset.disjoint_left.mpr intro v hvg hvi obtain ⟨a,_,rfl⟩ := Finset.mem_image.mp hvg exact Finset.disjoint_left.mp (hdis i hi j hj hij) hvi (hfg0 a).2.1 have heq : (((Finset.univ : Finset (Fin r)).image g) ∪ ((Finset.univ : Finset (Fin 2)).image g0)) ∩ F i = ((Finset.univ : Finset (Fin r)).image g) ∩ F i := by ext v simp only [Finset.mem_inter,Finset.mem_union] constructor · rintro ⟨hv | hv,hvi⟩ · exact ⟨hv,hvi⟩ · exact False.elim (Finset.disjoint_left.mp hzero hv hvi) · rintro ⟨hv,hvi⟩ exact ⟨Or.inl hv,hvi⟩ rw [heq] exact hpar i hi' hiB