AFTD Auto-Formalizing Theoretical Domains

even_linked_double_star_polarized_dense_tips

theoremverified

Take opposite-color centers complete to A of size at least n+1. In the disjoint exterior W of size at least 3k+2m−1, take a k-set S and a disjoint D of size at least k+2m−1. Here k≥2 and 1≤m≤k. Each row of S misses at most m−1 red neighbors in D, and all but a designated subset of at most half the rows have a red edge to A. Then one color contains the linked double star of path order 2(k+1) with arms n,m.

Statement

theorem even_linked_double_star_polarized_dense_tips {V : Type*} [DecidableEq V]
    (G : SimpleGraph V) [DecidableRel G.Adj] (k n m : ℕ) (hk : 2 ≤ k) (hm : 1 ≤ m) (hmk : m ≤ k)
    (r b : V) (A W S D B : Finset V) (hrA : r ∉ A) (hrW : r ∉ W) (hbA : b ∉ A) (hbW : b ∉ W)
    (hAW : Disjoint A W) (hA : n+1 ≤ A.card)
    (hr : ∀ a ∈ A, G.Adj r a) (hbl : ∀ a ∈ A, Gᶜ.Adj b a)
    (hW : 3*k+2*m-1 ≤ W.card) (hS : S ⊆ W) (hD : D ⊆ W) (hdis : Disjoint S D) (hsize : S.card=k)
    (hd : k+2*m-1 ≤ D.card) (hbad : B ⊆ S) (hb : 2*B.card ≤ k)
    (hgood : ∀ x ∈ S, x ∉ B → ∃ a ∈ A, G.Adj x a)
    (hmiss : ∀ x ∈ S, (D.filter (fun v => ¬G.Adj x v)).card ≤ m-1) :
    (even_linked_double_star (k+1) n m).IsContained G ∨ (even_linked_double_star (k+1) n m).IsContained Gᶜ
Source
https://arxiv.org/abs/2611.19632; structural lemma for OP-1853.
Verified
29 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 3
  • even_linked_double_starFor natural numbers p, n, and m, the even-linked double star S_{2p}(n, m) is the simple graph on vertex set Fin(2p) ⊕ Fin(n) ⊕ Fin(m)…
  • even_linked_double_star_polarized_cycle_switchSuppose a center has at least n+1 neighbors in a set A disjoint from an exterior W. In disjoint S,D within W, take k≥2 rows S and at least…
  • FThe prime field $\mathrm{GF}(p)$, realized as $\mathbb{Z}/p\mathbb{Z}$ via ZMod.
Used by 1

The proof, explained

