forced_matching_edge_barrier_partition_with_odd_endpoints
A matched forced edge with an alternate path has the displayed positive barrier and anticomplete component partition, with both endpoint components of odd cardinality.
Statement
theorem forced_matching_edge_barrier_partition_with_odd_endpoints {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (u v : V) (huv : G.Adj u v) (hP : ∃ P : G.Subgraph, P.IsPerfectMatching) (hforced : ¬ ∃ P : (G.deleteEdges {s(u,v)}).Subgraph, P.IsPerfectMatching) (hpath : (G.deleteEdges {s(u,v)}).Reachable u v) : ∃ S X Y U : Finset V, S.Nonempty ∧ Disjoint S X ∧ Disjoint S Y ∧ Disjoint S U ∧ Disjoint X Y ∧ Disjoint X U ∧ Disjoint Y U ∧ S ∪ X ∪ Y ∪ U = Finset.univ ∧ u ∈ X ∧ v ∈ Y ∧ (∀ x ∈ X, ∀ y ∈ Y, G.Adj x y → x = u ∧ y = v) ∧ (∀ w ∈ U, ∀ z ∈ X ∪ Y, ¬ G.Adj w z) ∧ S.card ≤ (G.induce {a | a ∈ U}).oddComponents.ncard ∧ Odd X.card ∧ Odd Y.card
- Source
- OP-1957: expose endpoint parity from the existing Tutte-barrier proof.
- Verified
- 24 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 4
- forced_matching_edge_barrier_component_partitionA perfect-matchable finite graph with a forced edge that has an alternate path admits the displayed nonempty barrier and component…
- cFor a group $G$ and an element $s \in G$, the local count $c_G(s)$ is the cardinality of the set of elements $g \in G$ such that…
- suppThe support $\mathrm{supp}(v) \subseteq \mathrm{Fin}\,n$ consists of coordinates where either component of $v$ is nonzero; the…
- FThe prime field $\mathrm{GF}(p)$, realized as $\mathbb{Z}/p\mathbb{Z}$ via
ZMod.
- Used by 2
- forced_matching_edge_barrier_partition_all_casesA forced matching edge admits the stated barrier partition with odd endpoint shores, whether or not deleting it leaves the endpoints…
- boundary_five_odd_blocks_one_defect_essential_edge_forces_twoFor an odd c with 5≤c≤k, consider the explicitly displayed order-4k four-block partition with |A|=5, |C|=c, factor-critical B, minimum…
The proof, explained
To construct the required barrier partition with odd endpoint components for a forced edge uv, the proof first invokes an existing partition theorem to obtain sets S, X, Y, U covering V where uv is the unique edge between X and Y, U is anticomplete to X ∪ Y, and |S| is bounded by the number of odd components of G[U]. The forced edge uv must belong to any perfect matching P, and a counting argument on odd components shows that P matches every vertex of S into U, preventing P from having any edges between S and X ∪ Y. Consequently, uv is the unique edge of P leaving X and leaving Y, which implies by a matching parity argument that both X and Y have odd cardinality.
Define the induced subgraph on U and its canonical inclusion into V.
We restrict attention to the induced subgraph G[U] and observe that the inclusion map from U into V is injective.
classical set GU := G.induce {v | v ∈ U} with hGU let ι : ↥{v | v ∈ U} → V := Subtype.val have hι : Function.Injective ι := Subtype.val_injective
Every odd component of G[U] has a vertex matched to some vertex in S.
Suppose, for contradiction, that some odd component c of G[U] had no matching edge into S. Since U has no edges to vertices outside U ∪ S, all matching edges incident to c would have to stay within c, making the restricted matching a perfect matching on c. But any graph admitting a matching has an even number of vertices, contradicting that c has an odd number of vertices.
have hkey : ∀ c ∈ GU.oddComponents, ∃ b : V, b ∈ S ∧ ∃ a ∈ c.supp, P.Adj (ι a) b := by intro c hc by_contra hno push Not at hno let C : Set V := ι '' c.supp have hmatch : (P.induce C).IsMatching := by intro x hx obtain ⟨a', ha', rfl⟩ := hx obtain ⟨b, hab, huniq⟩ := hP.1 (hP.2 (ι a')) have hGab : G.Adj a'.1 b := P.adj_sub hab have hbU : b ∈ U := by by_contra hbU by_cases hbS : b ∈ S · exact hno b hbS a' ha' hab · exact hanti a'.1 a'.2 b hbU hbS hGab let b' : ↥{v | v ∈ U} := ⟨b,hbU⟩ have hGUadj : GU.Adj a' b' := by simpa [GU] using hGab have hbc : b' ∈ c.supp := by rw [SimpleGraph.ConnectedComponent.mem_supp_iff] at ha' ⊢ rw [← ha'] exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hGUadj).symm have hbι : ι b' = b := rfl refine ⟨b, ⟨⟨a',ha',rfl⟩, ⟨b',hbc,hbι⟩, hab⟩, fun y hy => huniq y hy.2.2⟩ have hfin : Fintype (P.induce C).verts := Fintype.ofFinite _ have he := hmatch.even_card rw [← Set.ncard_eq_toFinset_card'] at he have hC : (P.induce C).verts.ncard = c.supp.ncard := by show C.ncard = _ exact Set.ncard_image_of_injective _ hι rw [hC] at he exact (Nat.not_even_iff_odd.mpr hc) he
The assignment mapping each odd component of G[U] to its matched vertex in S is injective.
Since P is a matching, a single vertex in S cannot be matched to vertices in two distinct connected components of G[U].
let f : GU.oddComponents → {v : V // v ∈ S} := fun c => ⟨(hkey c.val c.property).choose, (hkey c.val c.property).choose_spec.1⟩ have hinj : Function.Injective f := by intro c1 c2 heq obtain ⟨_, a1, ha1, hm1⟩ := (hkey c1.val c1.property).choose_spec obtain ⟨_, a2, ha2, hm2⟩ := (hkey c2.val c2.property).choose_spec have e : (hkey c1.val c1.property).choose = (hkey c2.val c2.property).choose := by exact congrArg Subtype.val heq rw [e] at hm1 have hw : (hkey c2.val c2.property).choose ∈ P.verts := P.edge_vert hm1.symm have h12 : ι a1 = ι a2 := (hP.1 hw).unique hm1.symm hm2.symm have ha : a1 = a2 := hι h12 apply Subtype.ext rw [SimpleGraph.ConnectedComponent.mem_supp_iff] at ha1 ha2 rw [← ha1,← ha2,ha]
The assignment from odd components of G[U] to S is surjective.
Since the number of odd components of G[U] is at least the size of S, an injective map from odd components into S must also be surjective by the pigeonhole principle.
have hcard : Fintype.card {v : V // v ∈ S} ≤ Fintype.card GU.oddComponents := by have hc : GU.oddComponents.ncard = Fintype.card GU.oddComponents := by rw [Set.ncard_eq_toFinset_card', Set.toFinset_card] simpa only [Fintype.card_coe, ← hc] using hodd have hsurj : Function.Surjective f := by have hle := Fintype.card_le_of_injective f hinj exact ((Fintype.bijective_iff_injective_and_card f).2 ⟨hinj, Nat.le_antisymm hle hcard⟩).2
Every vertex in S is matched by P to some vertex in U.
By surjectivity, any s ∈ S is in the image of the assignment, hence is matched to a vertex in some odd component of G[U], which is a subset of U.
intro s hs obtain ⟨c,hc⟩ := hsurj ⟨s,hs⟩ obtain ⟨_,u,hu,hPu⟩ := (hkey c.val c.property).choose_spec have heq : (hkey c.val c.property).choose = s := congrArg Subtype.val hc exact ⟨u.val,u.property,heq ▸ hPu.symm⟩
The matching P restricts to a matching on X \ {x}.
For any vertex a ∈ X \ {x}, its matching partner b cannot be x (since x is matched to y ∉ X), and cannot lie outside X (since the only edge of P leaving X is from x to y). Thus b ∈ X \ {x}.
classical let F : Finset V := X.erase x let C : Set V := F have hmatch : (P.induce C).IsMatching := by intro a ha have haF : a ∈ F := ha have haX : a ∈ X := (Finset.mem_erase.mp haF).2 have hax : a ≠ x := (Finset.mem_erase.mp haF).1 obtain ⟨b,hab,huniq⟩ := hP.1 (hP.2 a) have hbx : b ≠ x := by intro he subst b have hay : a = y := (hP.1 (hP.2 x)).unique hab.symm hxy exact hy (hay ▸ haX) have hbX : b ∈ X := by by_contra hbX exact hax (hclosed a haX b hab hbX).1 have hbF : b ∈ F := Finset.mem_erase.mpr ⟨hbx,hbX⟩ refine ⟨b,⟨haF,hbF,hab⟩,?_⟩ intro z hz exact huniq z hz.2.2
The cardinality of X is odd.
Because P induces a matching on X \ {x}, the set X \ {x} has even cardinality. Since X is formed by adding x back to X \ {x}, its cardinality is even plus one, hence odd. Linear arithmetic closes the goal.
have he := hmatch.even_card rw [← Set.ncard_eq_toFinset_card'] at he have hF : (P.induce C).verts.ncard = F.card := by show C.ncard = _ simp [C] rw [hF] at he have hcard : F.card + 1 = X.card := Finset.card_erase_add_one hx obtain ⟨n,hn⟩ := he apply Nat.odd_iff.mpr omega
A barrier partition exists satisfying all conditions except possibly the parity of the endpoint components.
We invoke the prior theorem forced_matching_edge_barrier_component_partition on G, u, and v to obtain a nonempty set S and pairwise disjoint sets S, X, Y, U covering the vertex set, with u ∈ X, v ∈ Y, no edges between X and Y other than uv, U anticomplete to X ∪ Y, and |S| at most the number of odd components of G[U].
classical obtain ⟨P,hP⟩ := hP obtain ⟨S,X,Y,U,hSne,hSX,hSY,hSU,hXY,hXU,hYU,hcover,huX,hvY,hcross,hanti,hoddU⟩ := forced_matching_edge_barrier_component_partition G u v huv ⟨P,hP⟩ hforced hpath
The forced edge uv is an edge of the matching P.
If P did not contain the edge uv, then P would be a perfect matching in G with the edge uv deleted, contradicting that uv is forced.
have hPuv : P.Adj u v := by by_contra hnot have hsub : ∀ a b, P.Adj a b → (G.deleteEdges {s(u,v)}).Adj a b := by intro a b hab apply SimpleGraph.deleteEdges_adj.mpr refine ⟨P.adj_sub hab, ?_⟩ simp only [Set.mem_singleton_iff,not_false_eq_true] intro he rcases Sym2.eq_iff.mp he with ⟨ha,hb⟩ | ⟨ha,hb⟩ · exact hnot (ha ▸ hb ▸ hab) · exact hnot (hb ▸ ha ▸ hab.symm) let Q : (G.deleteEdges {s(u,v)}).Subgraph := ⟨P.verts,P.Adj,(fun {a b} hab => hsub a b hab),P.edge_vert,P.symm⟩ have hQ : Q.IsPerfectMatching := ⟨hP.1,hP.2⟩ exact hforced ⟨Q,hQ⟩
Every vertex in S is matched by P to some vertex in U.
Since S, X, Y, U cover the graph and U has no edges to X ∪ Y, any edge from U to the complement of U must enter S. Applying the reservoir lemma in1158_odd_reservoir_local, every vertex in S has a matching partner in U.
have hUanti : ∀ w ∈ U, ∀ z, z ∉ U → z ∉ S → ¬ G.Adj w z := by intro w hw z hzU hzS have hz : z ∈ S ∪ X ∪ Y ∪ U := by rw [hcover]; exact Finset.mem_univ z simp only [Finset.mem_union] at hz have hzXY : z ∈ X ∪ Y := by simp only [Finset.mem_union] rcases hz with ((hz|hz)|hz)|hz · exact False.elim (hzS hz) · exact Or.inl hz · exact Or.inr hz · exact False.elim (hzU hz) exact hanti w hw z hzXY have hres : ∀ s ∈ S, ∃ w ∈ U, P.Adj s w := in1158_odd_reservoir_local G P hP S U hSU hUanti hoddU
No vertex in X ∪ Y is matched by P to any vertex in S.
If some vertex in X ∪ Y were matched to b ∈ S, then since b is already matched to some vertex in U and matching partners are unique, that vertex in X ∪ Y would have to equal the partner in U, which contradicts the disjointness of X and Y from U.
have hnotS : ∀ a ∈ X ∪ Y, ∀ b ∈ S, P.Adj a b → False := by intro a ha b hb hab obtain ⟨w,hw,hbw⟩ := hres b hb have haw : a=w := (hP.1 (hP.2 b)).unique hab.symm hbw rcases Finset.mem_union.mp ha with haX|haY · exact Finset.disjoint_left.mp hXU haX (haw ▸ hw) · exact Finset.disjoint_left.mp hYU haY (haw ▸ hw) have hpart (b : V) : b ∈ S ∨ b ∈ X ∨ b ∈ Y ∨ b ∈ U := by have hh : b ∈ S ∪ X ∪ Y ∪ U := by rw [hcover]; exact Finset.mem_univ b simpa only [Finset.mem_union,or_assoc] using hh
The edge uv is the only edge of P leaving X.
For any a ∈ X and any partner b matched to a with b ∉ X, b cannot be in S or U by the previous steps. Hence b must lie in Y. But the only edge between X and Y in the graph is uv, so a = u and b = v.
have hclosedX : ∀ a ∈ X, ∀ b, P.Adj a b → b ∉ X → a=u ∧ b=v := by intro a ha b hab hbX rcases hpart b with hbS|hbX'|hbY|hbU · exact False.elim (hnotS a (Finset.mem_union_left _ ha) b hbS hab) · exact False.elim (hbX hbX') · exact hcross a ha b hbY (P.adj_sub hab) · exact False.elim (hanti b hbU a (Finset.mem_union_left _ ha) (P.adj_sub hab).symm)
The edge vu is the only edge of P leaving Y.
Symmetrically, any partner b ∉ Y of a vertex a ∈ Y cannot lie in S or U, and must therefore lie in X, forcing a = v and b = u.
have hclosedY : ∀ a ∈ Y, ∀ b, P.Adj a b → b ∉ Y → a=v ∧ b=u := by intro a ha b hab hbY rcases hpart b with hbS|hbX|hbY'|hbU · exact False.elim (hnotS a (Finset.mem_union_right _ ha) b hbS hab) · have hh := hcross b hbX a ha (P.adj_sub hab).symm exact ⟨hh.2,hh.1⟩ · exact False.elim (hbY hbY') · exact False.elim (hanti b hbU a (Finset.mem_union_right _ ha) (P.adj_sub hab).symm)
Both X and Y have odd cardinality, completing the proof of the barrier partition theorem.
Applying the single-exit lemma in1158_single_exit_local to X with exit edge uv and to Y with exit edge vu proves that both |X| and |Y| are odd, completing the existence of the barrier partition.
have hnotvX : v ∉ X := fun h => Finset.disjoint_left.mp hXY h hvY have hnotuY : u ∉ Y := fun h => Finset.disjoint_left.mp hXY huX h have hoddX := in1158_single_exit_local G P hP X u v huX hnotvX hPuv hclosedX have hoddY := in1158_single_exit_local G P hP Y v u hvY hnotuY hPuv.symm hclosedY exact ⟨S,X,Y,U,hSne,hSX,hSY,hSU,hXY,hXU,hYU,hcover,huX,hvY,hcross,hanti,hoddU,hoddX,hoddY⟩
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.
set_option maxHeartbeats 3000000theorem in1158_odd_reservoir_local {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (P : G.Subgraph) (hP : P.IsPerfectMatching) (S U : Finset V) (hSU : Disjoint S U) (hanti : ∀ u ∈ U, ∀ v, v ∉ U → v ∉ S → ¬ G.Adj u v) (hodd : S.card ≤ (G.induce {v | v ∈ U}).oddComponents.ncard) : ∀ s ∈ S, ∃ u ∈ U, P.Adj s u := by classical set GU := G.induce {v | v ∈ U} with hGU let ι : ↥{v | v ∈ U} → V := Subtype.val have hι : Function.Injective ι := Subtype.val_injective have hkey : ∀ c ∈ GU.oddComponents, ∃ b : V, b ∈ S ∧ ∃ a ∈ c.supp, P.Adj (ι a) b := by intro c hc by_contra hno push Not at hno let C : Set V := ι '' c.supp have hmatch : (P.induce C).IsMatching := by intro x hx obtain ⟨a', ha', rfl⟩ := hx obtain ⟨b, hab, huniq⟩ := hP.1 (hP.2 (ι a')) have hGab : G.Adj a'.1 b := P.adj_sub hab have hbU : b ∈ U := by by_contra hbU by_cases hbS : b ∈ S · exact hno b hbS a' ha' hab · exact hanti a'.1 a'.2 b hbU hbS hGab let b' : ↥{v | v ∈ U} := ⟨b,hbU⟩ have hGUadj : GU.Adj a' b' := by simpa [GU] using hGab have hbc : b' ∈ c.supp := by rw [SimpleGraph.ConnectedComponent.mem_supp_iff] at ha' ⊢ rw [← ha'] exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hGUadj).symm have hbι : ι b' = b := rfl refine ⟨b, ⟨⟨a',ha',rfl⟩, ⟨b',hbc,hbι⟩, hab⟩, fun y hy => huniq y hy.2.2⟩ have hfin : Fintype (P.induce C).verts := Fintype.ofFinite _ have he := hmatch.even_card rw [← Set.ncard_eq_toFinset_card'] at he have hC : (P.induce C).verts.ncard = c.supp.ncard := by show C.ncard = _ exact Set.ncard_image_of_injective _ hι rw [hC] at he exact (Nat.not_even_iff_odd.mpr hc) he let f : GU.oddComponents → {v : V // v ∈ S} := fun c => ⟨(hkey c.val c.property).choose, (hkey c.val c.property).choose_spec.1⟩ have hinj : Function.Injective f := by intro c1 c2 heq obtain ⟨_, a1, ha1, hm1⟩ := (hkey c1.val c1.property).choose_spec obtain ⟨_, a2, ha2, hm2⟩ := (hkey c2.val c2.property).choose_spec have e : (hkey c1.val c1.property).choose = (hkey c2.val c2.property).choose := by exact congrArg Subtype.val heq rw [e] at hm1 have hw : (hkey c2.val c2.property).choose ∈ P.verts := P.edge_vert hm1.symm have h12 : ι a1 = ι a2 := (hP.1 hw).unique hm1.symm hm2.symm have ha : a1 = a2 := hι h12 apply Subtype.ext rw [SimpleGraph.ConnectedComponent.mem_supp_iff] at ha1 ha2 rw [← ha1,← ha2,ha] have hcard : Fintype.card {v : V // v ∈ S} ≤ Fintype.card GU.oddComponents := by have hc : GU.oddComponents.ncard = Fintype.card GU.oddComponents := by rw [Set.ncard_eq_toFinset_card', Set.toFinset_card] simpa only [Fintype.card_coe, ← hc] using hodd have hsurj : Function.Surjective f := by have hle := Fintype.card_le_of_injective f hinj exact ((Fintype.bijective_iff_injective_and_card f).2 ⟨hinj, Nat.le_antisymm hle hcard⟩).2 intro s hs obtain ⟨c,hc⟩ := hsurj ⟨s,hs⟩ obtain ⟨_,u,hu,hPu⟩ := (hkey c.val c.property).choose_spec have heq : (hkey c.val c.property).choose = s := congrArg Subtype.val hc exact ⟨u.val,u.property,heq ▸ hPu.symm⟩theorem in1158_single_exit_local {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (P : G.Subgraph) (hP : P.IsPerfectMatching) (X : Finset V) (x y : V) (hx : x ∈ X) (hy : y ∉ X) (hxy : P.Adj x y) (hclosed : ∀ a ∈ X, ∀ b, P.Adj a b → b ∉ X → a=x ∧ b=y) : Odd X.card := by classical let F : Finset V := X.erase x let C : Set V := F have hmatch : (P.induce C).IsMatching := by intro a ha have haF : a ∈ F := ha have haX : a ∈ X := (Finset.mem_erase.mp haF).2 have hax : a ≠ x := (Finset.mem_erase.mp haF).1 obtain ⟨b,hab,huniq⟩ := hP.1 (hP.2 a) have hbx : b ≠ x := by intro he subst b have hay : a = y := (hP.1 (hP.2 x)).unique hab.symm hxy exact hy (hay ▸ haX) have hbX : b ∈ X := by by_contra hbX exact hax (hclosed a haX b hab hbX).1 have hbF : b ∈ F := Finset.mem_erase.mpr ⟨hbx,hbX⟩ refine ⟨b,⟨haF,hbF,hab⟩,?_⟩ intro z hz exact huniq z hz.2.2 have he := hmatch.even_card rw [← Set.ncard_eq_toFinset_card'] at he have hF : (P.induce C).verts.ncard = F.card := by show C.ncard = _ simp [C] rw [hF] at he have hcard : F.card + 1 = X.card := Finset.card_erase_add_one hx obtain ⟨n,hn⟩ := he apply Nat.odd_iff.mpr omegatheorem forced_matching_edge_barrier_partition_with_odd_endpoints {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (u v : V) (huv : G.Adj u v) (hP : ∃ P : G.Subgraph, P.IsPerfectMatching) (hforced : ¬ ∃ P : (G.deleteEdges {s(u,v)}).Subgraph, P.IsPerfectMatching) (hpath : (G.deleteEdges {s(u,v)}).Reachable u v) : ∃ S X Y U : Finset V, S.Nonempty ∧ Disjoint S X ∧ Disjoint S Y ∧ Disjoint S U ∧ Disjoint X Y ∧ Disjoint X U ∧ Disjoint Y U ∧ S ∪ X ∪ Y ∪ U = Finset.univ ∧ u ∈ X ∧ v ∈ Y ∧ (∀ x ∈ X, ∀ y ∈ Y, G.Adj x y → x = u ∧ y = v) ∧ (∀ w ∈ U, ∀ z ∈ X ∪ Y, ¬ G.Adj w z) ∧ S.card ≤ (G.induce {a | a ∈ U}).oddComponents.ncard ∧ Odd X.card ∧ Odd Y.card := by classical obtain ⟨P,hP⟩ := hP obtain ⟨S,X,Y,U,hSne,hSX,hSY,hSU,hXY,hXU,hYU,hcover,huX,hvY,hcross,hanti,hoddU⟩ := forced_matching_edge_barrier_component_partition G u v huv ⟨P,hP⟩ hforced hpath have hPuv : P.Adj u v := by by_contra hnot have hsub : ∀ a b, P.Adj a b → (G.deleteEdges {s(u,v)}).Adj a b := by intro a b hab apply SimpleGraph.deleteEdges_adj.mpr refine ⟨P.adj_sub hab, ?_⟩ simp only [Set.mem_singleton_iff,not_false_eq_true] intro he rcases Sym2.eq_iff.mp he with ⟨ha,hb⟩ | ⟨ha,hb⟩ · exact hnot (ha ▸ hb ▸ hab) · exact hnot (hb ▸ ha ▸ hab.symm) let Q : (G.deleteEdges {s(u,v)}).Subgraph := ⟨P.verts,P.Adj,(fun {a b} hab => hsub a b hab),P.edge_vert,P.symm⟩ have hQ : Q.IsPerfectMatching := ⟨hP.1,hP.2⟩ exact hforced ⟨Q,hQ⟩ have hUanti : ∀ w ∈ U, ∀ z, z ∉ U → z ∉ S → ¬ G.Adj w z := by intro w hw z hzU hzS have hz : z ∈ S ∪ X ∪ Y ∪ U := by rw [hcover]; exact Finset.mem_univ z simp only [Finset.mem_union] at hz have hzXY : z ∈ X ∪ Y := by simp only [Finset.mem_union] rcases hz with ((hz|hz)|hz)|hz · exact False.elim (hzS hz) · exact Or.inl hz · exact Or.inr hz · exact False.elim (hzU hz) exact hanti w hw z hzXY have hres : ∀ s ∈ S, ∃ w ∈ U, P.Adj s w := in1158_odd_reservoir_local G P hP S U hSU hUanti hoddU have hnotS : ∀ a ∈ X ∪ Y, ∀ b ∈ S, P.Adj a b → False := by intro a ha b hb hab obtain ⟨w,hw,hbw⟩ := hres b hb have haw : a=w := (hP.1 (hP.2 b)).unique hab.symm hbw rcases Finset.mem_union.mp ha with haX|haY · exact Finset.disjoint_left.mp hXU haX (haw ▸ hw) · exact Finset.disjoint_left.mp hYU haY (haw ▸ hw) have hpart (b : V) : b ∈ S ∨ b ∈ X ∨ b ∈ Y ∨ b ∈ U := by have hh : b ∈ S ∪ X ∪ Y ∪ U := by rw [hcover]; exact Finset.mem_univ b simpa only [Finset.mem_union,or_assoc] using hh have hclosedX : ∀ a ∈ X, ∀ b, P.Adj a b → b ∉ X → a=u ∧ b=v := by intro a ha b hab hbX rcases hpart b with hbS|hbX'|hbY|hbU · exact False.elim (hnotS a (Finset.mem_union_left _ ha) b hbS hab) · exact False.elim (hbX hbX') · exact hcross a ha b hbY (P.adj_sub hab) · exact False.elim (hanti b hbU a (Finset.mem_union_left _ ha) (P.adj_sub hab).symm) have hclosedY : ∀ a ∈ Y, ∀ b, P.Adj a b → b ∉ Y → a=v ∧ b=u := by intro a ha b hab hbY rcases hpart b with hbS|hbX|hbY'|hbU · exact False.elim (hnotS a (Finset.mem_union_right _ ha) b hbS hab) · have hh := hcross b hbX a ha (P.adj_sub hab).symm exact ⟨hh.2,hh.1⟩ · exact False.elim (hbY hbY') · exact False.elim (hanti b hbU a (Finset.mem_union_right _ ha) (P.adj_sub hab).symm) have hnotvX : v ∉ X := fun h => Finset.disjoint_left.mp hXY h hvY have hnotuY : u ∉ Y := fun h => Finset.disjoint_left.mp hXY huX h have hoddX := in1158_single_exit_local G P hP X u v huX hnotvX hPuv hclosedX have hoddY := in1158_single_exit_local G P hP Y v u hvY hnotuY hPuv.symm hclosedY exact ⟨S,X,Y,U,hSne,hSX,hSY,hSU,hXY,hXU,hYU,hcover,huX,hvY,hcross,hanti,hoddU,hoddX,hoddY⟩