weak_oddness_le_card_all_three_add_card_zero
Let G be a cubic graph on a finite vertex type and c an assignment of colours 0,1,2,3 to the edges (any function Sym2 V → Fin 4) such that every vertex is incident with an odd number of edges coloured 3 (one or three), and no two distinct edges at a vertex share colour 1, nor share colour 2 (repeated colours 0 and 3 are allowed). Then the weak oddness of G is at most the number of vertices all of whose edges are coloured 3 plus the number of edges of G coloured 0.
Statement
theorem weak_oddness_le_card_all_three_add_card_zero {V : Type*} [Fintype V] (G : SimpleGraph V) (c : Sym2 V → Fin 4) (hcub : ∀ v, Nat.card (G.neighborSet v) = 3) (hthree : ∀ v, Odd (Nat.card {w // G.Adj v w ∧ c s(v, w) = 3})) (hprop : ∀ v w₁ w₂, G.Adj v w₁ → G.Adj v w₂ → w₁ ≠ w₂ → c s(v, w₁) = c s(v, w₂) → c s(v, w₁) = 0 ∨ c s(v, w₁) = 3) : simple_graph_weak_oddness G ≤ Nat.card {v // ∀ w, G.Adj v w → c s(v, w) = 3} + Nat.card {e // e ∈ G.edgeSet ∧ c e = 0}
- Source
- arXiv:2611.32276 (weak oddness to resistance ratios in snarks), proof of Theorem 1: the final counting step (removing the edges coloured 3 leaves an even factor whose only odd components are vertices with all three edges coloured 3 and cycles through a 0-edge). Helper for weak_oddness_le_two_mul_resistance_sub_two.
- Verified
- 29 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 3
- simple_graph_weak_oddnessThe weak oddness of a finite simple graph G is the infimum of the number of odd components over all even factors of G.
- is_even_factorAn even factor of a finite simple graph $G$ is a spanning subgraph $H$ of $G$ such that every vertex has even degree in $H$.
- supportThe support $\mathrm{supp}(p) \subseteq \mathrm{Fin}\,n$ consists of coordinates where $p(i) \neq I$; the weight is…
- Used by 1
- weak_oddness_le_card_of_third_colour_perfectLet G be a cubic graph on a finite vertex type, s a finite set of unordered pairs of vertices, and C a proper 3-edge-colouring (colours…
The proof, explained
To bound the weak oddness of G, we consider the spanning subgraph F formed by all edges of G whose colour is not 3. Since G is cubic and every vertex has an odd number of incident colour-3 edges (either 1 or 3), every vertex has even degree in F (either 2 or 0), making F an even factor of G. We show that every odd component of F must contain an all-3 vertex or both endpoints of a colour-0 edge; otherwise, pairing each vertex with its unique colour-1 neighbour would define a fixed-point-free involution on the component, forcing its order to be even. Selecting such a witness for each odd component yields an injection from the odd components of F into the disjoint union of all-3 vertices and colour-0 edges, bounding the weak oddness by |V_{all 3}| + |E_0|.
For any finite type V and predicates P and Q on V, the cardinality of {w // P w} is the sum of the cardinalities of {w // P w ∧ Q w} and {w // P w ∧ ¬ Q w}.
Convert the subtype cardinalities to finset cardinalities, then decompose the filtered set of elements satisfying P into two disjoint subsets based on whether Q holds or does not hold, using Finset.card_filter_add_card_filter_not and Finset.filter_filter.
uses
Nat.card_eq_fintype_card,Fintype.card_subtype,Finset.card_filter_add_card_filter_not,Finset.filter_filtertheorem in1199_card_split {V : Type*} [Fintype V] (P Q : V → Prop) : Nat.card {w // P w} = Nat.card {w // P w ∧ Q w} + Nat.card {w // P w ∧ ¬ Q w} := by classical simp only [Nat.card_eq_fintype_card, Fintype.card_subtype] rw [← Finset.card_filter_add_card_filter_not (p := Q) (s := Finset.univ.filter P)] simp [Finset.filter_filter]
If σ is a fixed-point-free involution on a finite type α, then the cardinality of α is even.
View σ as a permutation τ of order dividing 2. Since σ has no fixed points, the complement of the support of τ is empty, so its cardinality is 0. By Equiv.Perm.card_compl_support_modEq with p = 2, the number of fixed points is congruent modulo 2 to |α|, which means |α| is even.
uses
Function.Involutive.toPerm,Equiv.Perm.card_compl_support_modEq,Finset.card_empty,Nat.even_ifftheorem in1199_even_of_involution {α : Type*} [Fintype α] (σ : α → α) (h2 : ∀ x, σ (σ x) = x) (hne : ∀ x, σ x ≠ x) : Even (Fintype.card α) := by classical let τ : Equiv.Perm α := Function.Involutive.toPerm σ h2 have hτ : τ ^ 2 ^ 1 = 1 := by ext x; show σ (σ x) = x; exact h2 x have hmod := Equiv.Perm.card_compl_support_modEq (p := 2) (n := 1) hτ have hsupp : τ.supportᶜ = ∅ := by ext x; simp only [Finset.mem_compl, Equiv.Perm.mem_support, not_not, Finset.notMem_empty, iff_false]; exact hne x rw [hsupp, Finset.card_empty] at hmod rw [Nat.even_iff]; exact hmod.symm
Define F as the spanning subgraph of G whose edges are those edges of G not coloured 3.
Set the adjacency relation of F to be adjacency in G with the edge colour distinct from 3. Symmetry follows from the symmetry of G and the invariance of unordered pairs under swapping (Sym2.eq_swap), and looplessness is inherited from G.
uses
Sym2.eq_swap,Iff.rfltheorem weak_oddness_le_card_all_three_add_card_zero {V : Type*} [Fintype V] (G : SimpleGraph V) (c : Sym2 V → Fin 4) (hcub : ∀ v, Nat.card (G.neighborSet v) = 3) (hthree : ∀ v, Odd (Nat.card {w // G.Adj v w ∧ c s(v, w) = 3})) (hprop : ∀ v w₁ w₂, G.Adj v w₁ → G.Adj v w₂ → w₁ ≠ w₂ → c s(v, w₁) = c s(v, w₂) → c s(v, w₁) = 0 ∨ c s(v, w₁) = 3) : simple_graph_weak_oddness G ≤ Nat.card {v // ∀ w, G.Adj v w → c s(v, w) = 3} + Nat.card {e // e ∈ G.edgeSet ∧ c e = 0} := by classical let F : SimpleGraph V := { Adj := fun u v => G.Adj u v ∧ c s(u, v) ≠ 3 symm := ⟨fun u v h => ⟨h.1.symm, by rw [Sym2.eq_swap]; exact h.2⟩⟩ loopless := ⟨fun u h => G.irrefl h.1⟩ } have hFadj : ∀ u v, F.Adj u v ↔ G.Adj u v ∧ c s(u, v) ≠ 3 := fun _ _ => Iff.rfl
Every vertex has even degree in F.
For each vertex v, its degree in G is 3. By in1199_card_split, this degree is the sum of the number of incident edges coloured 3 and the number of incident edges not coloured 3 (its degree in F). Since the number of edges coloured 3 is odd (2k + 1 for some k), the degree in F is 3 - (2k + 1) = 2(1 - k), which is even.
uses
in1199_card_split-- F-degrees are even have hdeg : ∀ v, Even (Nat.card {w // G.Adj v w ∧ ¬ c s(v, w) = 3}) := by intro v have h1 := in1199_card_split (fun w => G.Adj v w) (fun w => c s(v, w) = 3) have h3 : Nat.card {w // G.Adj v w} = 3 := hcub v have ho := hthree v rw [h3] at h1 obtain ⟨k, hk⟩ := ho refine ⟨1 - k, ?_⟩ omega
F is an even factor of G, and the weak oddness of G is at most the number of odd components of F.
Because F is a subgraph of G with all vertex degrees even, F is an even factor of G. By definition, the weak oddness is the infimum of the number of odd components over all even factors, so by Nat.sInf_le it is at most the number of odd components of F.
uses
Nat.sInf_lehave hF : is_even_factor G F := by refine ⟨fun u v h => h.1, fun v => ?_⟩ exact hdeg v have hle : simple_graph_weak_oddness G ≤ F.oddComponents.ncard := Nat.sInf_le ⟨F, hF, rfl⟩ refine hle.trans ?_
Every odd component of F must contain a vertex all of whose incident edges are coloured 3, or both endpoints of an edge coloured 0.
Assume for contradiction that there exists an odd component cc of F containing no all-3 vertex (hA) and containing no edge of colour 0 both of whose endpoints lie in cc (hB).
-- each odd component contains an all-3 vertex or an endpoint of a 0-edge have hclaim : ∀ cc : F.ConnectedComponent, cc ∈ F.oddComponents → (∃ v : {v // ∀ w, G.Adj v w → c s(v, w) = 3}, F.connectedComponentMk v.1 = cc) ∨ (∃ e : {e // e ∈ G.edgeSet ∧ c e = 0}, ∀ x ∈ e.1, F.connectedComponentMk x = cc) := by intro cc hodd by_contra hno push Not at hno obtain ⟨hA, hB⟩ := hno -- every vertex of cc has a unique colour-1 neighbour
Under the contradiction assumption, every vertex in cc has an incident edge coloured 1.
Let v ∈ cc. Since v is not an all-3 vertex, it has a non-3 neighbour w₁ in G, which is an F-neighbour and thus belongs to cc. Because all non-3 neighbours of v lie in cc, hypothesis hB implies none of them can have colour 0; hence every non-3 neighbour has colour 1 or 2. If c(v, w₁) = 1 we are done. If c(v, w₁) = 2, because the F-degree of v is even and positive, v has a second non-3 neighbour y ≠ w₁. Its colour must be 1 or 2, but it cannot be 2 since two distinct neighbours sharing colour 2 contradicts the edge-colouring hypothesis hprop. Thus c(v, y) = 1.
uses
SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj,Fintype.exists_ne_of_one_lt_card,Subtype.exthave hex : ∀ v, F.connectedComponentMk v = cc → ∃ w, G.Adj v w ∧ c s(v, w) = 1 := by intro v hv have hnot : ¬ ∀ w, G.Adj v w → c s(v, w) = 3 := fun h => hA ⟨v, h⟩ hv push Not at hnot obtain ⟨w₁, hw₁, hc₁⟩ := hnot have hz : ∀ w, G.Adj v w → c s(v, w) ≠ 3 → c s(v, w) ≠ 0 := by intro w hw hc h0 obtain ⟨x, hx1, hx2⟩ := hB ⟨s(v, w), hw, h0⟩ rcases Sym2.mem_iff.mp hx1 with rfl | rfl · exact hx2 hv · apply hx2 rw [← hv] exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj (show F.Adj v x from ⟨hw, hc⟩)).symm have hval : ∀ w, G.Adj v w → c s(v, w) ≠ 3 → c s(v, w) = 1 ∨ c s(v, w) = 2 := by intro w hw hc have := hz w hw hc omega rcases hval w₁ hw₁ hc₁ with h | h · exact ⟨w₁, hw₁, h⟩ · -- find a second non-3 neighbour have hev := hdeg v have hpos : 0 < Nat.card {w // G.Adj v w ∧ ¬ c s(v, w) = 3} := Nat.card_pos_iff.mpr ⟨⟨⟨w₁, hw₁, hc₁⟩⟩, inferInstance⟩ have h2 : 1 < Nat.card {w // G.Adj v w ∧ ¬ c s(v, w) = 3} := by obtain ⟨k, hk⟩ := hev omega rw [Nat.card_eq_fintype_card] at h2 obtain ⟨y, hy⟩ := Fintype.exists_ne_of_one_lt_card h2 ⟨w₁, hw₁, hc₁⟩ have hyne : y.1 ≠ w₁ := fun h' => hy (Subtype.ext h') rcases hval y.1 y.2.1 y.2.2 with h' | h' · exact ⟨y.1, y.2.1, h'⟩ · exfalso rcases hprop v y.1 w₁ y.2.1 hw₁ hyne (by rw [h, h']) with h'' | h'' <;> rw [h'] at h'' <;> exact absurd h'' (by decide)
No vertex can have two distinct incident edges both coloured 1.
If a vertex v had distinct neighbours w₁ ≠ w₂ with c(v, w₁) = c(v, w₂) = 1, hypothesis hprop would require the shared colour to be 0 or 3, a contradiction since 1 is neither 0 nor 3.
have huniq : ∀ v w₁ w₂, G.Adj v w₁ → c s(v, w₁) = 1 → G.Adj v w₂ → c s(v, w₂) = 1 → w₁ = w₂ := by intro v w₁ w₂ h₁ c₁ h₂ c₂ by_contra hne rcases hprop v w₁ w₂ h₁ h₂ hne (by rw [c₁, c₂]) with h | h <;> rw [c₁] at h <;> exact absurd h (by decide)
The odd component cc must have an even number of vertices, yielding a contradiction.
Each vertex x ∈ cc has a unique colour-1 neighbour σ(x), which belongs to cc because colour 1 is not 3. Since edge colours are undirected, σ is an involution on cc, and since G is loopless, σ has no fixed points. By in1199_even_of_involution, the cardinality of cc is even, contradicting the assumption that cc is an odd component.
uses
Classical.choose,Classical.choose_spec,SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj,Subtype.ext,Sym2.eq_swap,in1199_even_of_involution,Nat.card_coe_set_eq,Nat.card_eq_fintype_card,Fintype.card_congr,Equiv.subtypeEquivRightlet S := {v // F.connectedComponentMk v = cc} have hS : ∀ x : S, ∃ w, G.Adj x.1 w ∧ c s(x.1, w) = 1 := fun x => hex x.1 x.2 let σ : S → S := fun x => ⟨Classical.choose (hS x), by have h := Classical.choose_spec (hS x) exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj (show F.Adj x.1 _ from ⟨h.1, by rw [h.2]; decide⟩)).symm.trans x.2⟩ have hσ : ∀ x : S, G.Adj x.1 (σ x).1 ∧ c s(x.1, (σ x).1) = 1 := fun x => Classical.choose_spec (hS x) have h2 : ∀ x, σ (σ x) = x := by intro x apply Subtype.ext have a := hσ x have b := hσ (σ x) exact huniq _ _ _ b.1 b.2 a.1.symm (by rw [Sym2.eq_swap]; exact a.2) have hne : ∀ x, σ x ≠ x := by intro x h have a := (hσ x).1 rw [h] at a exact G.irrefl a have hev := in1199_even_of_involution σ h2 hne have hcard : cc.supp.ncard = Fintype.card S := by rw [← Nat.card_coe_set_eq, Nat.card_eq_fintype_card] exact Fintype.card_congr (Equiv.subtypeEquivRight (fun v => Iff.rfl)) have hodd' : Odd cc.supp.ncard := hodd rw [hcard] at hodd' exact (Nat.not_even_iff_odd.mpr hodd') hev
There is an injection φ from the odd components of F into the disjoint union of all-3 vertices and 0-edges.
For each odd component cc, if cc contains an all-3 vertex, φ(cc) chooses one and maps to the left summand; otherwise, by the established claim, cc contains both endpoints of some 0-edge, and φ(cc) chooses one and maps to the right summand. Connected components are disjoint, so if two components map to the same vertex or to the same edge (whose endpoints lie in both components), the components must be identical. Hence φ is injective.
uses
Classical.choose,Classical.choose_spec,Subtype.ext,Sum.inl_injective,Sum.inr_injective,Sym2.out_fst_mem-- the injection let A := {v // ∀ w, G.Adj v w → c s(v, w) = 3} let B := {e // e ∈ G.edgeSet ∧ c e = 0} let φ : F.oddComponents → A ⊕ B := fun cc => if h : ∃ v : A, F.connectedComponentMk v.1 = cc.1 then Sum.inl (Classical.choose h) else Sum.inr (Classical.choose ((hclaim cc.1 cc.2).resolve_left h)) have hφ : Function.Injective φ := by intro c₁ c₂ heq apply Subtype.ext simp only [φ] at heq split_ifs at heq with h₁ h₂ h₂ · have e := Sum.inl_injective heq rw [← Classical.choose_spec h₁, ← Classical.choose_spec h₂, e] · have e := Sum.inr_injective heq have s₁ := Classical.choose_spec ((hclaim c₁.1 c₁.2).resolve_left h₁) have s₂ := Classical.choose_spec ((hclaim c₂.1 c₂.2).resolve_left h₂) rw [e] at s₁ set e₀ := Classical.choose ((hclaim c₂.1 c₂.2).resolve_left h₂) have hm : e₀.1.out.1 ∈ e₀.1 := Sym2.out_fst_mem _ rw [← s₁ _ hm, ← s₂ _ hm]
The weak oddness of G is at most the number of all-3 vertices plus the number of edges coloured 0.
By Nat.card_le_card_of_injective, the injectivity of φ bounds the number of odd components of F by the cardinality of the disjoint sum A ⊕ B, which by Nat.card_sum equals |A| + |B|. Chaining this with the earlier bound on weak oddness completes the proof.
uses
Nat.card_le_card_of_injective,Nat.card_sum,Nat.card_coe_set_eqhave hcardle := Nat.card_le_card_of_injective φ hφ rw [Nat.card_sum] at hcardle rw [← Nat.card_coe_set_eq] exact hcardle
Nat.card_eq_fintype_card- For a finite type, its cardinality as a natural number equals the cardinality of its Fintype instance.
Fintype.card_subtype- The cardinality of a subtype {x // p x} equals the cardinality of the finset of elements satisfying p.
Finset.card_filter_add_card_filter_not- Filtering a finset by a predicate and by its negation partitions the finset, so the sum of their cardinalities equals the cardinality of the original finset.
Finset.filter_filter- Filtering a finset successively by two predicates is equivalent to filtering by their conjunction.
Function.Involutive.toPerm- An involutive map from a type to itself forms a permutation of that type.
Equiv.Perm.card_compl_support_modEq- For a permutation σ of prime-power order p^n, the number of its fixed points (the complement of its support) is congruent modulo p to the cardinality of the entire domain.
Finset.card_empty- The empty finset has cardinality 0.
Nat.even_iff- A natural number is even if and only if its remainder modulo 2 is 0.
Sym2.eq_swap- The unordered pair s(a, b) is equal to s(b, a).
Iff.rfl- Every proposition is logically equivalent to itself.
in1199_card_split- The cardinality of a subtype defined by P is the sum of the cardinalities of the subtypes where P ∧ Q and P ∧ ¬Q hold.
Nat.sInf_le- The infimum of a set of natural numbers is less than or equal to any element belonging to the set.
SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj- If two vertices in a simple graph are adjacent, they belong to the same connected component.
Fintype.exists_ne_of_one_lt_card- In a finite type with cardinality strictly greater than 1, every element has another element distinct from it.
Subtype.ext- Two elements of a subtype are equal if their underlying values are equal.
Classical.choose- Given an existence proof ∃ x, p(x), produces a witness x satisfying p(x).
Classical.choose_spec- The witness produced by Classical.choose satisfies the specified predicate.
in1199_even_of_involution- A finite set that admits a fixed-point-free involution has an even number of elements.
Nat.card_coe_set_eq- The cardinality of a set coerced to a type equals its set cardinality (ncard).
Fintype.card_congr- Bijective finite types have the same cardinality.
Equiv.subtypeEquivRight- Subtypes defined by logically equivalent predicates are in bijection.
Sum.inl_injective- The left injection map Sum.inl into a disjoint sum is injective.
Sum.inr_injective- The right injection map Sum.inr into a disjoint sum is injective.
Sym2.out_fst_mem- The first element of the canonical representative of an unordered pair is a member of that pair.
Nat.card_le_card_of_injective- An injective map between finite types implies the cardinality of the domain is at most the cardinality of the codomain.
Nat.card_sum- The cardinality of the disjoint sum of two finite types is the sum of their individual cardinalities.
- The weak oddness of a simple graph is defined formally as the infimum of the number of odd components over all even factors (spanning subgraphs where every vertex has even degree).
- Edges are formally represented as unordered pairs in the symmetric square `Sym2 V`, so undirected edge properties require invoking symmetry lemmas such as `Sym2.eq_swap`.
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 in1199_card_split {V : Type*} [Fintype V] (P Q : V → Prop) : Nat.card {w // P w} = Nat.card {w // P w ∧ Q w} + Nat.card {w // P w ∧ ¬ Q w} := by classical simp only [Nat.card_eq_fintype_card, Fintype.card_subtype] rw [← Finset.card_filter_add_card_filter_not (p := Q) (s := Finset.univ.filter P)] simp [Finset.filter_filter]theorem in1199_even_of_involution {α : Type*} [Fintype α] (σ : α → α) (h2 : ∀ x, σ (σ x) = x) (hne : ∀ x, σ x ≠ x) : Even (Fintype.card α) := by classical let τ : Equiv.Perm α := Function.Involutive.toPerm σ h2 have hτ : τ ^ 2 ^ 1 = 1 := by ext x; show σ (σ x) = x; exact h2 x have hmod := Equiv.Perm.card_compl_support_modEq (p := 2) (n := 1) hτ have hsupp : τ.supportᶜ = ∅ := by ext x; simp only [Finset.mem_compl, Equiv.Perm.mem_support, not_not, Finset.notMem_empty, iff_false]; exact hne x rw [hsupp, Finset.card_empty] at hmod rw [Nat.even_iff]; exact hmod.symmtheorem weak_oddness_le_card_all_three_add_card_zero {V : Type*} [Fintype V] (G : SimpleGraph V) (c : Sym2 V → Fin 4) (hcub : ∀ v, Nat.card (G.neighborSet v) = 3) (hthree : ∀ v, Odd (Nat.card {w // G.Adj v w ∧ c s(v, w) = 3})) (hprop : ∀ v w₁ w₂, G.Adj v w₁ → G.Adj v w₂ → w₁ ≠ w₂ → c s(v, w₁) = c s(v, w₂) → c s(v, w₁) = 0 ∨ c s(v, w₁) = 3) : simple_graph_weak_oddness G ≤ Nat.card {v // ∀ w, G.Adj v w → c s(v, w) = 3} + Nat.card {e // e ∈ G.edgeSet ∧ c e = 0} := by classical let F : SimpleGraph V := { Adj := fun u v => G.Adj u v ∧ c s(u, v) ≠ 3 symm := ⟨fun u v h => ⟨h.1.symm, by rw [Sym2.eq_swap]; exact h.2⟩⟩ loopless := ⟨fun u h => G.irrefl h.1⟩ } have hFadj : ∀ u v, F.Adj u v ↔ G.Adj u v ∧ c s(u, v) ≠ 3 := fun _ _ => Iff.rfl -- F-degrees are even have hdeg : ∀ v, Even (Nat.card {w // G.Adj v w ∧ ¬ c s(v, w) = 3}) := by intro v have h1 := in1199_card_split (fun w => G.Adj v w) (fun w => c s(v, w) = 3) have h3 : Nat.card {w // G.Adj v w} = 3 := hcub v have ho := hthree v rw [h3] at h1 obtain ⟨k, hk⟩ := ho refine ⟨1 - k, ?_⟩ omega have hF : is_even_factor G F := by refine ⟨fun u v h => h.1, fun v => ?_⟩ exact hdeg v have hle : simple_graph_weak_oddness G ≤ F.oddComponents.ncard := Nat.sInf_le ⟨F, hF, rfl⟩ refine hle.trans ?_ -- each odd component contains an all-3 vertex or an endpoint of a 0-edge have hclaim : ∀ cc : F.ConnectedComponent, cc ∈ F.oddComponents → (∃ v : {v // ∀ w, G.Adj v w → c s(v, w) = 3}, F.connectedComponentMk v.1 = cc) ∨ (∃ e : {e // e ∈ G.edgeSet ∧ c e = 0}, ∀ x ∈ e.1, F.connectedComponentMk x = cc) := by intro cc hodd by_contra hno push Not at hno obtain ⟨hA, hB⟩ := hno -- every vertex of cc has a unique colour-1 neighbour have hex : ∀ v, F.connectedComponentMk v = cc → ∃ w, G.Adj v w ∧ c s(v, w) = 1 := by intro v hv have hnot : ¬ ∀ w, G.Adj v w → c s(v, w) = 3 := fun h => hA ⟨v, h⟩ hv push Not at hnot obtain ⟨w₁, hw₁, hc₁⟩ := hnot have hz : ∀ w, G.Adj v w → c s(v, w) ≠ 3 → c s(v, w) ≠ 0 := by intro w hw hc h0 obtain ⟨x, hx1, hx2⟩ := hB ⟨s(v, w), hw, h0⟩ rcases Sym2.mem_iff.mp hx1 with rfl | rfl · exact hx2 hv · apply hx2 rw [← hv] exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj (show F.Adj v x from ⟨hw, hc⟩)).symm have hval : ∀ w, G.Adj v w → c s(v, w) ≠ 3 → c s(v, w) = 1 ∨ c s(v, w) = 2 := by intro w hw hc have := hz w hw hc omega rcases hval w₁ hw₁ hc₁ with h | h · exact ⟨w₁, hw₁, h⟩ · -- find a second non-3 neighbour have hev := hdeg v have hpos : 0 < Nat.card {w // G.Adj v w ∧ ¬ c s(v, w) = 3} := Nat.card_pos_iff.mpr ⟨⟨⟨w₁, hw₁, hc₁⟩⟩, inferInstance⟩ have h2 : 1 < Nat.card {w // G.Adj v w ∧ ¬ c s(v, w) = 3} := by obtain ⟨k, hk⟩ := hev omega rw [Nat.card_eq_fintype_card] at h2 obtain ⟨y, hy⟩ := Fintype.exists_ne_of_one_lt_card h2 ⟨w₁, hw₁, hc₁⟩ have hyne : y.1 ≠ w₁ := fun h' => hy (Subtype.ext h') rcases hval y.1 y.2.1 y.2.2 with h' | h' · exact ⟨y.1, y.2.1, h'⟩ · exfalso rcases hprop v y.1 w₁ y.2.1 hw₁ hyne (by rw [h, h']) with h'' | h'' <;> rw [h'] at h'' <;> exact absurd h'' (by decide) have huniq : ∀ v w₁ w₂, G.Adj v w₁ → c s(v, w₁) = 1 → G.Adj v w₂ → c s(v, w₂) = 1 → w₁ = w₂ := by intro v w₁ w₂ h₁ c₁ h₂ c₂ by_contra hne rcases hprop v w₁ w₂ h₁ h₂ hne (by rw [c₁, c₂]) with h | h <;> rw [c₁] at h <;> exact absurd h (by decide) let S := {v // F.connectedComponentMk v = cc} have hS : ∀ x : S, ∃ w, G.Adj x.1 w ∧ c s(x.1, w) = 1 := fun x => hex x.1 x.2 let σ : S → S := fun x => ⟨Classical.choose (hS x), by have h := Classical.choose_spec (hS x) exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj (show F.Adj x.1 _ from ⟨h.1, by rw [h.2]; decide⟩)).symm.trans x.2⟩ have hσ : ∀ x : S, G.Adj x.1 (σ x).1 ∧ c s(x.1, (σ x).1) = 1 := fun x => Classical.choose_spec (hS x) have h2 : ∀ x, σ (σ x) = x := by intro x apply Subtype.ext have a := hσ x have b := hσ (σ x) exact huniq _ _ _ b.1 b.2 a.1.symm (by rw [Sym2.eq_swap]; exact a.2) have hne : ∀ x, σ x ≠ x := by intro x h have a := (hσ x).1 rw [h] at a exact G.irrefl a have hev := in1199_even_of_involution σ h2 hne have hcard : cc.supp.ncard = Fintype.card S := by rw [← Nat.card_coe_set_eq, Nat.card_eq_fintype_card] exact Fintype.card_congr (Equiv.subtypeEquivRight (fun v => Iff.rfl)) have hodd' : Odd cc.supp.ncard := hodd rw [hcard] at hodd' exact (Nat.not_even_iff_odd.mpr hodd') hev -- the injection let A := {v // ∀ w, G.Adj v w → c s(v, w) = 3} let B := {e // e ∈ G.edgeSet ∧ c e = 0} let φ : F.oddComponents → A ⊕ B := fun cc => if h : ∃ v : A, F.connectedComponentMk v.1 = cc.1 then Sum.inl (Classical.choose h) else Sum.inr (Classical.choose ((hclaim cc.1 cc.2).resolve_left h)) have hφ : Function.Injective φ := by intro c₁ c₂ heq apply Subtype.ext simp only [φ] at heq split_ifs at heq with h₁ h₂ h₂ · have e := Sum.inl_injective heq rw [← Classical.choose_spec h₁, ← Classical.choose_spec h₂, e] · have e := Sum.inr_injective heq have s₁ := Classical.choose_spec ((hclaim c₁.1 c₁.2).resolve_left h₁) have s₂ := Classical.choose_spec ((hclaim c₂.1 c₂.2).resolve_left h₂) rw [e] at s₁ set e₀ := Classical.choose ((hclaim c₂.1 c₂.2).resolve_left h₂) have hm : e₀.1.out.1 ∈ e₀.1 := Sym2.out_fst_mem _ rw [← s₁ _ hm, ← s₂ _ hm] have hcardle := Nat.card_le_card_of_injective φ hφ rw [Nat.card_sum] at hcardle rw [← Nat.card_coe_set_eq] exact hcardle