Assume neither the graph G nor its complement G^c contains the linked double star of order 2(k+1) with arms n, m. By repeatedly applying cycle switching, we obtain three mutually disjoint k-sets P, Q, L in the exterior W, forming alternating cycles and with polarized adjacencies to the center set A. A vertex z in L has few red neighbors in the remaining exterior, forcing it to have a blue neighbor in P and at least m blue neighbors in the remaining exterior E. Rerouting the blue cycle between P and Q to z produces a blue path of length 2k, to which we attach the complement center b, a vertex of A, and star leaves from A and E, embedding the linked double star into G^c for a contradiction.

  1. An embedding into G is constructed from the path and the two leaf sets.

    We assemble the path and star functions into a single map from the disjoint union into the vertex set.

    lines 11–12

      let f := Sum.elim path (Sum.elim left right)
      refine ⟨⟨⟨f,?_⟩,hinj⟩⟩
  2. The map preserves all edges of the linked double star.

    Case analysis on the definition of edges in the linked double star verifies that each edge is mapped to an edge of G.

    lines 13–23

      intro x y h
      rcases h.2 with h | h <;>
        rcases h with ⟨i,j,rfl,rfl,h|h⟩ | ⟨i,j,h,⟨rfl,rfl⟩|⟨rfl,rfl⟩⟩ | ⟨i,j,h,⟨rfl,rfl⟩|⟨rfl,rfl⟩⟩
      all_goals dsimp [f]
      all_goals first
        | exact hp _ _ (by assumption)
        | exact (hp _ _ (by assumption)).symm
        | exact hl _ (by assumption) _
        | exact (hl _ (by assumption) _).symm
        | exact hr _ (by assumption) _
        | exact (hr _ (by assumption) _).symm
  3. The sum of two injective maps with disjoint ranges is injective.

    Case analysis on the disjoint sum demonstrates injectivity.

    lines 28–32

      rintro (x|x) (y|y) he
      · exact congrArg Sum.inl (hf he)
      · exact (h x y he).elim
      · exact (h y x he.symm).elim
      · exact congrArg Sum.inr (hg he)
  4. Any finite set of size at least k admits an embedding of Fin k.

    We obtain an embedding from Fin k into the subtype and compose with the subtype inclusion.

    lines 36–39

      classical
      have he : Nonempty (Fin k ↪ ↥S) := Function.Embedding.nonempty_of_card_le (by simpa using h)
      obtain ⟨e⟩ := he
      exact ⟨e.trans (Function.Embedding.subtype _),fun i => (e i).property⟩
  5. We embed the leaf stars and define an extended path of order 2(k+1).

    We choose n leaves from A \ {a} and m leaves from the neighbors of the path endpoint, then prepend r and a to the path.

    lines 49–62

      classical
      obtain ⟨L,hL⟩ := ds1310_polarized_dense_tips_embed_fin (A.erase a) n (by rw [Finset.card_erase_of_mem ha]; omega)
      obtain ⟨R,hR⟩ := ds1310_polarized_dense_tips_embed_fin (D.filter (G.Adj (P ⟨2*k-1,by omega⟩))) m hd
      let F (i : Fin (2*(k+1))) := if h : i.val < 2 then (if i.val=0 then r else a) else P ⟨i.val-2,by omega⟩
      have hAW' (x y) (hx : x ∈ A) (hy : y ∈ W) : x ≠ y := fun he => Finset.disjoint_left.mp hAW hx (he ▸ hy)
      have hR' (i) : R i ∈ D := (Finset.mem_filter.mp (hR i)).1
      have hL' (i) : L i ∈ A := (Finset.mem_erase.mp (hL i)).2
      have hrn (v) (h : v ∈ W) : r ≠ v := fun he => hrW (he ▸ h)
      have hra : r ≠ a := fun he => hrA (he ▸ ha)
      have hDis (i j) : P i ≠ R j := fun he => hD i (he ▸ hR' j)
      have hF0 (i : Fin (2*(k+1))) (h : i.val=0) : F i=r := by simp only [F,dif_pos (show i.val < 2 by omega),if_pos h]
      have hF1 (i : Fin (2*(k+1))) (h : i.val=1) : F i=a := by simp only [F,dif_pos (show i.val < 2 by omega),if_neg (show i.val ≠ 0 by omega)]
      have hF2 (i : Fin (2*(k+1))) (h : 2 ≤ i.val) : F i=P ⟨i.val-2,by omega⟩ := by
        simp only [F,dif_neg (show ¬i.val < 2 by omega)]
  6. The combined map for the attached double star is injective.

    Pairwise disjointness between r, A, W, and the selected subsets ensures injectivity.

    lines 63–89

      apply ds1310_polarized_dense_tips_copy_of_arrays F L R
      · apply ds1310_polarized_dense_tips_sum_inj
        · intro i j he
          rcases (show i.val=0 ∨ i.val=1 ∨ 2 ≤ i.val by omega) with h|h|h <;>
            rcases (show j.val=0 ∨ j.val=1 ∨ 2 ≤ j.val by omega) with h'|h'|h'
          all_goals first | rw [hF0 i h] at he | rw [hF1 i h] at he | rw [hF2 i h] at he
          all_goals first | rw [hF0 j h'] at he | rw [hF1 j h'] at he | rw [hF2 j h'] at he
          all_goals first
            | exact (hra he).elim | exact (hra he.symm).elim
            | exact (hrn _ (hP _) he).elim | exact (hrn _ (hP _) he.symm).elim
            | exact (hAW' _ _ ha (hP _) he).elim | exact (hAW' _ _ ha (hP _) he.symm).elim
            | have hh := congrArg Fin.val (P.injective he); apply Fin.ext; dsimp at hh; omega
            | apply Fin.ext; omega
        · exact ds1310_polarized_dense_tips_sum_inj L.injective R.injective (fun i j => hAW' _ _ (hL' i) (hDW (hR' j)))
        · rintro i (j|j) he
          · change F i=L j at he
            dsimp [F] at he; split at he
            · split at he
              · exact hrA (he ▸ hL' j)
              · exact (Finset.mem_erase.mp (hL j)).1 he.symm
            · exact hAW' _ _ (hL' j) (hP _) he.symm
          · change F i=R j at he
            dsimp [F] at he; split at he
            · split at he
              · exact hrn _ (hDW (hR' j)) he
              · exact hAW' _ _ ha (hDW (hR' j)) he
            · exact hDis _ _ he
  7. The extended path and star connections satisfy all adjacency conditions in G.

    Edges along the path and from the ends to the leaf sets are verified from the hypotheses.

    lines 90–101

      · intro i j hij
        rcases (show i.val=0 ∨ i.val=1 ∨ 2 ≤ i.val by omega) with h|h|h
        · rw [hF0 i h,hF1 j (by omega)]; exact hr _ ha
        · rw [hF1 i h,hF2 j (by omega)]
          have hj : j.val-2=0 := by omega
          simpa only [hj] using haP
        · rw [hF2 i h,hF2 j (by omega)]
          apply hpath; dsimp; omega
      · intro i hi j; rw [hF0 i hi]; exact hr _ (hL' j)
      · intro i hi j
        have hidx : i.val-2=2*k-1 := by omega
        rw [hF2 i (by omega)]; simpa only [hidx] using (Finset.mem_filter.mp (hR j)).2
  8. Removing two k-sets leaves at least k + 2m - 1 vertices in W.

    The union of the two sets has size at most 2k, leaving sufficient cardinality in W.

    lines 106–107

      have hh := Finset.le_card_sdiff (S∪T) W
      have ht := Finset.card_union_le S T; omega
  9. A first cycle switch yields a k-set P in D that is blue-complete to A.

    Applying cycle switching gives an alternating cycle with a set P whose vertices have no red edges to A and few red neighbors in the exterior.

    lines 127–150

      classical
      dsimp only
      obtain ⟨X0,Y0,hX0,hY0,hE0,h0⟩ := even_linked_double_star_polarized_cycle_switch
        G k n m hk hm r A W S D B hrA hrW hAW hA hr hS hD hdis hsize hd hbad hb hgood hmiss hred
      let P := Finset.univ.map Y0
      have hPc : P.card=k := by simp [P]
      have hPw : P ⊆ W := hY0.trans hD
      have hne (x a : V) (hx : x ∈ W) (ha : a ∈ A) : x ≠ a :=
        fun he => Finset.disjoint_left.mp hAW ha (he ▸ hx)
      have hP (x : V) (hx : x ∈ P) (a : V) (ha : a ∈ A) : Gᶜ.Adj x a := by
        obtain ⟨i,_,rfl⟩ := Finset.mem_map.mp hx
        exact ⟨hne _ a (hPw (Finset.mem_map.mpr ⟨i,Finset.mem_univ _,rfl⟩)) ha,(h0 i).1 a ha⟩
      obtain ⟨a,ha⟩ := Finset.card_pos.mp (show 0 < A.card by omega)
      let D1 := W \ (S∪P)
      have dis1 : Disjoint P D1 := Finset.disjoint_left.mpr fun _ hp hd => (Finset.mem_sdiff.mp hd).2 (Finset.mem_union_right _ hp)
      have hm1 (x) (hx : x ∈ P) : (D1.filter (fun v => ¬Gᶜ.Adj x v)).card ≤ m-1 := by
        obtain ⟨i,_,rfl⟩ := Finset.mem_map.mp hx
        have hy : Y0 i ∈ P := Finset.mem_map.mpr ⟨i,Finset.mem_univ _,rfl⟩
        have he : D1.filter (fun v => ¬Gᶜ.Adj (Y0 i) v) = D1.filter (G.Adj (Y0 i)) := by
          ext z; by_cases hz : z ∈ D1
          · have hn : Y0 i ≠ z := fun h => Finset.disjoint_left.mp dis1 hy (h ▸ hz)
            simp [hz,SimpleGraph.compl_adj,hn]
          · simp [hz]
        rw [he]; exact Nat.le_pred_of_lt (h0 i).2
  10. A second cycle switch in the complement yields a k-set Q that is red-complete to A.

    Applying cycle switching in G^c gives a set Q and an alternating blue cycle between P and Q, with Q red-complete to A.

    lines 151–173

      obtain ⟨X1,Y1,hX1,hY1,hE1,h1⟩ := even_linked_double_star_polarized_cycle_switch
        Gᶜ k n m hk hm b A W P D1 ∅ hbA hbW hAW hA hbl hPw Finset.sdiff_subset dis1 hPc
        (ds1310_polarized_dense_tips_out_size W S P k m hsize hPc hW) (Finset.empty_subset _) (by simp)
        (fun x hx _ => ⟨a,ha,hP x hx a ha⟩) hm1 hblue
      let Q := Finset.univ.map Y1
      have hQc : Q.card=k := by simp [Q]
      have hQw : Q ⊆ W := hY1.trans Finset.sdiff_subset
      have hQ (x : V) (hx : x ∈ Q) (a : V) (ha : a ∈ A) : G.Adj x a := by
        have hn := hne _ a (hQw hx) ha
        obtain ⟨i,_,rfl⟩ := Finset.mem_map.mp hx
        by_contra h
        exact (h1 i).1 a ha ⟨hn,h⟩
      let D2 := W \ (P∪Q)
      have dis2 : Disjoint Q D2 := Finset.disjoint_left.mpr fun _ hq hd => (Finset.mem_sdiff.mp hd).2 (Finset.mem_union_right _ hq)
      have hm2 (x) (hx : x ∈ Q) : (D2.filter (fun v => ¬G.Adj x v)).card ≤ m-1 := by
        obtain ⟨i,_,rfl⟩ := Finset.mem_map.mp hx
        have hy : Y1 i ∈ Q := Finset.mem_map.mpr ⟨i,Finset.mem_univ _,rfl⟩
        have he : D2.filter (fun v => ¬G.Adj (Y1 i) v) = D2.filter (Gᶜ.Adj (Y1 i)) := by
          ext z; by_cases hz : z ∈ D2
          · have hn : Y1 i ≠ z := fun h => Finset.disjoint_left.mp dis2 hy (h ▸ hz)
            simp [hz,SimpleGraph.compl_adj,hn]
          · simp [hz]
        rw [he]; exact Nat.le_pred_of_lt (h1 i).2
  11. A third cycle switch yields a k-set L that is blue-complete to A with few red exterior neighbors.

    Applying cycle switching in G gives L forming an alternating red cycle with Q and having bounded red degree to the remaining exterior.

    lines 174–191

      obtain ⟨X2,Y2,hX2,hY2,hE2,h2⟩ := even_linked_double_star_polarized_cycle_switch
        G k n m hk hm r A W Q D2 ∅ hrA hrW hAW hA hr hQw Finset.sdiff_subset dis2 hQc
        (ds1310_polarized_dense_tips_out_size W P Q k m hPc hQc hW) (Finset.empty_subset _) (by simp)
        (fun x hx _ => ⟨a,ha,hQ x hx a ha⟩) hm2 hred
      let L := Finset.univ.map Y2
      have hLw : L ⊆ W := hY2.trans Finset.sdiff_subset
      refine ⟨P,Q,L,hPw,hQw,hLw,?_,?_,?_,hP,hQ,?_,⟨X1,Y1,hX1,rfl,hE1⟩,⟨X2,Y2,hX2,rfl,hE2⟩,?_⟩
      · exact Finset.disjoint_left.mpr fun _ hp hq => Finset.disjoint_left.mp dis1 hp (hY1 hq)
      · exact Finset.disjoint_left.mpr fun _ hp hl => (Finset.mem_sdiff.mp (hY2 hl)).2 (Finset.mem_union_left _ hp)
      · exact Finset.disjoint_left.mpr fun _ hq hl => Finset.disjoint_left.mp dis2 hq (hY2 hl)
      · intro x hx a ha
        have hn := hne _ a (hLw hx) ha
        obtain ⟨i,_,rfl⟩ := Finset.mem_map.mp hx
        exact ⟨hn,(h2 i).1 a ha⟩
      · intro x hx
        obtain ⟨i,_,rfl⟩ := Finset.mem_map.mp hx
        exact (h2 i).2
    
  12. The cyclic rotation permutation behaves as an increment modulo N.

    Case analysis on the Fin constructor evaluates the rotation value.

    lines 194–200

      cases N with
      | zero => exact i.elim0
      | succ q =>
        rw [coe_finRotate]; split <;> rename_i h
        · subst i; simp
        · have hi := Fin.val_lt_last h
          rw [if_pos (by omega)]
  13. Interleaving two k-tuples on an alternating cycle produces a simple cycle of length 2k.

    We alternate between the two embeddings and verify injectivity and cyclic adjacency.

    lines 211–234

      let Z : Fin (2*k) ↪ V := ⟨ds1310_polarized_dense_tips_alt_map X Y,by
        intro i j h; dsimp [ds1310_polarized_dense_tips_alt_map] at h; split at h <;> split at h
        · have hh := congrArg Fin.val (X.injective h); apply Fin.ext; dsimp at hh; omega
        · exact (hdis _ _ h).elim
        · exact (hdis _ _ h.symm).elim
        · have hh := congrArg Fin.val (Y.injective h); apply Fin.ext; dsimp at hh; omega⟩
      refine ⟨Z,?_,?_,?_⟩
      · intro i
        let j : Fin k := ⟨i.val/2,by omega⟩
        have hi := ds1310_polarized_dense_tips_rot_val (by omega : 1 < 2*k) i
        have hj := ds1310_polarized_dense_tips_rot_val (by omega : 1 < k) j
        change (finRotate k j).val = if i.val/2+1 < k then i.val/2+1 else 0 at hj
        change G.Adj (ds1310_polarized_dense_tips_alt_map X Y i) (ds1310_polarized_dense_tips_alt_map X Y (finRotate (2*k) i))
        unfold ds1310_polarized_dense_tips_alt_map; split <;> split
        · split at hi <;> omega
        · have he : ⟨(finRotate (2*k) i).val / 2,by omega⟩ = j := Fin.ext (by dsimp [j]; split at hi <;> omega)
          rw [he]; exact (hadj j).1
        · have he : ⟨(finRotate (2*k) i).val / 2,by omega⟩ = finRotate k j := Fin.ext (by dsimp; split at hi <;> split at hj <;> omega)
          rw [he]; exact (hadj j).2.symm
        · split at hi <;> omega
      · intro i; change ds1310_polarized_dense_tips_alt_map X Y _ = X i ∧ ds1310_polarized_dense_tips_alt_map X Y _ = Y i; simp [ds1310_polarized_dense_tips_alt_map,Nat.mul_comm]; apply Fin.ext; dsimp; omega
      · intro i; change (∃ j, ds1310_polarized_dense_tips_alt_map X Y i=X j) ∨ ∃ j, ds1310_polarized_dense_tips_alt_map X Y i=Y j; unfold ds1310_polarized_dense_tips_alt_map; split
        · exact Or.inl ⟨_,rfl⟩
        · exact Or.inr ⟨_,rfl⟩
  14. Rerouting the cycle at an exterior neighbor produces a simple path of length 2k.

    We shift the cycle and replace the last vertex by the neighbor to form a simple path.

    lines 243–278

      letI : NeZero (2*k) := ⟨by omega⟩
      obtain ⟨Z,hZ,hXY,hcover⟩ := ds1310_polarized_dense_tips_alt_order G k hk X Y hdis hadj
      let u : Fin (2*k) := ⟨2*(finRotate k i).val,by omega⟩
      let E (a : Fin (2*k)) := Z (u+a)
      have hEn (a) : E a ≠ z := by
        rcases hcover (u+a) with ⟨t,ht⟩|⟨t,ht⟩
        · change Z (u+a) ≠ z; rw [ht]; exact hzX t
        · change Z (u+a) ≠ z; rw [ht]; exact hzY t
      let F (a : Fin (2*k)) := if a.val+1=2*k then z else E a
      let P : Fin (2*k) ↪ V := ⟨F,by
        intro a b he; dsimp [F] at he; split at he <;> split at he
        · apply Fin.ext; omega
        · exact (hEn _ he.symm).elim
        · exact (hEn _ he).elim
        · exact add_left_cancel (Z.injective he)⟩
      have hsame (a b : Fin (2*k)) (hab : a.val+1=b.val) : finRotate _ (u+a)=u+b := by
        have he : a+1=b := Fin.ext (by rw [Fin.val_add_one_of_lt' (by omega)]; exact hab)
        rw [finRotate_apply,←he,add_assoc]
      refine ⟨P,?_,?_,?_,?_⟩
      · intro t; change (∃ a, F t=X a) ∨ (∃ a, F t=Y a) ∨ F t=z
        by_cases h : t.val+1=2*k
        · exact Or.inr (Or.inr (if_pos h))
        · simp only [F,if_neg h,E]; rcases hcover (u+t) with h'|h'
          · exact Or.inl h'
          · exact Or.inr (Or.inl h')
      · intro a b hab
        have hna : a.val+1 ≠ 2*k := by omega
        change G.Adj (F a) (F b)
        by_cases hlast : b.val+1=2*k
        · have he : u+a=⟨2*i.val,by omega⟩ := by
            apply Fin.ext; simp only [Fin.val_add_eq_ite,u,ds1310_polarized_dense_tips_rot_val (by omega : 1 < k)]
            split_ifs <;> omega
          simp only [F,if_neg hna,if_pos hlast,E,he,(hXY i).1]; exact hz
        · simp only [F,if_neg hna,if_neg hlast,E]; exact (hsame a b hab) ▸ hZ (u+a)
      · change F _=_; simp [F,E,show ¬1=2*k by omega,u,(hXY _).1]
      · change F _=_; apply if_pos; dsimp; omega
  15. A vertex with small red degree in D has large blue degree in any subset E of D.

    The cardinality of E splits into red and blue neighbors of z, yielding the desired lower bound.

    lines 282–293

        E.card ≤ (E.filter (Gᶜ.Adj z)).card+(m-1) := by
      classical
      have hsub : E.filter (G.Adj z) ⊆ D.filter (G.Adj z) :=
        fun _ hv => Finset.mem_filter.mpr ⟨he (Finset.mem_filter.mp hv).1,(Finset.mem_filter.mp hv).2⟩
      have hh := Finset.card_le_card hsub
      have heq : E.filter (fun v => ¬G.Adj z v)=E.filter (Gᶜ.Adj z) := by
        ext v; by_cases hv : v ∈ E
        · have hn : z ≠ v := fun he => hz (he ▸ hv)
          simp [hv,SimpleGraph.compl_adj,hn]
        · simp [hv]
      have hc := Finset.card_filter_add_card_filter_not (s := E) (p := G.Adj z)
      rw [heq] at hc; omega
  16. Assume for contradiction that neither color contains the linked double star and obtain P, Q, L and E.

    The pure cycle triple gives disjoint k-sets P, Q, L with cycles between them, leaving a large exterior set E.

    lines 305–322

      classical
      by_contra hneg
      have hav := not_or.mp hneg
      obtain ⟨P,Q,L,hPw,hQw,hLw,hPQ,hPL,hQL,hPA,_,_,⟨X,Y,hX,hY,hcycle⟩,⟨_,T,_,hT,_⟩,hcap⟩ :=
        ds1310_polarized_dense_tips_even_linked_double_star_pure_cycle_triple G k n m hk hm r b A W S D B hrA hrW hbA hbW hAW hA hr hbl
          hW hS hD hdis hsize hd hbad hb hgood hmiss hav.1 hav.2
      have hx (i) : X i ∈ P := hX ▸ Finset.mem_map.mpr ⟨i,Finset.mem_univ _,rfl⟩
      have hy (i) : Y i ∈ Q := hY ▸ Finset.mem_map.mpr ⟨i,Finset.mem_univ _,rfl⟩
      have hPc : P.card=k := by rw [←hX]; simp
      have hQc : Q.card=k := by rw [←hY]; simp
      have hLc : L.card=k := by rw [←hT]; simp
      let D0 := W \ (Q∪L)
      let E := W \ (P∪Q∪L)
      have hEc : 2*m-1 ≤ E.card := by
        have hh := Finset.le_card_sdiff (P∪Q∪L) W
        have h1 := Finset.card_union_le P Q
        have h2 := Finset.card_union_le (P∪Q) L
        dsimp [E]; omega
  17. Pick a vertex z in L and find a blue neighbor v in P.

    Since z has small red degree and P has size k >= m, z must have a blue neighbor in P.

    lines 323–340

      obtain ⟨z,hz⟩ := Finset.card_pos.mp (show 0 < L.card by omega)
      have hpe : P ⊆ D0 := by
        intro x hxp; refine Finset.mem_sdiff.mpr ⟨hPw hxp,?_⟩
        exact fun h => (Finset.mem_union.mp h).elim (Finset.disjoint_left.mp hPQ hxp) (Finset.disjoint_left.mp hPL hxp)
      have hEE : E ⊆ D0 := by
        intro x h; obtain ⟨hw,hn⟩ := Finset.mem_sdiff.mp h
        refine Finset.mem_sdiff.mpr ⟨hw,?_⟩
        intro hh; apply hn
        rcases Finset.mem_union.mp hh with hq|hl
        · exact Finset.mem_union_left _ (Finset.mem_union_right _ hq)
        · exact Finset.mem_union_right _ hl
      have hzP : z ∉ P := fun h => Finset.disjoint_left.mp hPL h hz
      have hzE : z ∉ E := fun h => (Finset.mem_sdiff.mp h).2 (Finset.mem_union_right _ hz)
      have pcount := ds1310_polarized_dense_tips_other_count G z P D0 hpe hzP m (hcap z hz)
      have ecount := ds1310_polarized_dense_tips_other_count G z E D0 hEE hzE m (hcap z hz)
      obtain ⟨v,hv⟩ := Finset.card_pos.mp (show 0 < (P.filter (Gᶜ.Adj z)).card by omega)
      obtain ⟨hvp,hvz⟩ := Finset.mem_filter.mp hv
      rw [←hX] at hvp; obtain ⟨i,_,rfl⟩ := Finset.mem_map.mp hvp
  18. Construct a blue path of length 2k from P to z.

    We reroute the alternating blue cycle between P and Q to end at z.

    lines 341–349

      obtain ⟨F,hF,hpath,hfirst,hlast⟩ := ds1310_polarized_dense_tips_run_then_tip Gᶜ k hk X Y
        (fun i j h => Finset.disjoint_left.mp hPQ (hx i) (h ▸ hy j)) hcycle i z
        (fun j h => hzP (h ▸ hx j)) (fun j h => Finset.disjoint_left.mp hQL (hy j) (h ▸ hz)) hvz.symm
      obtain ⟨a,ha⟩ := Finset.card_pos.mp (show 0 < A.card by omega)
      have hf (v) : F v ∈ P ∪ Q ∪ L := by
        rcases hF v with ⟨j,h⟩|⟨j,h⟩|h
        · exact Finset.mem_union_left _ (Finset.mem_union_left _ (h ▸ hx j))
        · exact Finset.mem_union_left _ (Finset.mem_union_right _ (h ▸ hy j))
        · exact Finset.mem_union_right _ (h ▸ hz)
  19. Attach b, a, and stars to embed the linked double star into G^c, yielding a contradiction.

    Attaching the centers and leaf stars to the blue path embeds the linked double star in the complement graph, contradicting the assumption.

    lines 350–355

      apply hav.2
      apply ds1310_polarized_dense_tips_attach Gᶜ k n m hk A W b a hbA hbW ha hAW hA hbl F
        (fun j => Finset.union_subset (Finset.union_subset hPw hQw) hLw (hf j)) hpath
        (by rw [hfirst]; exact (hPA _ (hx _) a ha).symm)
        E Finset.sdiff_subset (fun j hj => (Finset.mem_sdiff.mp hj).2 (hf j))
      rw [hlast]; omega

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 613 tactics.

open SimpleGraph Classicalopen scoped BigOperatorsprivate theorem ds1310_polarized_dense_tips_copy_of_arrays {V : Type*} {G : SimpleGraph V} {p n m : ℕ}    (path : Fin (2*p) → V) (left : Fin n → V) (right : Fin m → V)    (hinj : Function.Injective (Sum.elim path (Sum.elim left right)))    (hp : ∀ i j : Fin (2*p), i.val+1=j.val → G.Adj (path i) (path j))    (hl : ∀ i : Fin (2*p), i.val=0 → ∀ l, G.Adj (path i) (left l))    (hr : ∀ i : Fin (2*p), i.val+1=2*p → ∀ l, G.Adj (path i) (right l)) :    (even_linked_double_star p n m).IsContained G := by  let f := Sum.elim path (Sum.elim left right)  refine ⟨⟨⟨f,?_⟩,hinj⟩⟩  intro x y h  rcases h.2 with h | h <;>    rcases h with ⟨i,j,rfl,rfl,h|h⟩ | ⟨i,j,h,⟨rfl,rfl⟩|⟨rfl,rfl⟩⟩ | ⟨i,j,h,⟨rfl,rfl⟩|⟨rfl,rfl⟩⟩  all_goals dsimp [f]  all_goals first    | exact hp _ _ (by assumption)    | exact (hp _ _ (by assumption)).symm    | exact hl _ (by assumption) _    | exact (hl _ (by assumption) _).symm    | exact hr _ (by assumption) _    | exact (hr _ (by assumption) _).symmprivate theorem ds1310_polarized_dense_tips_sum_inj {α β γ : Type*} {f : α → γ} {g : β → γ}    (hf : Function.Injective f) (hg : Function.Injective g) (h : ∀ i j, f i ≠ g j) :    Function.Injective (Sum.elim f g) := by  rintro (x|x) (y|y) he  · exact congrArg Sum.inl (hf he)  · exact (h x y he).elim  · exact (h y x he.symm).elim  · exact congrArg Sum.inr (hg he)private theorem ds1310_polarized_dense_tips_embed_fin {V : Type*} (S : Finset V) (k : ℕ) (h : k ≤ S.card) :    ∃ f : Fin k ↪ V, ∀ i, f i ∈ S := by  classical  have he : Nonempty (Fin k ↪ ↥S) := Function.Embedding.nonempty_of_card_le (by simpa using h)  obtain ⟨e⟩ := he  exact ⟨e.trans (Function.Embedding.subtype _),fun i => (e i).property⟩private theorem ds1310_polarized_dense_tips_attach {V : Type*} [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (k n m : ℕ) (hk : 2 ≤ k)    (A W : Finset V) (r a : V) (hrA : r ∉ A) (hrW : r ∉ W) (ha : a ∈ A) (hAW : Disjoint A W)    (hcard : n+1 ≤ A.card) (hr : ∀ z ∈ A, G.Adj r z)    (P : Fin (2*k) ↪ V) (hP : ∀ i, P i ∈ W)    (hpath : ∀ i j : Fin (2*k), i.val+1=j.val → G.Adj (P i) (P j))    (haP : G.Adj a (P ⟨0,by omega⟩)) (D : Finset V) (hDW : D ⊆ W)    (hD : ∀ i, P i ∉ D) (hd : m ≤ (D.filter (G.Adj (P ⟨2*k-1,by omega⟩))).card) :    (even_linked_double_star (k+1) n m).IsContained G := by  classical  obtain ⟨L,hL⟩ := ds1310_polarized_dense_tips_embed_fin (A.erase a) n (by rw [Finset.card_erase_of_mem ha]; omega)  obtain ⟨R,hR⟩ := ds1310_polarized_dense_tips_embed_fin (D.filter (G.Adj (P ⟨2*k-1,by omega⟩))) m hd  let F (i : Fin (2*(k+1))) := if h : i.val < 2 then (if i.val=0 then r else a) else P ⟨i.val-2,by omega⟩  have hAW' (x y) (hx : x ∈ A) (hy : y ∈ W) : x ≠ y := fun he => Finset.disjoint_left.mp hAW hx (he ▸ hy)  have hR' (i) : R i ∈ D := (Finset.mem_filter.mp (hR i)).1  have hL' (i) : L i ∈ A := (Finset.mem_erase.mp (hL i)).2  have hrn (v) (h : v ∈ W) : r ≠ v := fun he => hrW (he ▸ h)  have hra : r ≠ a := fun he => hrA (he ▸ ha)  have hDis (i j) : P i ≠ R j := fun he => hD i (he ▸ hR' j)  have hF0 (i : Fin (2*(k+1))) (h : i.val=0) : F i=r := by simp only [F,dif_pos (show i.val < 2 by omega),if_pos h]  have hF1 (i : Fin (2*(k+1))) (h : i.val=1) : F i=a := by simp only [F,dif_pos (show i.val < 2 by omega),if_neg (show i.val ≠ 0 by omega)]  have hF2 (i : Fin (2*(k+1))) (h : 2 ≤ i.val) : F i=P ⟨i.val-2,by omega⟩ := by    simp only [F,dif_neg (show ¬i.val < 2 by omega)]  apply ds1310_polarized_dense_tips_copy_of_arrays F L R  · apply ds1310_polarized_dense_tips_sum_inj    · intro i j he      rcases (show i.val=0 ∨ i.val=1 ∨ 2 ≤ i.val by omega) with h|h|h <;>        rcases (show j.val=0 ∨ j.val=1 ∨ 2 ≤ j.val by omega) with h'|h'|h'      all_goals first | rw [hF0 i h] at he | rw [hF1 i h] at he | rw [hF2 i h] at he      all_goals first | rw [hF0 j h'] at he | rw [hF1 j h'] at he | rw [hF2 j h'] at he      all_goals first        | exact (hra he).elim | exact (hra he.symm).elim        | exact (hrn _ (hP _) he).elim | exact (hrn _ (hP _) he.symm).elim        | exact (hAW' _ _ ha (hP _) he).elim | exact (hAW' _ _ ha (hP _) he.symm).elim        | have hh := congrArg Fin.val (P.injective he); apply Fin.ext; dsimp at hh; omega        | apply Fin.ext; omega    · exact ds1310_polarized_dense_tips_sum_inj L.injective R.injective (fun i j => hAW' _ _ (hL' i) (hDW (hR' j)))    · rintro i (j|j) he      · change F i=L j at he        dsimp [F] at he; split at he        · split at he          · exact hrA (he ▸ hL' j)          · exact (Finset.mem_erase.mp (hL j)).1 he.symm        · exact hAW' _ _ (hL' j) (hP _) he.symm      · change F i=R j at he        dsimp [F] at he; split at he        · split at he          · exact hrn _ (hDW (hR' j)) he          · exact hAW' _ _ ha (hDW (hR' j)) he        · exact hDis _ _ he  · intro i j hij    rcases (show i.val=0 ∨ i.val=1 ∨ 2 ≤ i.val by omega) with h|h|h    · rw [hF0 i h,hF1 j (by omega)]; exact hr _ ha    · rw [hF1 i h,hF2 j (by omega)]      have hj : j.val-2=0 := by omega      simpa only [hj] using haP    · rw [hF2 i h,hF2 j (by omega)]      apply hpath; dsimp; omega  · intro i hi j; rw [hF0 i hi]; exact hr _ (hL' j)  · intro i hi j    have hidx : i.val-2=2*k-1 := by omega    rw [hF2 i (by omega)]; simpa only [hidx] using (Finset.mem_filter.mp (hR j)).2private theorem ds1310_polarized_dense_tips_out_size {V : Type*} [DecidableEq V] (W S T : Finset V) (k m : ℕ)    (hS : S.card=k) (hT : T.card=k) (hW : 3*k+2*m-1 ≤ W.card) :    k+2*m-1 ≤ (W \ (S∪T)).card := by  have hh := Finset.le_card_sdiff (S∪T) W  have ht := Finset.card_union_le S T; omegaprivate theorem ds1310_polarized_dense_tips_even_linked_double_star_pure_cycle_triple {V : Type*} [DecidableEq V]    (G : SimpleGraph V) [DecidableRel G.Adj] (k n m : ℕ) (hk : 2 ≤ k) (hm : 1 ≤ m)    (r b : V) (A W S D B : Finset V) (hrA : r ∉ A) (hrW : r ∉ W) (hbA : b ∉ A) (hbW : b ∉ W)    (hAW : Disjoint A W) (hA : n+1 ≤ A.card)    (hr : ∀ a ∈ A, G.Adj r a) (hbl : ∀ a ∈ A, Gᶜ.Adj b a)    (hW : 3*k+2*m-1 ≤ W.card) (hS : S ⊆ W) (hD : D ⊆ W) (hdis : Disjoint S D) (hsize : S.card=k)    (hd : k+2*m-1 ≤ D.card) (hbad : B ⊆ S) (hb : 2*B.card ≤ k)    (hgood : ∀ x ∈ S, x ∉ B → ∃ a ∈ A, G.Adj x a)    (hmiss : ∀ x ∈ S, (D.filter (fun v => ¬G.Adj x v)).card ≤ m-1)    (hred : ¬(even_linked_double_star (k+1) n m).IsContained G)    (hblue : ¬(even_linked_double_star (k+1) n m).IsContained Gᶜ) :    let cyc := fun (H : SimpleGraph V) (P Q : Finset V) =>      ∃ X Y : Fin k ↪ V, Finset.univ.map X=P ∧ Finset.univ.map Y=Q ∧        ∀ i, H.Adj (X i) (Y i) ∧ H.Adj (X (finRotate k i)) (Y i)    ∃ P Q L : Finset V, P ⊆ W ∧ Q ⊆ W ∧ L ⊆ W ∧ Disjoint P Q ∧ Disjoint P L ∧ Disjoint Q L ∧      (∀ x ∈ P, ∀ a ∈ A, Gᶜ.Adj x a) ∧ (∀ x ∈ Q, ∀ a ∈ A, G.Adj x a) ∧      (∀ x ∈ L, ∀ a ∈ A, Gᶜ.Adj x a) ∧ cyc Gᶜ P Q ∧ cyc G Q L ∧      ∀ x ∈ L, ((W \ (Q ∪ L)).filter (G.Adj x)).card < m := by  classical  dsimp only  obtain ⟨X0,Y0,hX0,hY0,hE0,h0⟩ := even_linked_double_star_polarized_cycle_switch    G k n m hk hm r A W S D B hrA hrW hAW hA hr hS hD hdis hsize hd hbad hb hgood hmiss hred  let P := Finset.univ.map Y0  have hPc : P.card=k := by simp [P]  have hPw : P ⊆ W := hY0.trans hD  have hne (x a : V) (hx : x ∈ W) (ha : a ∈ A) : x ≠ a :=    fun he => Finset.disjoint_left.mp hAW ha (he ▸ hx)  have hP (x : V) (hx : x ∈ P) (a : V) (ha : a ∈ A) : Gᶜ.Adj x a := by    obtain ⟨i,_,rfl⟩ := Finset.mem_map.mp hx    exact ⟨hne _ a (hPw (Finset.mem_map.mpr ⟨i,Finset.mem_univ _,rfl⟩)) ha,(h0 i).1 a ha⟩  obtain ⟨a,ha⟩ := Finset.card_pos.mp (show 0 < A.card by omega)  let D1 := W \ (S∪P)  have dis1 : Disjoint P D1 := Finset.disjoint_left.mpr fun _ hp hd => (Finset.mem_sdiff.mp hd).2 (Finset.mem_union_right _ hp)  have hm1 (x) (hx : x ∈ P) : (D1.filter (fun v => ¬Gᶜ.Adj x v)).card ≤ m-1 := by    obtain ⟨i,_,rfl⟩ := Finset.mem_map.mp hx    have hy : Y0 i ∈ P := Finset.mem_map.mpr ⟨i,Finset.mem_univ _,rfl⟩    have he : D1.filter (fun v => ¬Gᶜ.Adj (Y0 i) v) = D1.filter (G.Adj (Y0 i)) := by      ext z; by_cases hz : z ∈ D1      · have hn : Y0 i ≠ z := fun h => Finset.disjoint_left.mp dis1 hy (h ▸ hz)        simp [hz,SimpleGraph.compl_adj,hn]      · simp [hz]    rw [he]; exact Nat.le_pred_of_lt (h0 i).2  obtain ⟨X1,Y1,hX1,hY1,hE1,h1⟩ := even_linked_double_star_polarized_cycle_switch    Gᶜ k n m hk hm b A W P D1 ∅ hbA hbW hAW hA hbl hPw Finset.sdiff_subset dis1 hPc    (ds1310_polarized_dense_tips_out_size W S P k m hsize hPc hW) (Finset.empty_subset _) (by simp)    (fun x hx _ => ⟨a,ha,hP x hx a ha⟩) hm1 hblue  let Q := Finset.univ.map Y1  have hQc : Q.card=k := by simp [Q]  have hQw : Q ⊆ W := hY1.trans Finset.sdiff_subset  have hQ (x : V) (hx : x ∈ Q) (a : V) (ha : a ∈ A) : G.Adj x a := by    have hn := hne _ a (hQw hx) ha    obtain ⟨i,_,rfl⟩ := Finset.mem_map.mp hx    by_contra h    exact (h1 i).1 a ha ⟨hn,h⟩  let D2 := W \ (P∪Q)  have dis2 : Disjoint Q D2 := Finset.disjoint_left.mpr fun _ hq hd => (Finset.mem_sdiff.mp hd).2 (Finset.mem_union_right _ hq)  have hm2 (x) (hx : x ∈ Q) : (D2.filter (fun v => ¬G.Adj x v)).card ≤ m-1 := by    obtain ⟨i,_,rfl⟩ := Finset.mem_map.mp hx    have hy : Y1 i ∈ Q := Finset.mem_map.mpr ⟨i,Finset.mem_univ _,rfl⟩    have he : D2.filter (fun v => ¬G.Adj (Y1 i) v) = D2.filter (Gᶜ.Adj (Y1 i)) := by      ext z; by_cases hz : z ∈ D2      · have hn : Y1 i ≠ z := fun h => Finset.disjoint_left.mp dis2 hy (h ▸ hz)        simp [hz,SimpleGraph.compl_adj,hn]      · simp [hz]    rw [he]; exact Nat.le_pred_of_lt (h1 i).2  obtain ⟨X2,Y2,hX2,hY2,hE2,h2⟩ := even_linked_double_star_polarized_cycle_switch    G k n m hk hm r A W Q D2 ∅ hrA hrW hAW hA hr hQw Finset.sdiff_subset dis2 hQc    (ds1310_polarized_dense_tips_out_size W P Q k m hPc hQc hW) (Finset.empty_subset _) (by simp)    (fun x hx _ => ⟨a,ha,hQ x hx a ha⟩) hm2 hred  let L := Finset.univ.map Y2  have hLw : L ⊆ W := hY2.trans Finset.sdiff_subset  refine ⟨P,Q,L,hPw,hQw,hLw,?_,?_,?_,hP,hQ,?_,⟨X1,Y1,hX1,rfl,hE1⟩,⟨X2,Y2,hX2,rfl,hE2⟩,?_⟩  · exact Finset.disjoint_left.mpr fun _ hp hq => Finset.disjoint_left.mp dis1 hp (hY1 hq)  · exact Finset.disjoint_left.mpr fun _ hp hl => (Finset.mem_sdiff.mp (hY2 hl)).2 (Finset.mem_union_left _ hp)  · exact Finset.disjoint_left.mpr fun _ hq hl => Finset.disjoint_left.mp dis2 hq (hY2 hl)  · intro x hx a ha    have hn := hne _ a (hLw hx) ha    obtain ⟨i,_,rfl⟩ := Finset.mem_map.mp hx    exact ⟨hn,(h2 i).1 a ha⟩  · intro x hx    obtain ⟨i,_,rfl⟩ := Finset.mem_map.mp hx    exact (h2 i).2private theorem ds1310_polarized_dense_tips_rot_val {N : ℕ} (hN : 1 < N) (i : Fin N) :    (finRotate N i).val = if i.val+1 < N then i.val+1 else 0 := by  cases N with  | zero => exact i.elim0  | succ q =>    rw [coe_finRotate]; split <;> rename_i h    · subst i; simp    · have hi := Fin.val_lt_last h      rw [if_pos (by omega)]private def ds1310_polarized_dense_tips_alt_map {V : Type*} {k : ℕ} (X Y : Fin k ↪ V) (i : Fin (2*k)) : V :=  if i.val%2=0 then X ⟨i.val/2,by omega⟩ else Y ⟨i.val/2,by omega⟩private theorem ds1310_polarized_dense_tips_alt_order {V : Type*} (G : SimpleGraph V) (k : ℕ) (hk : 2 ≤ k)    (X Y : Fin k ↪ V) (hdis : ∀ i j, X i ≠ Y j)    (hadj : ∀ i, G.Adj (X i) (Y i) ∧ G.Adj (X (finRotate k i)) (Y i)) :    ∃ Z : Fin (2*k) ↪ V, (∀ i, G.Adj (Z i) (Z (finRotate (2*k) i))) ∧      (∀ i : Fin k, Z ⟨2*i.val,by omega⟩ = X i ∧ Z ⟨2*i.val+1,by omega⟩=Y i) ∧      ∀ i, (∃ j, Z i=X j) ∨ ∃ j, Z i=Y j := by  let Z : Fin (2*k) ↪ V := ⟨ds1310_polarized_dense_tips_alt_map X Y,by    intro i j h; dsimp [ds1310_polarized_dense_tips_alt_map] at h; split at h <;> split at h    · have hh := congrArg Fin.val (X.injective h); apply Fin.ext; dsimp at hh; omega    · exact (hdis _ _ h).elim    · exact (hdis _ _ h.symm).elim    · have hh := congrArg Fin.val (Y.injective h); apply Fin.ext; dsimp at hh; omega⟩  refine ⟨Z,?_,?_,?_⟩  · intro i    let j : Fin k := ⟨i.val/2,by omega⟩    have hi := ds1310_polarized_dense_tips_rot_val (by omega : 1 < 2*k) i    have hj := ds1310_polarized_dense_tips_rot_val (by omega : 1 < k) j    change (finRotate k j).val = if i.val/2+1 < k then i.val/2+1 else 0 at hj    change G.Adj (ds1310_polarized_dense_tips_alt_map X Y i) (ds1310_polarized_dense_tips_alt_map X Y (finRotate (2*k) i))    unfold ds1310_polarized_dense_tips_alt_map; split <;> split    · split at hi <;> omega    · have he : ⟨(finRotate (2*k) i).val / 2,by omega⟩ = j := Fin.ext (by dsimp [j]; split at hi <;> omega)      rw [he]; exact (hadj j).1    · have he : ⟨(finRotate (2*k) i).val / 2,by omega⟩ = finRotate k j := Fin.ext (by dsimp; split at hi <;> split at hj <;> omega)      rw [he]; exact (hadj j).2.symm    · split at hi <;> omega  · intro i; change ds1310_polarized_dense_tips_alt_map X Y _ = X i ∧ ds1310_polarized_dense_tips_alt_map X Y _ = Y i; simp [ds1310_polarized_dense_tips_alt_map,Nat.mul_comm]; apply Fin.ext; dsimp; omega  · intro i; change (∃ j, ds1310_polarized_dense_tips_alt_map X Y i=X j) ∨ ∃ j, ds1310_polarized_dense_tips_alt_map X Y i=Y j; unfold ds1310_polarized_dense_tips_alt_map; split    · exact Or.inl ⟨_,rfl⟩    · exact Or.inr ⟨_,rfl⟩private theorem ds1310_polarized_dense_tips_run_then_tip {V : Type*} (G : SimpleGraph V) (k : ℕ) (hk : 2 ≤ k)    (X Y : Fin k ↪ V) (hdis : ∀ i j, X i ≠ Y j)    (hadj : ∀ i, G.Adj (X i) (Y i) ∧ G.Adj (X (finRotate k i)) (Y i))    (i : Fin k) (z : V) (hzX : ∀ j, X j ≠ z) (hzY : ∀ j, Y j ≠ z) (hz : G.Adj (X i) z) :    ∃ P : Fin (2*k) ↪ V, (∀ t, (∃ a, P t=X a) ∨ (∃ a, P t=Y a) ∨ P t=z) ∧      (∀ a b, a.val+1=b.val → G.Adj (P a) (P b)) ∧      P ⟨0,by omega⟩=X (finRotate k i) ∧ P ⟨2*k-1,by omega⟩=z := by  letI : NeZero (2*k) := ⟨by omega⟩  obtain ⟨Z,hZ,hXY,hcover⟩ := ds1310_polarized_dense_tips_alt_order G k hk X Y hdis hadj  let u : Fin (2*k) := ⟨2*(finRotate k i).val,by omega⟩  let E (a : Fin (2*k)) := Z (u+a)  have hEn (a) : E a ≠ z := by    rcases hcover (u+a) with ⟨t,ht⟩|⟨t,ht⟩    · change Z (u+a) ≠ z; rw [ht]; exact hzX t    · change Z (u+a) ≠ z; rw [ht]; exact hzY t  let F (a : Fin (2*k)) := if a.val+1=2*k then z else E a  let P : Fin (2*k) ↪ V := ⟨F,by    intro a b he; dsimp [F] at he; split at he <;> split at he    · apply Fin.ext; omega    · exact (hEn _ he.symm).elim    · exact (hEn _ he).elim    · exact add_left_cancel (Z.injective he)⟩  have hsame (a b : Fin (2*k)) (hab : a.val+1=b.val) : finRotate _ (u+a)=u+b := by    have he : a+1=b := Fin.ext (by rw [Fin.val_add_one_of_lt' (by omega)]; exact hab)    rw [finRotate_apply,←he,add_assoc]  refine ⟨P,?_,?_,?_,?_⟩  · intro t; change (∃ a, F t=X a) ∨ (∃ a, F t=Y a) ∨ F t=z    by_cases h : t.val+1=2*k    · exact Or.inr (Or.inr (if_pos h))    · simp only [F,if_neg h,E]; rcases hcover (u+t) with h'|h'      · exact Or.inl h'      · exact Or.inr (Or.inl h')  · intro a b hab    have hna : a.val+1 ≠ 2*k := by omega    change G.Adj (F a) (F b)    by_cases hlast : b.val+1=2*k    · have he : u+a=⟨2*i.val,by omega⟩ := by        apply Fin.ext; simp only [Fin.val_add_eq_ite,u,ds1310_polarized_dense_tips_rot_val (by omega : 1 < k)]        split_ifs <;> omega      simp only [F,if_neg hna,if_pos hlast,E,he,(hXY i).1]; exact hz    · simp only [F,if_neg hna,if_neg hlast,E]; exact (hsame a b hab) ▸ hZ (u+a)  · change F _=_; simp [F,E,show ¬1=2*k by omega,u,(hXY _).1]  · change F _=_; apply if_pos; dsimp; omegaprivate theorem ds1310_polarized_dense_tips_other_count {V : Type*} [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (z : V)    (E D : Finset V) (he : E ⊆ D) (hz : z ∉ E) (m : ℕ) (h : (D.filter (G.Adj z)).card < m) :    E.card ≤ (E.filter (Gᶜ.Adj z)).card+(m-1) := by  classical  have hsub : E.filter (G.Adj z) ⊆ D.filter (G.Adj z) :=    fun _ hv => Finset.mem_filter.mpr ⟨he (Finset.mem_filter.mp hv).1,(Finset.mem_filter.mp hv).2⟩  have hh := Finset.card_le_card hsub  have heq : E.filter (fun v => ¬G.Adj z v)=E.filter (Gᶜ.Adj z) := by    ext v; by_cases hv : v ∈ E    · have hn : z ≠ v := fun he => hz (he ▸ hv)      simp [hv,SimpleGraph.compl_adj,hn]    · simp [hv]  have hc := Finset.card_filter_add_card_filter_not (s := E) (p := G.Adj z)  rw [heq] at hc; omegatheorem even_linked_double_star_polarized_dense_tips {V : Type*} [DecidableEq V]    (G : SimpleGraph V) [DecidableRel G.Adj] (k n m : ℕ) (hk : 2 ≤ k) (hm : 1 ≤ m) (hmk : m ≤ k)    (r b : V) (A W S D B : Finset V) (hrA : r ∉ A) (hrW : r ∉ W) (hbA : b ∉ A) (hbW : b ∉ W)    (hAW : Disjoint A W) (hA : n+1 ≤ A.card)    (hr : ∀ a ∈ A, G.Adj r a) (hbl : ∀ a ∈ A, Gᶜ.Adj b a)    (hW : 3*k+2*m-1 ≤ W.card) (hS : S ⊆ W) (hD : D ⊆ W) (hdis : Disjoint S D) (hsize : S.card=k)    (hd : k+2*m-1 ≤ D.card) (hbad : B ⊆ S) (hb : 2*B.card ≤ k)    (hgood : ∀ x ∈ S, x ∉ B → ∃ a ∈ A, G.Adj x a)    (hmiss : ∀ x ∈ S, (D.filter (fun v => ¬G.Adj x v)).card ≤ m-1) :    (even_linked_double_star (k+1) n m).IsContained G ∨ (even_linked_double_star (k+1) n m).IsContained Gᶜ := by  classical  by_contra hneg  have hav := not_or.mp hneg  obtain ⟨P,Q,L,hPw,hQw,hLw,hPQ,hPL,hQL,hPA,_,_,⟨X,Y,hX,hY,hcycle⟩,⟨_,T,_,hT,_⟩,hcap⟩ :=    ds1310_polarized_dense_tips_even_linked_double_star_pure_cycle_triple G k n m hk hm r b A W S D B hrA hrW hbA hbW hAW hA hr hbl      hW hS hD hdis hsize hd hbad hb hgood hmiss hav.1 hav.2  have hx (i) : X i ∈ P := hX ▸ Finset.mem_map.mpr ⟨i,Finset.mem_univ _,rfl⟩  have hy (i) : Y i ∈ Q := hY ▸ Finset.mem_map.mpr ⟨i,Finset.mem_univ _,rfl⟩  have hPc : P.card=k := by rw [←hX]; simp  have hQc : Q.card=k := by rw [←hY]; simp  have hLc : L.card=k := by rw [←hT]; simp  let D0 := W \ (Q∪L)  let E := W \ (P∪Q∪L)  have hEc : 2*m-1 ≤ E.card := by    have hh := Finset.le_card_sdiff (P∪Q∪L) W    have h1 := Finset.card_union_le P Q    have h2 := Finset.card_union_le (P∪Q) L    dsimp [E]; omega  obtain ⟨z,hz⟩ := Finset.card_pos.mp (show 0 < L.card by omega)  have hpe : P ⊆ D0 := by    intro x hxp; refine Finset.mem_sdiff.mpr ⟨hPw hxp,?_⟩    exact fun h => (Finset.mem_union.mp h).elim (Finset.disjoint_left.mp hPQ hxp) (Finset.disjoint_left.mp hPL hxp)  have hEE : E ⊆ D0 := by    intro x h; obtain ⟨hw,hn⟩ := Finset.mem_sdiff.mp h    refine Finset.mem_sdiff.mpr ⟨hw,?_⟩    intro hh; apply hn    rcases Finset.mem_union.mp hh with hq|hl    · exact Finset.mem_union_left _ (Finset.mem_union_right _ hq)    · exact Finset.mem_union_right _ hl  have hzP : z ∉ P := fun h => Finset.disjoint_left.mp hPL h hz  have hzE : z ∉ E := fun h => (Finset.mem_sdiff.mp h).2 (Finset.mem_union_right _ hz)  have pcount := ds1310_polarized_dense_tips_other_count G z P D0 hpe hzP m (hcap z hz)  have ecount := ds1310_polarized_dense_tips_other_count G z E D0 hEE hzE m (hcap z hz)  obtain ⟨v,hv⟩ := Finset.card_pos.mp (show 0 < (P.filter (Gᶜ.Adj z)).card by omega)  obtain ⟨hvp,hvz⟩ := Finset.mem_filter.mp hv  rw [←hX] at hvp; obtain ⟨i,_,rfl⟩ := Finset.mem_map.mp hvp  obtain ⟨F,hF,hpath,hfirst,hlast⟩ := ds1310_polarized_dense_tips_run_then_tip Gᶜ k hk X Y    (fun i j h => Finset.disjoint_left.mp hPQ (hx i) (h ▸ hy j)) hcycle i z    (fun j h => hzP (h ▸ hx j)) (fun j h => Finset.disjoint_left.mp hQL (hy j) (h ▸ hz)) hvz.symm  obtain ⟨a,ha⟩ := Finset.card_pos.mp (show 0 < A.card by omega)  have hf (v) : F v ∈ P ∪ Q ∪ L := by    rcases hF v with ⟨j,h⟩|⟨j,h⟩|h    · exact Finset.mem_union_left _ (Finset.mem_union_left _ (h ▸ hx j))    · exact Finset.mem_union_left _ (Finset.mem_union_right _ (h ▸ hy j))    · exact Finset.mem_union_right _ (h ▸ hz)  apply hav.2  apply ds1310_polarized_dense_tips_attach Gᶜ k n m hk A W b a hbA hbW ha hAW hA hbl F    (fun j => Finset.union_subset (Finset.union_subset hPw hQw) hLw (hf j)) hpath    (by rw [hfirst]; exact (hPA _ (hx _) a ha).symm)    E Finset.sdiff_subset (fun j hj => (Finset.mem_sdiff.mp hj).2 (hf j))  rw [hlast]; omega
See it in the graphDiscuss this resultChallenge it