AFTD Auto-Formalizing Theoretical Domains

op309_ten_vertex_uniform_p3_host_selection_impossible

theoremverified

No ten-vertex cubic graph has a selected P3 forest with independent uncovered vertices, no outside leaf-to-leaf or center-to-center edges, and every uncovered vertex adjacent entirely to leaves or entirely to centers.

Statement

theorem op309_ten_vertex_uniform_p3_host_selection_impossible
    {V : Type*} [Fintype V] [DecidableEq V]
    (G : SimpleGraph V) [DecidableRel G.Adj]
    (R : Finset G.edgeSet) :
    Fintype.card V = 10 →
    (∀ v, (G.neighborSet v).ncard = 3) →
    let d : V → ℕ := fun v => (R.filter fun e => v ∈ e.1).card
    (∀ v, d v ≤ 2) →
    (∀ u v, G.Adj u v → d u ≠ d v) →
    (∀ u v w, d u = 0 → G.Adj u v → G.Adj u w → d v = d w) →
    False
Source
OP-309 uniform-host selection analysis; experiments 42443 and 42461.
Verified
28 Nov 2026
Axioms
Classical.choiceQuot.soundpropext

The proof, explained

In a 10-vertex 3-regular graph, suppose there is an edge subset R inducing vertex degrees d(v) ≤ 2 such that no adjacent vertices share the same degree, and all neighbors of any degree-0 vertex have the same degree. Every edge in R must connect a degree-1 vertex to a degree-2 vertex, which by double counting implies |O| = |R| and 2|T| = |R|, where O and T are the sets of vertices of degree 1 and 2. Counting edges between O, T, and the degree-0 vertices Z = Za ∪ Zb yields a system of linear constraints on set sizes and the cross-edge count e(O, T). Together with the bound |R| ≤ e(O, T) and the total vertex count |Za| + |Zb| + |O| + |T| = 10, this integer linear system has no solution, proving such an edge selection is impossible.

  1. Every edge of G can be represented as an unordered pair of adjacent vertices.

    By induction on unordered pairs in `Sym2 V`, any element in the edge set of a simple graph G is of the form s(u, v) with u adjacent to v.

    lines 6–10

    uses Sym2.ind, SimpleGraph.mem_edgeSet

      have key : ∀ x : Sym2 V, x ∈ G.edgeSet → ∃ u v : V, G.Adj u v ∧ x = s(u, v) := by
        intro x hx
        induction x using Sym2.ind with
        | _ u v => exact ⟨u, v, (SimpleGraph.mem_edgeSet G).mp hx, rfl⟩
      exact key e.1 e.2
  2. Every edge in R has one endpoint of degree 1 and one endpoint of degree 2.

    For any edge e in R with endpoints a and b, both a and b are incident to e, so d(a) ≥ 1 and d(b) ≥ 1. Since degrees are bounded by 2 and adjacent vertices must have distinct degrees, one endpoint has degree 1 and the other has degree 2.

    lines 18–32

    uses op309_ten_vertex_uniform_p3_host_selection_impossible_edge_endpoints, Sym2.mem_iff, Finset.one_le_card, Sym2.eq_iff

      classical
      obtain ⟨a, b, hab, heq⟩ := op309_ten_vertex_uniform_p3_host_selection_impossible_edge_endpoints G e
      have hamem : a ∈ e.1 := by rw [heq]; exact Sym2.mem_iff.mpr (Or.inl rfl)
      have hbmem : b ∈ e.1 := by rw [heq]; exact Sym2.mem_iff.mpr (Or.inr rfl)
      have hda1 : 1 ≤ d a := by
        rw [hd a, Finset.one_le_card]; exact ⟨e, by simp [he, hamem]⟩
      have hdb1 : 1 ≤ d b := by
        rw [hd b, Finset.one_le_card]; exact ⟨e, by simp [he, hbmem]⟩
      have hne := hadj a b hab
      have ha2 := hle a; have hb2 := hle b
      have hcases : (d a = 1 ∧ d b = 2) ∨ (d a = 2 ∧ d b = 1) := by omega
      rcases hcases with ⟨ha, hb⟩ | ⟨ha, hb⟩
      · exact ⟨a, b, hab, heq, ha, hb⟩
      · refine ⟨b, a, (G.adj_comm a b).mp hab, ?_, hb, ha⟩
        rw [heq, Sym2.eq_iff]; exact Or.inr ⟨rfl, rfl⟩
  3. Each edge in R has exactly one endpoint of degree 1 and exactly one endpoint of degree 2.

    Since an edge e in R connects a vertex u of degree 1 to a vertex v of degree 2, filtering its endpoints for degree 1 yields the singleton {u}, and filtering for degree 2 yields {v}, each having cardinality 1.

    lines 41–63

    uses op309_ten_vertex_uniform_p3_host_selection_impossible_sel_oriented, Finset.card_singleton

      classical
      obtain ⟨u, v, huv, heq, hdu, hdv⟩ := op309_ten_vertex_uniform_p3_host_selection_impossible_sel_oriented G R d hd hle hadj e he
      constructor
      · have hset : (Finset.univ.filter (fun w => d w = 1)).filter (fun w => w ∈ e.1) = {u} := by
          ext w
          rw [heq]
          simp only [Finset.mem_filter, Finset.mem_univ, true_and, Sym2.mem_iff, Finset.mem_singleton]
          constructor
          · rintro ⟨hdw, hwu | hwv⟩
            · exact hwu
            · rw [hwv] at hdw; omega
          · rintro rfl; exact ⟨hdu, Or.inl rfl⟩
        rw [hset, Finset.card_singleton]
      · have hset : (Finset.univ.filter (fun w => d w = 2)).filter (fun w => w ∈ e.1) = {v} := by
          ext w
          rw [heq]
          simp only [Finset.mem_filter, Finset.mem_univ, true_and, Sym2.mem_iff, Finset.mem_singleton]
          constructor
          · rintro ⟨hdw, hwu | hwv⟩
            · rw [hwu] at hdw; omega
            · exact hwv
          · rintro rfl; exact ⟨hdv, Or.inr rfl⟩
        rw [hset, Finset.card_singleton]
  4. Double counting: the sum of degrees in R over S equals the sum over edges in R of their endpoint count in S.

    Writing set cardinalities as sums of indicators and swapping the order of summation over vertices in S and edges in R establishes the identity.

    lines 69–77

    uses Finset.sum_congr, Finset.card_filter, Finset.sum_comm

      classical
      calc ∑ v ∈ S, (R.filter fun e => v ∈ e.1).card
          = ∑ v ∈ S, ∑ e ∈ R, (if v ∈ e.1 then 1 else 0) := by
            apply Finset.sum_congr rfl; intro v hv
            rw [Finset.card_filter]
        _ = ∑ e ∈ R, ∑ v ∈ S, (if v ∈ e.1 then 1 else 0) := Finset.sum_comm
        _ = ∑ e ∈ R, (S.filter fun w => w ∈ e.1).card := by
            apply Finset.sum_congr rfl; intro e he
            rw [Finset.card_filter]
  5. The number of edges between two vertex sets S and TT is symmetric.

    Expressing the neighbor count in TT for each vertex in S as a sum of adjacency indicators, swapping the double sum, and using the symmetry of adjacency equates the sum over S to the sum over TT.

    lines 82–96

    uses mem_neighborFinset, Finset.card_filter, Finset.sum_comm, SimpleGraph.adj_comm

      classical
      have h1 : ∀ v, G.neighborFinset v ∩ TT = TT.filter (fun w => G.Adj v w) := by
        intro v; ext w; simp [mem_neighborFinset, and_comm]
      have h2 : ∀ w, G.neighborFinset w ∩ S = S.filter (fun v => G.Adj w v) := by
        intro w; ext v; simp [mem_neighborFinset, and_comm]
      calc ∑ v ∈ S, (G.neighborFinset v ∩ TT).card
          = ∑ v ∈ S, ∑ w ∈ TT, (if G.Adj v w then 1 else 0) := by
            apply Finset.sum_congr rfl; intro v hv
            rw [h1 v, Finset.card_filter]
        _ = ∑ w ∈ TT, ∑ v ∈ S, (if G.Adj v w then 1 else 0) := Finset.sum_comm
        _ = ∑ w ∈ TT, (G.neighborFinset w ∩ S).card := by
            apply Finset.sum_congr rfl; intro w hw
            rw [h2 w, Finset.card_filter]
            apply Finset.sum_congr rfl; intro v hv
            simp only [SimpleGraph.adj_comm]
  6. Partition of a set by three pairwise disjoint sets covering the universe.

    The intersections s ∩ A, s ∩ B, and s ∩ C are pairwise disjoint and their union is s, so the sum of their cardinalities equals |s|.

    lines 102–124

    uses Finset.card_union_of_disjoint, Finset.inter_subset_right, Finset.disjoint_union_left

      classical
      have hunion : (s ∩ A) ∪ (s ∩ B) ∪ (s ∩ C) = s := by
        ext w
        simp only [Finset.mem_union, Finset.mem_inter]
        constructor
        · rintro ((⟨hw, _⟩ | ⟨hw, _⟩) | ⟨hw, _⟩) <;> exact hw
        · intro hw
          have hmem : w ∈ A ∪ B ∪ C := by rw [hcover]; exact Finset.mem_univ w
          rcases (Finset.mem_union.mp hmem) with hAB' | hC
          · rcases (Finset.mem_union.mp hAB') with hA | hB
            · exact Or.inl (Or.inl ⟨hw, hA⟩)
            · exact Or.inl (Or.inr ⟨hw, hB⟩)
          · exact Or.inr ⟨hw, hC⟩
      have hdAB : Disjoint (s ∩ A) (s ∩ B) := hAB.mono Finset.inter_subset_right Finset.inter_subset_right
      have hdAC : Disjoint (s ∩ A) (s ∩ C) := hAC.mono Finset.inter_subset_right Finset.inter_subset_right
      have hdBC : Disjoint (s ∩ B) (s ∩ C) := hBC.mono Finset.inter_subset_right Finset.inter_subset_right
      have hdAB_C : Disjoint ((s ∩ A) ∪ (s ∩ B)) (s ∩ C) := by
        rw [Finset.disjoint_union_left]; exact ⟨hdAC, hdBC⟩
      have hcard : ((s ∩ A) ∪ (s ∩ B) ∪ (s ∩ C)).card
          = (s ∩ A).card + (s ∩ B).card + (s ∩ C).card := by
        rw [Finset.card_union_of_disjoint hdAB_C, Finset.card_union_of_disjoint hdAB]
      rw [hunion] at hcard
      exact hcard.symm
  7. Partition of a set by two disjoint sets.

    Since A and B are disjoint and s ⊆ A ∪ B, the sets s ∩ A and s ∩ B form a disjoint partition of s, so their cardinalities sum to |s|.

    lines 129–142

    uses Finset.card_union_of_disjoint, Finset.inter_subset_right

      classical
      have hunion : (s ∩ A) ∪ (s ∩ B) = s := by
        ext w; simp only [Finset.mem_union, Finset.mem_inter]
        constructor
        · rintro (⟨hw,_⟩ | ⟨hw,_⟩) <;> exact hw
        · intro hw
          rcases Finset.mem_union.mp (hs hw) with h | h
          · exact Or.inl ⟨hw, h⟩
          · exact Or.inr ⟨hw, h⟩
      have hd : Disjoint (s ∩ A) (s ∩ B) := hAB.mono Finset.inter_subset_right Finset.inter_subset_right
      have hcard : ((s ∩ A) ∪ (s ∩ B)).card = (s ∩ A).card + (s ∩ B).card :=
        Finset.card_union_of_disjoint hd
      rw [hunion] at hcard
      exact hcard.symm
  8. The vertices are partitioned into Z (degree 0), O (degree 1), and T (degree 2), whose cardinalities sum to 10.

    Every vertex degree is at most 2, so degrees are 0, 1, or 2. The sets Z, O, and T are pairwise disjoint and cover V, so by the three-set partition lemma their sizes sum to |V| = 10.

    lines 155–198

    uses op309_ten_vertex_uniform_p3_host_selection_impossible_card_inter_three, Finset.univ_inter, Finset.card_univ

      classical
      intro hcard hdeg
      let d : V → ℕ := fun v => (R.filter fun e => v ∈ e.1).card
      change (∀ v, d v ≤ 2) → (∀ u v, G.Adj u v → d u ≠ d v) →
        (∀ u v w, d u = 0 → G.Adj u v → G.Adj u w → d v = d w) → False
      intro hle hadj hunif
      have hd : ∀ v, d v = (R.filter fun e => v ∈ e.1).card := fun v => rfl
      let Z : Finset V := Finset.univ.filter (fun v => d v = 0)
      let O : Finset V := Finset.univ.filter (fun v => d v = 1)
      let T : Finset V := Finset.univ.filter (fun v => d v = 2)
      let Za : Finset V := Z.filter (fun v => ∀ w, G.Adj v w → d w = 1)
      let Zb : Finset V := Z.filter (fun v => ∀ w, G.Adj v w → d w = 2)
      have memZ : ∀ v, v ∈ Z ↔ d v = 0 := by intro v; simp [Z]
      have memO : ∀ v, v ∈ O ↔ d v = 1 := by intro v; simp [O]
      have memT : ∀ v, v ∈ T ↔ d v = 2 := by intro v; simp [T]
      have memZa : ∀ v, v ∈ Za ↔ d v = 0 ∧ (∀ w, G.Adj v w → d w = 1) := by
        intro v; simp [Za, Z]
      have memZb : ∀ v, v ∈ Zb ↔ d v = 0 ∧ (∀ w, G.Adj v w → d w = 2) := by
        intro v; simp [Zb, Z]
      have hd012 : ∀ v, d v = 0 ∨ d v = 1 ∨ d v = 2 := by
        intro v; have := hle v; omega
      have hcover3 : Z ∪ O ∪ T = Finset.univ := by
        ext v
        simp only [Finset.mem_union, Finset.mem_univ]
        constructor
        · rintro _; exact trivial
        · intro _
          rcases hd012 v with h | h | h
          · exact Or.inl (Or.inl ((memZ v).mpr h))
          · exact Or.inl (Or.inr ((memO v).mpr h))
          · exact Or.inr ((memT v).mpr h)
      have hZO : Disjoint Z O := by
        rw [Finset.disjoint_left]; intro v hv hv'
        rw [memZ] at hv; rw [memO] at hv'; omega
      have hZT : Disjoint Z T := by
        rw [Finset.disjoint_left]; intro v hv hv'
        rw [memZ] at hv; rw [memT] at hv'; omega
      have hOT : Disjoint O T := by
        rw [Finset.disjoint_left]; intro v hv hv'
        rw [memO] at hv; rw [memT] at hv'; omega
      have hcardZOT : Z.card + O.card + T.card = 10 := by
        have h := op309_ten_vertex_uniform_p3_host_selection_impossible_card_inter_three (Finset.univ : Finset V) Z O T hZO hZT hOT hcover3
        simp only [Finset.univ_inter, Finset.card_univ, hcard] at h
        exact h
  9. Every vertex has degree 3, and Z is partitioned into disjoint sets Za and Zb with |Za| + |Zb| = |Z|.

    By 3-regularity, every neighborhood has size 3 and is nonempty. Adjacent vertices have distinct degrees, so neighbors of a degree-0 vertex must have degree 1 or 2. By the uniformity hypothesis, all neighbors of a degree-0 vertex share the same degree, partitioning Z into Za (neighbors all have degree 1) and Zb (neighbors all have degree 2).

    lines 199–241

    uses SimpleGraph.card_neighborFinset_eq_degree, Finset.card_pos, op309_ten_vertex_uniform_p3_host_selection_impossible_card_inter_two

      have hdeg3 : ∀ v, G.degree v = 3 := by
        intro v
        rw [show G.degree v = (G.neighborSet v).ncard from by
          rw [← SimpleGraph.card_neighborSet_eq_degree, Set.ncard_eq_toFinset_card', ← Set.toFinset_card],
          hdeg v]
      have hnbrcard : ∀ v, (G.neighborFinset v).card = 3 := by
        intro v; rw [SimpleGraph.card_neighborFinset_eq_degree, hdeg3 v]
      have hnbr_ne : ∀ v, (G.neighborFinset v).Nonempty := by
        intro v
        have h : 0 < (G.neighborFinset v).card := by rw [hnbrcard v]; norm_num
        exact Finset.card_pos.mp h
      have hZa_sub : Za ⊆ Z := fun v hv => by rw [memZa] at hv; exact (memZ v).mpr hv.1
      have hZb_sub : Zb ⊆ Z := fun v hv => by rw [memZb] at hv; exact (memZ v).mpr hv.1
      have hZaZb_disj : Disjoint Za Zb := by
        rw [Finset.disjoint_left]
        intro v hv hv'
        rw [memZa] at hv; rw [memZb] at hv'
        obtain ⟨w, hw⟩ := hnbr_ne v
        rw [mem_neighborFinset] at hw
        have h1 := hv.2 w hw
        have h2 := hv'.2 w hw
        omega
      have hZaZb : Za ∪ Zb = Z := by
        ext v
        simp only [Finset.mem_union]
        constructor
        · rintro (h | h)
          · exact hZa_sub h
          · exact hZb_sub h
        · intro hv
          rw [memZ] at hv
          obtain ⟨w, hw⟩ := hnbr_ne v
          rw [mem_neighborFinset] at hw
          have hdw_ne : d w ≠ 0 := by
            intro h0; exact (hadj v w hw) (by rw [hv, h0])
          have hdw := hle w
          rcases (show d w = 1 ∨ d w = 2 by omega) with h1 | h2
          · left; rw [memZa]; exact ⟨hv, fun x hx => (hunif v w x hv hw hx).symm.trans h1⟩
          · right; rw [memZb]; exact ⟨hv, fun x hx => (hunif v w x hv hw hx).symm.trans h2⟩
      have hab : Za.card + Zb.card = Z.card := by
        have h := op309_ten_vertex_uniform_p3_host_selection_impossible_card_inter_two Z Za Zb hZaZb_disj (fun v hv => by rw [hZaZb]; exact hv)
        rwa [(Finset.inter_eq_right).mpr hZa_sub, (Finset.inter_eq_right).mpr hZb_sub] at h
      have hpart_nbr : ∀ v, (G.neighborFinset v ∩ Z).card + (G.neighborFinset v ∩ O).card
  10. O and T have no internal edges, yielding 3|O| = e(O, Z) + e(O, T) and 3|T| = e(T, Z) + e(T, O).

    Adjacent vertices cannot have the same degree, so no two vertices in O are adjacent, and no two vertices in T are adjacent. Every neighbor of a vertex in O lies in Z or T, and every neighbor of a vertex in T lies in Z or O. Summing these neighborhood partitions over O and T gives the two equations.

    lines 242–286

    uses op309_ten_vertex_uniform_p3_host_selection_impossible_card_inter_three, Finset.card_eq_zero, Finset.eq_empty_iff_forall_notMem, Finset.sum_add_distrib, Finset.sum_const_nat

          + (G.neighborFinset v ∩ T).card = (G.neighborFinset v).card := by
        intro v
        exact op309_ten_vertex_uniform_p3_host_selection_impossible_card_inter_three (G.neighborFinset v) Z O T hZO hZT hOT hcover3
      have hnbrO0 : ∀ v, v ∈ O → (G.neighborFinset v ∩ O).card = 0 := by
        intro v hv
        rw [memO] at hv
        apply Finset.card_eq_zero.mpr
        rw [Finset.eq_empty_iff_forall_notMem]
        intro w hw
        rw [Finset.mem_inter, mem_neighborFinset, memO] at hw
        exact (hadj v w hw.1) (by rw [hv, hw.2])
      have hnbrOT : ∀ v, v ∈ O → (G.neighborFinset v ∩ Z).card + (G.neighborFinset v ∩ T).card = 3 := by
        intro v hv
        have hp := hpart_nbr v
        rw [hnbrO0 v hv, hnbrcard v] at hp
        omega
      have hR3 : 3 * O.card = (∑ v ∈ O, (G.neighborFinset v ∩ Z).card)
          + (∑ v ∈ O, (G.neighborFinset v ∩ T).card) := by
        have hsum : ∑ v ∈ O, ((G.neighborFinset v ∩ Z).card + (G.neighborFinset v ∩ T).card)
            = ∑ v ∈ O, (3:ℕ) := by
          apply Finset.sum_congr rfl; intro v hv; exact hnbrOT v hv
        rw [Finset.sum_add_distrib, Finset.sum_const_nat (fun _ _ => rfl)] at hsum
        rw [Nat.mul_comm] at hsum
        exact hsum.symm
      have hnbrT0 : ∀ v, v ∈ T → (G.neighborFinset v ∩ T).card = 0 := by
        intro v hv
        rw [memT] at hv
        apply Finset.card_eq_zero.mpr
        rw [Finset.eq_empty_iff_forall_notMem]
        intro w hw
        rw [Finset.mem_inter, mem_neighborFinset, memT] at hw
        exact (hadj v w hw.1) (by rw [hv, hw.2])
      have hnbrTZ : ∀ v, v ∈ T → (G.neighborFinset v ∩ Z).card + (G.neighborFinset v ∩ O).card = 3 := by
        intro v hv
        have hp := hpart_nbr v
        rw [hnbrT0 v hv, hnbrcard v] at hp
        omega
      have hR4 : 3 * T.card = (∑ v ∈ T, (G.neighborFinset v ∩ Z).card)
          + (∑ v ∈ T, (G.neighborFinset v ∩ O).card) := by
        have hsum : ∑ v ∈ T, ((G.neighborFinset v ∩ Z).card + (G.neighborFinset v ∩ O).card)
            = ∑ v ∈ T, (3:ℕ) := by
          apply Finset.sum_congr rfl; intro v hv; exact hnbrTZ v hv
        rw [Finset.sum_add_distrib, Finset.sum_const_nat (fun _ _ => rfl)] at hsum
        rw [Nat.mul_comm] at hsum
        exact hsum.symm
  11. The cross-edges satisfy e(O, Z) = 3|Za|, e(T, Z) = 3|Zb|, and e(T, O) = e(O, T).

    Vertices in Za have all 3 neighbors in O and none in T, while vertices in Zb have all 3 neighbors in T and none in O. By symmetry of edge counts between sets, e(O, Z) = e(Z, O) = 3|Za| and e(T, Z) = e(Z, T) = 3|Zb|, and e(T, O) = e(O, T).

    lines 287–331

    uses op309_ten_vertex_uniform_p3_host_selection_impossible_sum_nbr_comm, Finset.sum_union, Finset.sum_const_nat, Finset.sum_eq_zero

      have hnbrZa : ∀ w, w ∈ Za → (G.neighborFinset w ∩ O).card = 3 := by
        intro w hw
        rw [memZa] at hw
        have hsub : G.neighborFinset w ⊆ O := by
          intro x hx
          rw [mem_neighborFinset] at hx
          rw [memO]; exact hw.2 x hx
        rw [(Finset.inter_eq_left).mpr hsub, hnbrcard w]
      have hnbrZb_O : ∀ w, w ∈ Zb → (G.neighborFinset w ∩ O).card = 0 := by
        intro w hw
        rw [memZb] at hw
        apply Finset.card_eq_zero.mpr
        rw [Finset.eq_empty_iff_forall_notMem]
        intro x hx
        rw [Finset.mem_inter, mem_neighborFinset, memO] at hx
        have h2 : d x = 2 := hw.2 x hx.1
        omega
      have hR5 : (∑ v ∈ O, (G.neighborFinset v ∩ Z).card) = 3 * Za.card := by
        rw [op309_ten_vertex_uniform_p3_host_selection_impossible_sum_nbr_comm G O Z, ← hZaZb, Finset.sum_union hZaZb_disj]
        rw [Finset.sum_const_nat (fun w hw => hnbrZa w hw),
            Finset.sum_eq_zero (fun w hw => hnbrZb_O w hw), Nat.add_zero, Nat.mul_comm]
      have hnbrZb : ∀ w, w ∈ Zb → (G.neighborFinset w ∩ T).card = 3 := by
        intro w hw
        rw [memZb] at hw
        have hsub : G.neighborFinset w ⊆ T := by
          intro x hx
          rw [mem_neighborFinset] at hx
          rw [memT]; exact hw.2 x hx
        rw [(Finset.inter_eq_left).mpr hsub, hnbrcard w]
      have hnbrZa_T : ∀ w, w ∈ Za → (G.neighborFinset w ∩ T).card = 0 := by
        intro w hw
        rw [memZa] at hw
        apply Finset.card_eq_zero.mpr
        rw [Finset.eq_empty_iff_forall_notMem]
        intro x hx
        rw [Finset.mem_inter, mem_neighborFinset, memT] at hx
        have h1 : d x = 1 := hw.2 x hx.1
        omega
      have hR6 : (∑ v ∈ T, (G.neighborFinset v ∩ Z).card) = 3 * Zb.card := by
        rw [op309_ten_vertex_uniform_p3_host_selection_impossible_sum_nbr_comm G T Z, ← hZaZb, Finset.sum_union hZaZb_disj]
        rw [Finset.sum_eq_zero (fun w hw => hnbrZa_T w hw),
            Finset.sum_const_nat (fun w hw => hnbrZb w hw), Nat.zero_add, Nat.mul_comm]
      have hR7 : (∑ v ∈ T, (G.neighborFinset v ∩ O).card)
          = (∑ v ∈ O, (G.neighborFinset v ∩ T).card) := by
        rw [op309_ten_vertex_uniform_p3_host_selection_impossible_sum_nbr_comm G T O]
  12. The set sizes satisfy |O| = |R| and 2|T| = |R|.

    Double counting degrees in R against endpoints of edges in R shows that the sum of degrees over O is |O| and equals |R|, while the sum of degrees over T is 2|T| and also equals |R|.

    lines 332–355

    uses op309_ten_vertex_uniform_p3_host_selection_impossible_sel_double, op309_ten_vertex_uniform_p3_host_selection_impossible_sel_filters

      have hOsel : (∑ v ∈ O, (R.filter fun e => v ∈ e.1).card) = O.card := by
        have h1 : ∀ v ∈ O, (R.filter fun e => v ∈ e.1).card = 1 := by
          intro v hv; rw [← hd v, (memO v).mp hv]
        calc (∑ v ∈ O, (R.filter fun e => v ∈ e.1).card) = ∑ v ∈ O, (1:ℕ) := Finset.sum_congr rfl h1
          _ = O.card := by simp
      have hTsel : (∑ v ∈ T, (R.filter fun e => v ∈ e.1).card) = T.card * 2 := by
        have h1 : ∀ v ∈ T, (R.filter fun e => v ∈ e.1).card = 2 := by
          intro v hv; rw [← hd v, (memT v).mp hv]
        calc (∑ v ∈ T, (R.filter fun e => v ∈ e.1).card) = ∑ v ∈ T, (2:ℕ) := Finset.sum_congr rfl h1
          _ = T.card * 2 := Finset.sum_const_nat (fun _ _ => rfl)
      have hOsel_rhs : (∑ e ∈ R, (O.filter fun w => w ∈ e.1).card) = R.card := by
        have h1 : ∀ e ∈ R, (O.filter fun w => w ∈ e.1).card = 1 := by
          intro e he; exact (op309_ten_vertex_uniform_p3_host_selection_impossible_sel_filters G R d hd hle hadj e he).1
        calc (∑ e ∈ R, (O.filter fun w => w ∈ e.1).card) = ∑ e ∈ R, (1:ℕ) := Finset.sum_congr rfl h1
          _ = R.card := by simp
      have hTsel_rhs : (∑ e ∈ R, (T.filter fun w => w ∈ e.1).card) = R.card := by
        have h1 : ∀ e ∈ R, (T.filter fun w => w ∈ e.1).card = 1 := by
          intro e he; exact (op309_ten_vertex_uniform_p3_host_selection_impossible_sel_filters G R d hd hle hadj e he).2
        calc (∑ e ∈ R, (T.filter fun w => w ∈ e.1).card) = ∑ e ∈ R, (1:ℕ) := Finset.sum_congr rfl h1
          _ = R.card := by simp
      have hoR : O.card = R.card := by
        rw [← hOsel, op309_ten_vertex_uniform_p3_host_selection_impossible_sel_double G R O, hOsel_rhs]
      have hcR : T.card * 2 = R.card := by
        rw [← hTsel, op309_ten_vertex_uniform_p3_host_selection_impossible_sel_double G R T, hTsel_rhs]
  13. The number of edges between O and T satisfies |R| ≤ e(O, T).

    Each vertex v in O has d(v) = 1, meaning it is incident to an edge in R whose other endpoint is in T. Hence v has at least one neighbor in T, so d(v) ≤ |N(v) ∩ T|. Summing over all v in O gives |R| ≤ e(O, T).

    lines 356–380

    uses op309_ten_vertex_uniform_p3_host_selection_impossible_sel_oriented, op309_ten_vertex_uniform_p3_host_selection_impossible_sel_double, Finset.sum_le_sum, Finset.card_pos

      have hnbrT_ge : ∀ v, v ∈ O → d v ≤ (G.neighborFinset v ∩ T).card := by
        intro v hv
        rw [memO] at hv
        have hpos : 0 < (R.filter fun e => v ∈ e.1).card := by rw [← hd v, hv]; norm_num
        obtain ⟨e0, he0⟩ := Finset.card_pos.mp hpos
        rw [Finset.mem_filter] at he0
        obtain ⟨he0R, hv_mem⟩ := he0
        obtain ⟨u, w, huw, heq, hdu, hdw⟩ := op309_ten_vertex_uniform_p3_host_selection_impossible_sel_oriented G R d hd hle hadj e0 he0R
        have hwT : w ∈ T := (memT w).mpr hdw
        rw [heq, Sym2.mem_iff] at hv_mem
        have hmem : w ∈ G.neighborFinset v ∩ T := by
          rw [Finset.mem_inter, mem_neighborFinset]
          refine ⟨?_, hwT⟩
          rcases hv_mem with hvu | hvw
          · rw [hvu]; exact huw
          · exfalso; rw [hvw] at hv; omega
        rw [hv]
        have hpos2 : 0 < (G.neighborFinset v ∩ T).card := Finset.card_pos.mpr ⟨w, hmem⟩
        omega
      have hR9 : R.card ≤ ∑ v ∈ O, (G.neighborFinset v ∩ T).card := by
        have hL : (∑ v ∈ O, d v) = R.card := by
          rw [show (∑ v ∈ O, d v) = (∑ v ∈ O, (R.filter fun e => v ∈ e.1).card) from
            Finset.sum_congr rfl (fun v hv => hd v), op309_ten_vertex_uniform_p3_host_selection_impossible_sel_double G R O, hOsel_rhs]
        rw [← hL]
        exact Finset.sum_le_sum (fun v hv => hnbrT_ge v hv)
  14. The linear system has no solution, completing the contradiction. automation

    Linear integer arithmetic over ℕ shows the system |Za| + |Zb| + |O| + |T| = 10, 3|O| = 3|Za| + e(O, T), 3|T| = 3|Zb| + e(O, T), |O| = |R|, 2|T| = |R|, and |R| ≤ e(O, T) has no non-negative integer solution, closing the goal.

    line 381

      omega
Sym2.ind
Induction principle for unordered pairs: to prove a property for all unordered pairs, it suffices to prove it for pairs of the form s(x, y).
SimpleGraph.mem_edgeSet
An unordered pair s(v, w) is in the edge set of a simple graph G if and only if v and w are adjacent in G.
op309_ten_vertex_uniform_p3_host_selection_impossible_edge_endpoints
Every edge in the edge set of G can be represented as s(u, v) for some adjacent vertices u and v.
Sym2.mem_iff
An element a belongs to the unordered pair s(b, c) if and only if a = b or a = c.
Finset.one_le_card
A finite set has cardinality at least 1 if and only if it is nonempty.
Sym2.eq_iff
Two unordered pairs s(x, y) and s(z, w) are equal if and only if (x = z and y = w) or (x = w and y = z).
op309_ten_vertex_uniform_p3_host_selection_impossible_sel_oriented
Every edge in the selected set R connects a vertex of degree 1 to a vertex of degree 2.
Finset.card_singleton
The cardinality of a singleton set {a} is 1.
Finset.sum_congr
Two finite sums are equal if their index sets are equal and their summands agree on all elements.
Finset.card_filter
The number of elements in a finite set satisfying a predicate equals the sum over the set of the indicator of that predicate.
Finset.sum_comm
Exchanging the order of summation over two finite sets leaves the double sum unchanged.
mem_neighborFinset
A vertex w belongs to the neighbor finset of v if and only if v and w are adjacent in the graph.
SimpleGraph.adj_comm
Adjacency in a simple graph is symmetric: u is adjacent to v if and only if v is adjacent to u.
Finset.card_union_of_disjoint
The cardinality of the union of two disjoint finite sets is the sum of their cardinalities.
Finset.inter_subset_right
The intersection of two sets is a subset of the second set.
Finset.disjoint_union_left
The union of two sets is disjoint from a third set if and only if both sets are disjoint from the third.
op309_ten_vertex_uniform_p3_host_selection_impossible_card_inter_three
If three sets A, B, C are pairwise disjoint and cover the universe, then for any set s, |s ∩ A| + |s ∩ B| + |s ∩ C| = |s|.
Finset.univ_inter
The intersection of the universal set with any set s is s.
Finset.card_univ
The cardinality of the universal set of a finite type equals the cardinality of that type.
SimpleGraph.card_neighborFinset_eq_degree
The cardinality of the neighbor finset of a vertex equals its graph degree.
Finset.card_pos
A finite set has strictly positive cardinality if and only if it is nonempty.
op309_ten_vertex_uniform_p3_host_selection_impossible_card_inter_two
If A and B are disjoint and s ⊆ A ∪ B, then |s ∩ A| + |s ∩ B| = |s|.
Finset.card_eq_zero
A finite set has cardinality 0 if and only if it is empty.
Finset.eq_empty_iff_forall_notMem
A set is empty if and only if no element belongs to it.
Finset.sum_add_distrib
The sum of a sum of functions over a finite set equals the sum of the individual sums.
Finset.sum_const_nat
The sum of a constant natural number m over a finite set s equals |s| * m.
op309_ten_vertex_uniform_p3_host_selection_impossible_sum_nbr_comm
For any two vertex subsets S and T, the sum over S of neighbor counts in T equals the sum over T of neighbor counts in S.
Finset.sum_union
The sum over a disjoint union of two finite sets equals the sum of the sums over the individual sets.
Finset.sum_eq_zero
A sum over a finite set is 0 if every summand is 0.
op309_ten_vertex_uniform_p3_host_selection_impossible_sel_double
Double counting: the sum over vertices in S of their incident edges in R equals the sum over edges in R of their endpoints in S.
op309_ten_vertex_uniform_p3_host_selection_impossible_sel_filters
For every edge in R, exactly one of its endpoints has degree 1 and exactly one has degree 2.
Finset.sum_le_sum
If f(i) ≤ g(i) for all i in a finite set s, then the sum of f over s is at most the sum of g over s.

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

Lean’s trace was cut to the first 400 of 404 tactics.

open SimpleGraph Finsetprivate lemma op309_ten_vertex_uniform_p3_host_selection_impossible_edge_endpoints {V : Type*} [Fintype V] [DecidableEq V]    (G : SimpleGraph V) [DecidableRel G.Adj] (e : G.edgeSet) :    ∃ u v, G.Adj u v ∧ e.1 = s(u, v) := by  have key : ∀ x : Sym2 V, x ∈ G.edgeSet → ∃ u v : V, G.Adj u v ∧ x = s(u, v) := by    intro x hx    induction x using Sym2.ind with    | _ u v => exact ⟨u, v, (SimpleGraph.mem_edgeSet G).mp hx, rfl⟩  exact key e.1 e.2private lemma op309_ten_vertex_uniform_p3_host_selection_impossible_sel_oriented {V : Type*} [Fintype V] [DecidableEq V]    (G : SimpleGraph V) [DecidableRel G.Adj] (R : Finset G.edgeSet) (d : V → ℕ)    (hd : ∀ v, d v = (R.filter fun e => v ∈ e.1).card)    (hle : ∀ v, d v ≤ 2) (hadj : ∀ u v, G.Adj u v → d u ≠ d v)    (e : G.edgeSet) (he : e ∈ R) :    ∃ u v, G.Adj u v ∧ e.1 = s(u, v) ∧ d u = 1 ∧ d v = 2 := by  classical  obtain ⟨a, b, hab, heq⟩ := op309_ten_vertex_uniform_p3_host_selection_impossible_edge_endpoints G e  have hamem : a ∈ e.1 := by rw [heq]; exact Sym2.mem_iff.mpr (Or.inl rfl)  have hbmem : b ∈ e.1 := by rw [heq]; exact Sym2.mem_iff.mpr (Or.inr rfl)  have hda1 : 1 ≤ d a := by    rw [hd a, Finset.one_le_card]; exact ⟨e, by simp [he, hamem]⟩  have hdb1 : 1 ≤ d b := by    rw [hd b, Finset.one_le_card]; exact ⟨e, by simp [he, hbmem]⟩  have hne := hadj a b hab  have ha2 := hle a; have hb2 := hle b  have hcases : (d a = 1 ∧ d b = 2) ∨ (d a = 2 ∧ d b = 1) := by omega  rcases hcases with ⟨ha, hb⟩ | ⟨ha, hb⟩  · exact ⟨a, b, hab, heq, ha, hb⟩  · refine ⟨b, a, (G.adj_comm a b).mp hab, ?_, hb, ha⟩    rw [heq, Sym2.eq_iff]; exact Or.inr ⟨rfl, rfl⟩private lemma op309_ten_vertex_uniform_p3_host_selection_impossible_sel_filters {V : Type*} [Fintype V] [DecidableEq V]    (G : SimpleGraph V) [DecidableRel G.Adj] (R : Finset G.edgeSet) (d : V → ℕ)    (hd : ∀ v, d v = (R.filter fun e => v ∈ e.1).card)    (hle : ∀ v, d v ≤ 2) (hadj : ∀ u v, G.Adj u v → d u ≠ d v)    (e : G.edgeSet) (he : e ∈ R) :    ((Finset.univ.filter (fun w => d w = 1)).filter (fun w => w ∈ e.1)).card = 1 ∧    ((Finset.univ.filter (fun w => d w = 2)).filter (fun w => w ∈ e.1)).card = 1 := by  classical  obtain ⟨u, v, huv, heq, hdu, hdv⟩ := op309_ten_vertex_uniform_p3_host_selection_impossible_sel_oriented G R d hd hle hadj e he  constructor  · have hset : (Finset.univ.filter (fun w => d w = 1)).filter (fun w => w ∈ e.1) = {u} := by      ext w      rw [heq]      simp only [Finset.mem_filter, Finset.mem_univ, true_and, Sym2.mem_iff, Finset.mem_singleton]      constructor      · rintro ⟨hdw, hwu | hwv⟩        · exact hwu        · rw [hwv] at hdw; omega      · rintro rfl; exact ⟨hdu, Or.inl rfl⟩    rw [hset, Finset.card_singleton]  · have hset : (Finset.univ.filter (fun w => d w = 2)).filter (fun w => w ∈ e.1) = {v} := by      ext w      rw [heq]      simp only [Finset.mem_filter, Finset.mem_univ, true_and, Sym2.mem_iff, Finset.mem_singleton]      constructor      · rintro ⟨hdw, hwu | hwv⟩        · rw [hwu] at hdw; omega        · exact hwv      · rintro rfl; exact ⟨hdv, Or.inr rfl⟩    rw [hset, Finset.card_singleton]private lemma op309_ten_vertex_uniform_p3_host_selection_impossible_sel_double {V : Type*} [Fintype V] [DecidableEq V]    (G : SimpleGraph V) [DecidableRel G.Adj] (R : Finset G.edgeSet) (S : Finset V) :    ∑ v ∈ S, (R.filter fun e => v ∈ e.1).card      = ∑ e ∈ R, (S.filter fun w => w ∈ e.1).card := by  classical  calc ∑ v ∈ S, (R.filter fun e => v ∈ e.1).card      = ∑ v ∈ S, ∑ e ∈ R, (if v ∈ e.1 then 1 else 0) := by        apply Finset.sum_congr rfl; intro v hv        rw [Finset.card_filter]    _ = ∑ e ∈ R, ∑ v ∈ S, (if v ∈ e.1 then 1 else 0) := Finset.sum_comm    _ = ∑ e ∈ R, (S.filter fun w => w ∈ e.1).card := by        apply Finset.sum_congr rfl; intro e he        rw [Finset.card_filter]private lemma op309_ten_vertex_uniform_p3_host_selection_impossible_sum_nbr_comm {V : Type*} [Fintype V] [DecidableEq V]    (G : SimpleGraph V) [DecidableRel G.Adj] (S TT : Finset V) :    ∑ v ∈ S, (G.neighborFinset v ∩ TT).card = ∑ w ∈ TT, (G.neighborFinset w ∩ S).card := by  classical  have h1 : ∀ v, G.neighborFinset v ∩ TT = TT.filter (fun w => G.Adj v w) := by    intro v; ext w; simp [mem_neighborFinset, and_comm]  have h2 : ∀ w, G.neighborFinset w ∩ S = S.filter (fun v => G.Adj w v) := by    intro w; ext v; simp [mem_neighborFinset, and_comm]  calc ∑ v ∈ S, (G.neighborFinset v ∩ TT).card      = ∑ v ∈ S, ∑ w ∈ TT, (if G.Adj v w then 1 else 0) := by        apply Finset.sum_congr rfl; intro v hv        rw [h1 v, Finset.card_filter]    _ = ∑ w ∈ TT, ∑ v ∈ S, (if G.Adj v w then 1 else 0) := Finset.sum_comm    _ = ∑ w ∈ TT, (G.neighborFinset w ∩ S).card := by        apply Finset.sum_congr rfl; intro w hw        rw [h2 w, Finset.card_filter]        apply Finset.sum_congr rfl; intro v hv        simp only [SimpleGraph.adj_comm]private lemma op309_ten_vertex_uniform_p3_host_selection_impossible_card_inter_three {α : Type*} [Fintype α] [DecidableEq α] (s A B C : Finset α)    (hAB : Disjoint A B) (hAC : Disjoint A C) (hBC : Disjoint B C)    (hcover : A ∪ B ∪ C = Finset.univ) :    (s ∩ A).card + (s ∩ B).card + (s ∩ C).card = s.card := by  classical  have hunion : (s ∩ A) ∪ (s ∩ B) ∪ (s ∩ C) = s := by    ext w    simp only [Finset.mem_union, Finset.mem_inter]    constructor    · rintro ((⟨hw, _⟩ | ⟨hw, _⟩) | ⟨hw, _⟩) <;> exact hw    · intro hw      have hmem : w ∈ A ∪ B ∪ C := by rw [hcover]; exact Finset.mem_univ w      rcases (Finset.mem_union.mp hmem) with hAB' | hC      · rcases (Finset.mem_union.mp hAB') with hA | hB        · exact Or.inl (Or.inl ⟨hw, hA⟩)        · exact Or.inl (Or.inr ⟨hw, hB⟩)      · exact Or.inr ⟨hw, hC⟩  have hdAB : Disjoint (s ∩ A) (s ∩ B) := hAB.mono Finset.inter_subset_right Finset.inter_subset_right  have hdAC : Disjoint (s ∩ A) (s ∩ C) := hAC.mono Finset.inter_subset_right Finset.inter_subset_right  have hdBC : Disjoint (s ∩ B) (s ∩ C) := hBC.mono Finset.inter_subset_right Finset.inter_subset_right  have hdAB_C : Disjoint ((s ∩ A) ∪ (s ∩ B)) (s ∩ C) := by    rw [Finset.disjoint_union_left]; exact ⟨hdAC, hdBC⟩  have hcard : ((s ∩ A) ∪ (s ∩ B) ∪ (s ∩ C)).card      = (s ∩ A).card + (s ∩ B).card + (s ∩ C).card := by    rw [Finset.card_union_of_disjoint hdAB_C, Finset.card_union_of_disjoint hdAB]  rw [hunion] at hcard  exact hcard.symmprivate lemma op309_ten_vertex_uniform_p3_host_selection_impossible_card_inter_two {α : Type*} [DecidableEq α] (s A B : Finset α)    (hAB : Disjoint A B) (hs : s ⊆ A ∪ B) :    (s ∩ A).card + (s ∩ B).card = s.card := by  classical  have hunion : (s ∩ A) ∪ (s ∩ B) = s := by    ext w; simp only [Finset.mem_union, Finset.mem_inter]    constructor    · rintro (⟨hw,_⟩ | ⟨hw,_⟩) <;> exact hw    · intro hw      rcases Finset.mem_union.mp (hs hw) with h | h      · exact Or.inl ⟨hw, h⟩      · exact Or.inr ⟨hw, h⟩  have hd : Disjoint (s ∩ A) (s ∩ B) := hAB.mono Finset.inter_subset_right Finset.inter_subset_right  have hcard : ((s ∩ A) ∪ (s ∩ B)).card = (s ∩ A).card + (s ∩ B).card :=    Finset.card_union_of_disjoint hd  rw [hunion] at hcard  exact hcard.symmtheorem op309_ten_vertex_uniform_p3_host_selection_impossible    {V : Type*} [Fintype V] [DecidableEq V]    (G : SimpleGraph V) [DecidableRel G.Adj]    (R : Finset G.edgeSet) :    Fintype.card V = 10 →    (∀ v, (G.neighborSet v).ncard = 3) →    let d : V → ℕ := fun v => (R.filter fun e => v ∈ e.1).card    (∀ v, d v ≤ 2) →    (∀ u v, G.Adj u v → d u ≠ d v) →    (∀ u v w, d u = 0 → G.Adj u v → G.Adj u w → d v = d w) →    False := by  classical  intro hcard hdeg  let d : V → ℕ := fun v => (R.filter fun e => v ∈ e.1).card  change (∀ v, d v ≤ 2) → (∀ u v, G.Adj u v → d u ≠ d v) →    (∀ u v w, d u = 0 → G.Adj u v → G.Adj u w → d v = d w) → False  intro hle hadj hunif  have hd : ∀ v, d v = (R.filter fun e => v ∈ e.1).card := fun v => rfl  let Z : Finset V := Finset.univ.filter (fun v => d v = 0)  let O : Finset V := Finset.univ.filter (fun v => d v = 1)  let T : Finset V := Finset.univ.filter (fun v => d v = 2)  let Za : Finset V := Z.filter (fun v => ∀ w, G.Adj v w → d w = 1)  let Zb : Finset V := Z.filter (fun v => ∀ w, G.Adj v w → d w = 2)  have memZ : ∀ v, v ∈ Z ↔ d v = 0 := by intro v; simp [Z]  have memO : ∀ v, v ∈ O ↔ d v = 1 := by intro v; simp [O]  have memT : ∀ v, v ∈ T ↔ d v = 2 := by intro v; simp [T]  have memZa : ∀ v, v ∈ Za ↔ d v = 0 ∧ (∀ w, G.Adj v w → d w = 1) := by    intro v; simp [Za, Z]  have memZb : ∀ v, v ∈ Zb ↔ d v = 0 ∧ (∀ w, G.Adj v w → d w = 2) := by    intro v; simp [Zb, Z]  have hd012 : ∀ v, d v = 0 ∨ d v = 1 ∨ d v = 2 := by    intro v; have := hle v; omega  have hcover3 : Z ∪ O ∪ T = Finset.univ := by    ext v    simp only [Finset.mem_union, Finset.mem_univ]    constructor    · rintro _; exact trivial    · intro _      rcases hd012 v with h | h | h      · exact Or.inl (Or.inl ((memZ v).mpr h))      · exact Or.inl (Or.inr ((memO v).mpr h))      · exact Or.inr ((memT v).mpr h)  have hZO : Disjoint Z O := by    rw [Finset.disjoint_left]; intro v hv hv'    rw [memZ] at hv; rw [memO] at hv'; omega  have hZT : Disjoint Z T := by    rw [Finset.disjoint_left]; intro v hv hv'    rw [memZ] at hv; rw [memT] at hv'; omega  have hOT : Disjoint O T := by    rw [Finset.disjoint_left]; intro v hv hv'    rw [memO] at hv; rw [memT] at hv'; omega  have hcardZOT : Z.card + O.card + T.card = 10 := by    have h := op309_ten_vertex_uniform_p3_host_selection_impossible_card_inter_three (Finset.univ : Finset V) Z O T hZO hZT hOT hcover3    simp only [Finset.univ_inter, Finset.card_univ, hcard] at h    exact h  have hdeg3 : ∀ v, G.degree v = 3 := by    intro v    rw [show G.degree v = (G.neighborSet v).ncard from by      rw [← SimpleGraph.card_neighborSet_eq_degree, Set.ncard_eq_toFinset_card', ← Set.toFinset_card],      hdeg v]  have hnbrcard : ∀ v, (G.neighborFinset v).card = 3 := by    intro v; rw [SimpleGraph.card_neighborFinset_eq_degree, hdeg3 v]  have hnbr_ne : ∀ v, (G.neighborFinset v).Nonempty := by    intro v    have h : 0 < (G.neighborFinset v).card := by rw [hnbrcard v]; norm_num    exact Finset.card_pos.mp h  have hZa_sub : Za ⊆ Z := fun v hv => by rw [memZa] at hv; exact (memZ v).mpr hv.1  have hZb_sub : Zb ⊆ Z := fun v hv => by rw [memZb] at hv; exact (memZ v).mpr hv.1  have hZaZb_disj : Disjoint Za Zb := by    rw [Finset.disjoint_left]    intro v hv hv'    rw [memZa] at hv; rw [memZb] at hv'    obtain ⟨w, hw⟩ := hnbr_ne v    rw [mem_neighborFinset] at hw    have h1 := hv.2 w hw    have h2 := hv'.2 w hw    omega  have hZaZb : Za ∪ Zb = Z := by    ext v    simp only [Finset.mem_union]    constructor    · rintro (h | h)      · exact hZa_sub h      · exact hZb_sub h    · intro hv      rw [memZ] at hv      obtain ⟨w, hw⟩ := hnbr_ne v      rw [mem_neighborFinset] at hw      have hdw_ne : d w ≠ 0 := by        intro h0; exact (hadj v w hw) (by rw [hv, h0])      have hdw := hle w      rcases (show d w = 1 ∨ d w = 2 by omega) with h1 | h2      · left; rw [memZa]; exact ⟨hv, fun x hx => (hunif v w x hv hw hx).symm.trans h1⟩      · right; rw [memZb]; exact ⟨hv, fun x hx => (hunif v w x hv hw hx).symm.trans h2⟩  have hab : Za.card + Zb.card = Z.card := by    have h := op309_ten_vertex_uniform_p3_host_selection_impossible_card_inter_two Z Za Zb hZaZb_disj (fun v hv => by rw [hZaZb]; exact hv)    rwa [(Finset.inter_eq_right).mpr hZa_sub, (Finset.inter_eq_right).mpr hZb_sub] at h  have hpart_nbr : ∀ v, (G.neighborFinset v ∩ Z).card + (G.neighborFinset v ∩ O).card      + (G.neighborFinset v ∩ T).card = (G.neighborFinset v).card := by    intro v    exact op309_ten_vertex_uniform_p3_host_selection_impossible_card_inter_three (G.neighborFinset v) Z O T hZO hZT hOT hcover3  have hnbrO0 : ∀ v, v ∈ O → (G.neighborFinset v ∩ O).card = 0 := by    intro v hv    rw [memO] at hv    apply Finset.card_eq_zero.mpr    rw [Finset.eq_empty_iff_forall_notMem]    intro w hw    rw [Finset.mem_inter, mem_neighborFinset, memO] at hw    exact (hadj v w hw.1) (by rw [hv, hw.2])  have hnbrOT : ∀ v, v ∈ O → (G.neighborFinset v ∩ Z).card + (G.neighborFinset v ∩ T).card = 3 := by    intro v hv    have hp := hpart_nbr v    rw [hnbrO0 v hv, hnbrcard v] at hp    omega  have hR3 : 3 * O.card = (∑ v ∈ O, (G.neighborFinset v ∩ Z).card)      + (∑ v ∈ O, (G.neighborFinset v ∩ T).card) := by    have hsum : ∑ v ∈ O, ((G.neighborFinset v ∩ Z).card + (G.neighborFinset v ∩ T).card)        = ∑ v ∈ O, (3:ℕ) := by      apply Finset.sum_congr rfl; intro v hv; exact hnbrOT v hv    rw [Finset.sum_add_distrib, Finset.sum_const_nat (fun _ _ => rfl)] at hsum    rw [Nat.mul_comm] at hsum    exact hsum.symm  have hnbrT0 : ∀ v, v ∈ T → (G.neighborFinset v ∩ T).card = 0 := by    intro v hv    rw [memT] at hv    apply Finset.card_eq_zero.mpr    rw [Finset.eq_empty_iff_forall_notMem]    intro w hw    rw [Finset.mem_inter, mem_neighborFinset, memT] at hw    exact (hadj v w hw.1) (by rw [hv, hw.2])  have hnbrTZ : ∀ v, v ∈ T → (G.neighborFinset v ∩ Z).card + (G.neighborFinset v ∩ O).card = 3 := by    intro v hv    have hp := hpart_nbr v    rw [hnbrT0 v hv, hnbrcard v] at hp    omega  have hR4 : 3 * T.card = (∑ v ∈ T, (G.neighborFinset v ∩ Z).card)      + (∑ v ∈ T, (G.neighborFinset v ∩ O).card) := by    have hsum : ∑ v ∈ T, ((G.neighborFinset v ∩ Z).card + (G.neighborFinset v ∩ O).card)        = ∑ v ∈ T, (3:ℕ) := by      apply Finset.sum_congr rfl; intro v hv; exact hnbrTZ v hv    rw [Finset.sum_add_distrib, Finset.sum_const_nat (fun _ _ => rfl)] at hsum    rw [Nat.mul_comm] at hsum    exact hsum.symm  have hnbrZa : ∀ w, w ∈ Za → (G.neighborFinset w ∩ O).card = 3 := by    intro w hw    rw [memZa] at hw    have hsub : G.neighborFinset w ⊆ O := by      intro x hx      rw [mem_neighborFinset] at hx      rw [memO]; exact hw.2 x hx    rw [(Finset.inter_eq_left).mpr hsub, hnbrcard w]  have hnbrZb_O : ∀ w, w ∈ Zb → (G.neighborFinset w ∩ O).card = 0 := by    intro w hw    rw [memZb] at hw    apply Finset.card_eq_zero.mpr    rw [Finset.eq_empty_iff_forall_notMem]    intro x hx    rw [Finset.mem_inter, mem_neighborFinset, memO] at hx    have h2 : d x = 2 := hw.2 x hx.1    omega  have hR5 : (∑ v ∈ O, (G.neighborFinset v ∩ Z).card) = 3 * Za.card := by    rw [op309_ten_vertex_uniform_p3_host_selection_impossible_sum_nbr_comm G O Z, ← hZaZb, Finset.sum_union hZaZb_disj]    rw [Finset.sum_const_nat (fun w hw => hnbrZa w hw),        Finset.sum_eq_zero (fun w hw => hnbrZb_O w hw), Nat.add_zero, Nat.mul_comm]  have hnbrZb : ∀ w, w ∈ Zb → (G.neighborFinset w ∩ T).card = 3 := by    intro w hw    rw [memZb] at hw    have hsub : G.neighborFinset w ⊆ T := by      intro x hx      rw [mem_neighborFinset] at hx      rw [memT]; exact hw.2 x hx    rw [(Finset.inter_eq_left).mpr hsub, hnbrcard w]  have hnbrZa_T : ∀ w, w ∈ Za → (G.neighborFinset w ∩ T).card = 0 := by    intro w hw    rw [memZa] at hw    apply Finset.card_eq_zero.mpr    rw [Finset.eq_empty_iff_forall_notMem]    intro x hx    rw [Finset.mem_inter, mem_neighborFinset, memT] at hx    have h1 : d x = 1 := hw.2 x hx.1    omega  have hR6 : (∑ v ∈ T, (G.neighborFinset v ∩ Z).card) = 3 * Zb.card := by    rw [op309_ten_vertex_uniform_p3_host_selection_impossible_sum_nbr_comm G T Z, ← hZaZb, Finset.sum_union hZaZb_disj]    rw [Finset.sum_eq_zero (fun w hw => hnbrZa_T w hw),        Finset.sum_const_nat (fun w hw => hnbrZb w hw), Nat.zero_add, Nat.mul_comm]  have hR7 : (∑ v ∈ T, (G.neighborFinset v ∩ O).card)      = (∑ v ∈ O, (G.neighborFinset v ∩ T).card) := by    rw [op309_ten_vertex_uniform_p3_host_selection_impossible_sum_nbr_comm G T O]  have hOsel : (∑ v ∈ O, (R.filter fun e => v ∈ e.1).card) = O.card := by    have h1 : ∀ v ∈ O, (R.filter fun e => v ∈ e.1).card = 1 := by      intro v hv; rw [← hd v, (memO v).mp hv]    calc (∑ v ∈ O, (R.filter fun e => v ∈ e.1).card) = ∑ v ∈ O, (1:ℕ) := Finset.sum_congr rfl h1      _ = O.card := by simp  have hTsel : (∑ v ∈ T, (R.filter fun e => v ∈ e.1).card) = T.card * 2 := by    have h1 : ∀ v ∈ T, (R.filter fun e => v ∈ e.1).card = 2 := by      intro v hv; rw [← hd v, (memT v).mp hv]    calc (∑ v ∈ T, (R.filter fun e => v ∈ e.1).card) = ∑ v ∈ T, (2:ℕ) := Finset.sum_congr rfl h1      _ = T.card * 2 := Finset.sum_const_nat (fun _ _ => rfl)  have hOsel_rhs : (∑ e ∈ R, (O.filter fun w => w ∈ e.1).card) = R.card := by    have h1 : ∀ e ∈ R, (O.filter fun w => w ∈ e.1).card = 1 := by      intro e he; exact (op309_ten_vertex_uniform_p3_host_selection_impossible_sel_filters G R d hd hle hadj e he).1    calc (∑ e ∈ R, (O.filter fun w => w ∈ e.1).card) = ∑ e ∈ R, (1:ℕ) := Finset.sum_congr rfl h1      _ = R.card := by simp  have hTsel_rhs : (∑ e ∈ R, (T.filter fun w => w ∈ e.1).card) = R.card := by    have h1 : ∀ e ∈ R, (T.filter fun w => w ∈ e.1).card = 1 := by      intro e he; exact (op309_ten_vertex_uniform_p3_host_selection_impossible_sel_filters G R d hd hle hadj e he).2    calc (∑ e ∈ R, (T.filter fun w => w ∈ e.1).card) = ∑ e ∈ R, (1:ℕ) := Finset.sum_congr rfl h1      _ = R.card := by simp  have hoR : O.card = R.card := by    rw [← hOsel, op309_ten_vertex_uniform_p3_host_selection_impossible_sel_double G R O, hOsel_rhs]  have hcR : T.card * 2 = R.card := by    rw [← hTsel, op309_ten_vertex_uniform_p3_host_selection_impossible_sel_double G R T, hTsel_rhs]  have hnbrT_ge : ∀ v, v ∈ O → d v ≤ (G.neighborFinset v ∩ T).card := by    intro v hv    rw [memO] at hv    have hpos : 0 < (R.filter fun e => v ∈ e.1).card := by rw [← hd v, hv]; norm_num    obtain ⟨e0, he0⟩ := Finset.card_pos.mp hpos    rw [Finset.mem_filter] at he0    obtain ⟨he0R, hv_mem⟩ := he0    obtain ⟨u, w, huw, heq, hdu, hdw⟩ := op309_ten_vertex_uniform_p3_host_selection_impossible_sel_oriented G R d hd hle hadj e0 he0R    have hwT : w ∈ T := (memT w).mpr hdw    rw [heq, Sym2.mem_iff] at hv_mem    have hmem : w ∈ G.neighborFinset v ∩ T := by      rw [Finset.mem_inter, mem_neighborFinset]      refine ⟨?_, hwT⟩      rcases hv_mem with hvu | hvw      · rw [hvu]; exact huw      · exfalso; rw [hvw] at hv; omega    rw [hv]    have hpos2 : 0 < (G.neighborFinset v ∩ T).card := Finset.card_pos.mpr ⟨w, hmem⟩    omega  have hR9 : R.card ≤ ∑ v ∈ O, (G.neighborFinset v ∩ T).card := by    have hL : (∑ v ∈ O, d v) = R.card := by      rw [show (∑ v ∈ O, d v) = (∑ v ∈ O, (R.filter fun e => v ∈ e.1).card) from        Finset.sum_congr rfl (fun v hv => hd v), op309_ten_vertex_uniform_p3_host_selection_impossible_sel_double G R O, hOsel_rhs]    rw [← hL]    exact Finset.sum_le_sum (fun v hv => hnbrT_ge v hv)  omega
See it in the graphDiscuss this resultChallenge it