AFTD Auto-Formalizing Theoretical Domains

even_linked_double_star_unpolarized_root_path

theoremverified

Let 3≤t<p and n≥p+3. In a finite graph take S⊆B with |S|≥t, |B|≥n+t−1 and |V outside B|+t+2≤n+2p. Each b in B has degree at least |B|−1 and at least 2p−t−2 neighbors outside B. Assume that if every simple cycle visits fewer than t vertices of B, the sum of degrees over B is at most (t−1)|V|. Then some simple path starting in S visits at least t vertices of B.

Statement

theorem even_linked_double_star_unpolarized_root_path {V : Type*} [Fintype V] [DecidableEq V]
    (G : SimpleGraph V) [DecidableRel G.Adj] (B S : Finset V) (p n t : ℕ)
    (hn : p+3 ≤ n) (ht : 3 ≤ t) (htp : t < p) (hSB : S ⊆ B) (hSc : t ≤ S.card)
    (hBsize : n+t-1 ≤ B.card) (hAsize : Bᶜ.card+t+2 ≤ n+2*p)
    (hdeg : ∀ b ∈ B, B.card-1 ≤ G.degree b)
    (hcross : ∀ b ∈ B, 2*p-t-2 ≤ (Bᶜ.filter (G.Adj b)).card)
    (hweight : (∀ v, ∀ c : G.Walk v v, c.IsCycle → (c.support.toFinset∩B).card < t) →
      (∑ b ∈ B, G.degree b) ≤ (t-1)*Fintype.card V) :
    ∃ s ∈ S, ∃ z, ∃ P : G.Walk s z, P.IsPath ∧ t ≤ (P.support.toFinset∩B).card
Source
https://arxiv.org/abs/2611.19632 Lemmas 21–25; conditional application of https://arxiv.org/abs/2603.18536 Theorem 2.
Verified
29 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 7
  • 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_rooted_cycle_coverGiven a simple cycle and any vertex in its connected component, some simple path from that vertex contains every vertex of the cycle.
  • LinearOrder.toTotalPreorderEvery LinearOrder is a TotalPreorder.
  • TotalPreorderA total preorder: a preorder where ≤ is total (complete). This is weaker than LinearOrder — it does NOT require antisymmetry or…
  • Arena.Reachable.transReachability is transitive.
  • supportThe support $\mathrm{supp}(p) \subseteq \mathrm{Fin}\,n$ consists of coordinates where $p(i) \neq I$; the weight is…
  • FThe prime field $\mathrm{GF}(p)$, realized as $\mathbb{Z}/p\mathbb{Z}$ via ZMod.

The proof, explained

The theorem is proved by contradiction: suppose no simple path starting in S visits at least t vertices of B. Let C be the set of vertices reachable from S; we first show B ⊆ C by showing that any vertex w in B outside C would permit constructing an alternating path visiting t vertices of B (using common neighbors in C \ T if |C| + 3 ≤ 2n or in C ∩ Bᶜ if |C| + 3 > 2n), contradicting the assumption. Since B ⊆ C, every simple cycle intersecting B can be covered by a path rooted in S via `even_linked_double_star_rooted_cycle_cover`, so all simple cycles must visit fewer than t vertices of B. By hypothesis, the degree sum over B is at most (t - 1)|V|, which contradicts the minimum degree bound |B|(|B| - 1) under the given cardinality constraints by non-linear arithmetic.

  1. There exists an embedding of Fin k into V whose image is contained in S.

    Since k ≤ |S|, by cardinality comparison (`Function.Embedding.nonempty_of_card_le`) there exists an injection from Fin k into the subtype S. Composing this with the canonical inclusion map of S into V (`Function.Embedding.subtype`) yields an embedding into V whose image lies in S.

    lines 6–9

    uses Function.Embedding.nonempty_of_card_le, Function.Embedding.subtype

      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⟩
  2. Given finite candidate pools where each pool has cardinality strictly greater than its index, one can choose distinct elements from each pool.

    By induction on k. When k = 0, the domain is empty, so the empty embedding works vacuously (`Function.Embedding.ofIsEmpty`). For the inductive step k + 1, the induction hypothesis provides an embedding f on the first k pools. Since the image of f has size k, which is strictly less than |pool(k)|, there is an element z in pool(k) outside the image of f (`Finset.exists_mem_notMem_of_card_lt_card`). Appending z to f via `Fin.snoc` preserves injectivity (`Fin.snoc_injective_of_injective`) and covers the new index (`Fin.lastCases`).

    lines 14–27

    uses Function.Embedding.ofIsEmpty, Finset.exists_mem_notMem_of_card_lt_card, Fin.snoc_injective_of_injective, Fin.lastCases

      induction k with
      | zero => exact ⟨Function.Embedding.ofIsEmpty, fun i => i.elim0⟩
      | succ k ih =>
        obtain ⟨f,hf⟩ := ih (fun i => pool i.castSucc) (fun i => h i.castSucc)
        have hcard : (Finset.univ.map f).card < (pool (Fin.last k)).card := by
          simpa using h (Fin.last k)
        obtain ⟨z,hz,hnew⟩ := Finset.exists_mem_notMem_of_card_lt_card hcard
        have hnot : z ∉ Set.range f := by
          rintro ⟨i,rfl⟩; exact hnew (Finset.mem_map.mpr ⟨i,Finset.mem_univ _,rfl⟩)
        refine ⟨⟨Fin.snoc f z,Fin.snoc_injective_of_injective f.injective hnot⟩,?_⟩
        intro i
        refine Fin.lastCases ?_ (fun j => ?_) i
        · simpa using hz
        · simpa using hf j
  3. Between consecutive vertices in the embedding X of t vertices, we can greedily choose distinct connector vertices in D, forming an injective alternating sequence F.

    For each i < t - 1, define E(i) as the common neighborhood of X(i) and X(i + 1) in D. By hypothesis, each |E(i)| ≥ t - 1 > i. Applying greedy selection (`ds1310_unpolarized_root_path_greedy` and `lt_of_lt_of_le`) produces distinct vertices Y(i) in D adjacent to both X(i) and X(i + 1). Because all Y(j) ∈ D and all X(i) ∉ D, the sequences X and Y are disjoint. Defining the alternating sequence F on Fin (2t - 1) by placing X at even indices and Y at odd indices gives an injective map.

    lines 34–45

    uses ds1310_unpolarized_root_path_greedy, lt_of_lt_of_le

      classical
      let E (i : Fin (t-1)) := (D.filter (G.Adj (X ⟨i.val,by omega⟩))) ∩
        (D.filter (G.Adj (X ⟨i.val+1,by omega⟩)))
      obtain ⟨Y,hY⟩ := ds1310_unpolarized_root_path_greedy E (fun i => lt_of_lt_of_le i.isLt (hpair _ _))
      have hn (i j) : X i ≠ Y j := fun he => hdis i (he ▸ (Finset.mem_filter.mp (Finset.mem_inter.mp (hY j)).1).1)
      let F (i : Fin (2*t-1)) := if h : i.val%2=0 then X ⟨i.val/2,by omega⟩ else Y ⟨i.val/2,by omega⟩
      have hf : Function.Injective F := by
        intro i j he; unfold F at he; split at he <;> split at he
        · have h := congrArg Fin.val (X.injective he); apply Fin.ext; dsimp at h; omega
        · exact (hn _ _ he).elim
        · exact (hn _ _ he.symm).elim
        · have h := congrArg Fin.val (Y.injective he); apply Fin.ext; dsimp at h; omega
  4. The alternating sequence F forms a simple path starting in S that visits at least t vertices of B.

    The list L = ofFn F is non-empty and forms an adjacency chain since consecutive elements alternate between X(i) and Y(i) (or Y(i) and X(i + 1)). The walk P constructed via `Walk.ofSupport` has support L (`Walk.support_ofSupport`). Since F is injective, L has no duplicates (`List.nodup_ofFn_ofInjective`), so P is a simple path (`Walk.IsPath.mk'`). It starts at X(0) ∈ S, and its support contains all t vertices X(0), ..., X(t - 1) in S ⊆ B, so |V(P) ∩ B| ≥ t by `Finset.card_le_card`.

    lines 46–72

    uses Walk.ofSupport, Walk.support_ofSupport, List.nodup_ofFn_ofInjective, Walk.IsPath.mk', Finset.card_le_card

      let L := List.ofFn F
      have hl : L ≠ [] := by intro h; have hh := congrArg List.length h; simp [L] at hh; omega
      have had : L.IsChain G.Adj := by
        apply List.isChain_ofFn.mpr
        intro i hi
        dsimp [F]
        split <;> split
        · omega
        · have hei : (i+1)/2=i/2 := by omega
          rw [show (⟨(i+1)/2,by omega⟩ : Fin (t-1)) = ⟨i/2,by omega⟩ from Fin.ext hei]
          exact (Finset.mem_filter.mp (Finset.mem_inter.mp (hY ⟨i/2,by omega⟩)).1).2
        · have hei : (i+1)/2=i/2+1 := by omega
          rw [show (⟨(i+1)/2,by omega⟩ : Fin t) = ⟨i/2+1,by omega⟩ from Fin.ext hei]
          exact (Finset.mem_filter.mp (Finset.mem_inter.mp (hY ⟨i/2,by omega⟩)).2).2.symm
        · omega
      let P := Walk.ofSupport L hl had
      have hsup : P.support=L := Walk.support_ofSupport hl had
      have hf0 : L.head hl = X ⟨0,by omega⟩ := by
        rw [List.head_eq_getElem]; simp [L,F]
      have hsub : Finset.univ.map X ⊆ P.support.toFinset∩B := by
        intro v hv; obtain ⟨i,_,rfl⟩ := Finset.mem_map.mp hv
        refine Finset.mem_inter.mpr ⟨?_,hSB (hX i)⟩
        rw [hsup,List.mem_toFinset]
        apply List.mem_ofFn.mpr
        exact ⟨⟨2*i.val,by omega⟩,by simp [F,Nat.mul_comm]⟩
      refine ⟨_,hf0 ▸ hX _,_,P,Walk.IsPath.mk' (by rw [hsup]; exact List.nodup_ofFn_ofInjective hf),?_⟩
      simpa using Finset.card_le_card hsub
  5. Assume for contradiction that no simple path starting in S visits at least t vertices of B, and define the reachable component C from S.

    We assume for contradiction that every simple path starting in S visits fewer than t vertices of B (`by_contra! hav`). We define C as the set of all vertices reachable from S. Then S ⊆ C because every vertex is reachable from itself (`Reachable.refl`), and C is closed under adjacency: any neighbor of a vertex in C is also reachable from S and hence in C.

    lines 83–89

    uses Reachable.refl

      classical
      by_contra! hav
      let C := Finset.univ.filter (fun v => ∃ s ∈ S, G.Reachable s v)
      have hSC : S ⊆ C := fun s hs => Finset.mem_filter.mpr ⟨Finset.mem_univ _,s,hs,Reachable.refl _⟩
      have hclosed (v w : V) (hv : v ∈ C) (h : G.Adj v w) : w ∈ C := by
        obtain ⟨s,hs,hsv⟩ := (Finset.mem_filter.mp hv).2
        exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,s,hs,hsv.trans h.reachable⟩
  6. There is a subset T ⊆ S ⊆ C of size t indexed by an embedding X.

    Since t ≤ |S|, by `ds1310_unpolarized_root_path_embed_fin` there exists an embedding X : Fin t ↪ S. Its image T has cardinality t and satisfies T ⊆ S ⊆ C.

    lines 90–94

    uses ds1310_unpolarized_root_path_embed_fin

      obtain ⟨X,hX⟩ := ds1310_unpolarized_root_path_embed_fin S t hSc
      let T := Finset.univ.map X
      have hT (i) : X i ∈ T := Finset.mem_map.mpr ⟨i,Finset.mem_univ _,rfl⟩
      have hTc : T.card=t := by simp [T]
      have hTC : T ⊆ C := by intro v hv; obtain ⟨i,_,rfl⟩ := Finset.mem_map.mp hv; exact hSC (hX i)
  7. Assuming some w ∈ B lies outside C, all neighbors of w lie in Cᶜ \ {w}, yielding |C| + t + 2 ≤ n + 2p.

    To show B ⊆ C, suppose there exists w ∈ B \ C. Since w ∉ C and C is closed under adjacency, no neighbor of w can belong to C, so N(w) ⊆ Cᶜ \ {w}. Comparing cardinalities using `Finset.card_le_card` gives deg(w) ≤ |Cᶜ| - 1. Since w ∈ B, deg(w) ≥ |B| - 1, so |B| ≤ |Cᶜ|. Using |Cᶜ| + |C| = |V| (`Finset.card_compl_add_card`) and |Bᶜ| + t + 2 ≤ n + 2p, linear arithmetic establishes |C| + t + 2 ≤ n + 2p.

    lines 95–107

    uses Finset.card_le_card, Finset.card_compl_add_card

      have hBC : B ⊆ C := by
        intro w hwb
        by_contra hwc
        have hOut : G.neighborFinset w ⊆ Cᶜ.erase w := by
          intro v hv
          have ha := (G.mem_neighborFinset w v).mp hv
          exact Finset.mem_erase.mpr ⟨ha.ne.symm,Finset.mem_compl.mpr (fun h => hwc (hclosed _ _ h ha.symm))⟩
        have hcc := Finset.card_le_card hOut
        rw [G.card_neighborFinset_eq_degree,Finset.card_erase_of_mem (Finset.mem_compl.mpr hwc)] at hcc
        have hd := hdeg w hwb
        have hcW := Finset.card_compl_add_card C
        have hbW := Finset.card_compl_add_card B
        have hcw : C.card+t+2 ≤ n+2*p := by omega
  8. In the case |C| + 3 ≤ 2n, setting D = C \ T yields an alternating path starting in S visiting t vertices of B, contradicting the assumption.

    Every vertex X(q) ∈ T ⊆ S ⊆ B has degree at least |B| - 1 and all its neighbors lie in C = (C \ T) ∪ T. Thus X(q) has at least |B| - 1 - t neighbors in C \ T (`Finset.card_union_le`). For any two indices i, j, inclusion-exclusion via `Finset.card_inter_add_card_union` and `Finset.card_sdiff_of_subset` gives |N(X(i)) ∩ N(X(j)) ∩ (C \ T)| ≥ 2(|B| - 1 - t) - |C \ T| = 2|B| - |C| - t - 2. From |B| ≥ n + t - 1 and |C| + 3 ≤ 2n, this is at least t - 1. Applying `ds1310_unpolarized_root_path_alt_path` with D = C \ T constructs a simple path starting in S that visits t vertices of B, which contradicts `hav` by `not_lt_of_ge`.

    lines 108–127

    uses Finset.card_union_le, Finset.card_inter_add_card_union, Finset.card_sdiff_of_subset, ds1310_unpolarized_root_path_alt_path, not_lt_of_ge

        by_cases hsmall : C.card+3 ≤ 2*n
        · obtain ⟨s,hs,z,P,hP,hcnt⟩ := ds1310_unpolarized_root_path_alt_path G B S (C \ T) t (by omega) X hX hSB
            (fun i h => (Finset.mem_sdiff.mp h).2 (hT i)) (by
              intro i j
              have hbd (q) : B.card-1 ≤ ((C \ T).filter (G.Adj (X q))).card+t := by
                have hs' : G.neighborFinset (X q) ⊆ (C \ T).filter (G.Adj (X q)) ∪ T := by
                  intro v hv; have ha := (G.mem_neighborFinset _ _).mp hv
                  by_cases hvt : v ∈ T
                  · exact Finset.mem_union_right _ hvt
                  · exact Finset.mem_union_left _ (Finset.mem_filter.mpr ⟨Finset.mem_sdiff.mpr ⟨hclosed _ _ (hSC (hX q)) ha,hvt⟩,ha⟩)
                have h1 := Finset.card_le_card hs'
                rw [G.card_neighborFinset_eq_degree] at h1
                have h2 := Finset.card_union_le ((C \ T).filter (G.Adj (X q))) T
                have h3 := hdeg _ (hSB (hX q)); omega
              have h1 := hbd i; have h2 := hbd j
              have h3 := Finset.card_sdiff_of_subset hTC
              have hh := Finset.card_inter_add_card_union ((C \ T).filter (G.Adj (X i))) ((C \ T).filter (G.Adj (X j)))
              have hsub := Finset.card_le_card (Finset.union_subset (Finset.filter_subset (G.Adj (X i)) (C \ T)) (Finset.filter_subset (G.Adj (X j)) (C \ T)))
              omega)
          exact (not_lt_of_ge hcnt) (hav s hs z P hP)
  9. In the case |C| + 3 > 2n, setting A = C ∩ Bᶜ similarly yields an alternating path visiting t vertices of B, completing the proof that B ⊆ C.

    Since w ∈ B \ C, the neighbors of w in Bᶜ cannot belong to C, so N(w) ∩ Bᶜ ⊆ Bᶜ \ A. By `Finset.card_sdiff_of_subset` and the hypothesis that w has at least 2p - t - 2 neighbors in Bᶜ, |A| ≤ |Bᶜ| - (2p - t - 2) ≤ n. For each X(i) ∈ T ⊆ C, all its neighbors in Bᶜ are in C, so N(X(i)) ∩ A = N(X(i)) ∩ Bᶜ, which has size at least 2p - t - 2. Inclusion-exclusion gives common neighbors in A at least 2(2p - t - 2) - |A| ≥ 4p - 2t - 4 - n ≥ t - 1 since n ≥ p + 3 and t < p. Applying `ds1310_unpolarized_root_path_alt_path` with D = A gives a path starting in S visiting t vertices of B, contradicting `hav` by `not_lt_of_ge`. Hence B ⊆ C holds in all cases.

    lines 128–149

    uses Finset.card_sdiff_of_subset, Finset.card_inter_add_card_union, ds1310_unpolarized_root_path_alt_path, not_lt_of_ge

        · let A := C ∩ Bᶜ
          have hAw : Bᶜ.filter (G.Adj w) ⊆ Bᶜ \ A := by
            intro v hv; obtain ⟨hb,ha⟩ := Finset.mem_filter.mp hv
            exact Finset.mem_sdiff.mpr ⟨hb,fun h => hwc (hclosed _ _ (Finset.mem_inter.mp h).1 ha.symm)⟩
          have haC : A.card ≤ n := by
            have h1 := Finset.card_le_card hAw
            have h2 := Finset.card_sdiff_of_subset (show A ⊆ Bᶜ from Finset.inter_subset_right)
            have h3 := hcross w hwb
            omega
          have hrow (i) : 2*p-t-2 ≤ (A.filter (G.Adj (X i))).card := by
            have he : A.filter (G.Adj (X i)) = Bᶜ.filter (G.Adj (X i)) := by
              ext v; simp only [A,Finset.mem_filter,Finset.mem_inter]
              exact ⟨fun h => ⟨h.1.2,h.2⟩,fun h => ⟨⟨hclosed _ _ (hSC (hX i)) h.2,h.1⟩,h.2⟩⟩
            rw [he]; exact hcross _ (hSB (hX i))
          obtain ⟨s,hs,z,P,hP,hcnt⟩ := ds1310_unpolarized_root_path_alt_path G B S A t (by omega) X hX hSB
            (fun i h => Finset.mem_compl.mp (Finset.mem_inter.mp h).2 (hSB (hX i))) (by
              intro i j
              have h1 := hrow i; have h2 := hrow j
              have hh := Finset.card_inter_add_card_union (A.filter (G.Adj (X i))) (A.filter (G.Adj (X j)))
              have hsub := Finset.card_le_card (Finset.union_subset (Finset.filter_subset (G.Adj (X i)) A) (Finset.filter_subset (G.Adj (X j)) A))
              omega)
          exact (not_lt_of_ge hcnt) (hav s hs z P hP)
  10. Every simple cycle in G visits fewer than t vertices of B.

    Let c be a simple cycle. If c visits no vertex of B, the intersection is empty and its size is 0 < t (`Finset.card_empty`). If c visits some vertex y ∈ B, since B ⊆ C, y is reachable from some s ∈ S. By `even_linked_double_star_rooted_cycle_cover`, there is a simple path P starting at s covering the support of c. By the contradiction hypothesis `hav`, P visits fewer than t vertices of B. Since V(c) ∩ B ⊆ V(P) ∩ B, c also visits fewer than t vertices of B by `Finset.card_le_card` and `lt_of_le_of_lt`.

    lines 150–163

    uses even_linked_double_star_rooted_cycle_cover, Finset.card_empty, Finset.card_le_card, lt_of_le_of_lt

      have hcirc : ∀ v, ∀ c : G.Walk v v, c.IsCycle → (c.support.toFinset∩B).card < t := by
        intro v c hc
        by_cases hz : (c.support.toFinset∩B).Nonempty
        · obtain ⟨y,hy⟩ := hz
          obtain ⟨hyc,hyB⟩ := Finset.mem_inter.mp hy
          have hy' := List.mem_toFinset.mp hyc
          obtain ⟨s,hs,hsy⟩ := (Finset.mem_filter.mp (hBC hyB)).2
          obtain ⟨z,P,hP,hsup⟩ := even_linked_double_star_rooted_cycle_cover hsy (c.rotate y hy') (hc.rotate hy')
          have hsub : c.support.toFinset∩B ⊆ P.support.toFinset∩B := by
            intro w hw; obtain ⟨hsw,hwB⟩ := Finset.mem_inter.mp hw
            exact Finset.mem_inter.mpr ⟨List.mem_toFinset.mpr (hsup ((c.mem_support_rotate_iff _ _).mpr (List.mem_toFinset.mp hsw))),hwB⟩
          exact lt_of_le_of_lt (Finset.card_le_card hsub) (hav s hs z P hP)
        · have he := Finset.not_nonempty_iff_eq_empty.mp hz
          rw [he,Finset.card_empty]; omega
  11. The degree sum over B cannot simultaneously satisfy the cycle-based upper bound and the minimum degree lower bound, reaching a contradiction. automation

    Since every simple cycle visits fewer than t vertices of B, the hypothesis `hweight` applies to give ∑_{b ∈ B} deg(b) ≤ (t - 1)|V|. On the other hand, summing the degree bound deg(b) ≥ |B| - 1 over all b ∈ B via `Finset.sum_le_sum` gives ∑_{b ∈ B} deg(b) ≥ |B|(|B| - 1). Combining these yields |B|(|B| - 1) ≤ (t - 1)(|B| + |Bᶜ|) via `Finset.card_compl_add_card`. Casting to integers and setting b = |B| and a = |Bᶜ|, non-linear arithmetic (`nlinarith`) shows this inequality is incompatible with b ≥ n + t - 1, a + t + 2 ≤ n + 2p, n ≥ p + 3, and t < p, using non-negative products (`mul_nonneg`, `sq_nonneg`).

    lines 164–182

    uses Finset.sum_le_sum, Finset.card_compl_add_card, mul_nonneg, sq_nonneg

      have hbound := hweight hcirc
      have hlow : B.card*(B.card-1) ≤ ∑ b ∈ B, G.degree b := by
        simpa using Finset.sum_le_sum (s := B) (f := fun _ => B.card-1) hdeg
      have hW := Finset.card_compl_add_card B
      have hp' : 1 ≤ B.card := by omega
      have ht' : 1 ≤ t := by omega
      have hnt' : 1 ≤ n+t := by omega
      zify [hp',ht',hnt'] at hbound hlow hW hn ht htp hBsize hAsize
      let b : ℤ := B.card
      let a : ℤ := Bᶜ.card
      have hb : (n:ℤ)+t-1 ≤ b := hBsize
      have ha : a+t+2 ≤ n+2*(p:ℤ) := hAsize
      have mul1 := mul_nonneg (show 0 ≤ b-((n:ℤ)+t-1) by omega) (show 0 ≤ b+n-1 by omega)
      have mul2 := mul_nonneg (show 0 ≤ (t:ℤ)-1 by omega) (show 0 ≤ (n:ℤ)+2*p-t-2-a by omega)
      have mul3 := mul_nonneg (show 0 ≤ (n:ℤ)-p by omega) (show 0 ≤ (n:ℤ)+p-1 by omega)
      have sq := sq_nonneg ((p:ℤ)-t)
      dsimp [b,a] at *
      nlinarith only [hbound,hlow,hW,mul1,mul2,mul3,sq,hn,ht,htp,
        congrArg (fun v : ℤ => ((t:ℤ)-1)*v) hW]
Function.Embedding.nonempty_of_card_le
If the cardinality of a finite type α is at most that of β, there exists an embedding (injective map) from α into β.
Function.Embedding.subtype
The canonical embedding from a subtype into its ambient type.
Function.Embedding.ofIsEmpty
An embedding from an empty type into any type.
Finset.exists_mem_notMem_of_card_lt_card
If a finite set s has strictly smaller cardinality than t, there exists an element in t that is not in s.
Fin.snoc_injective_of_injective
Appending an element not in the range of an injective map yields an injective map on the extended finite domain.
Fin.lastCases
Case distinction on Fin (n + 1) separating the last element from the first n elements.
ds1310_unpolarized_root_path_greedy
Given a family of finite candidate sets where each set has cardinality strictly greater than its index, one can greedily select distinct elements from each set.
lt_of_lt_of_le
If a < b and b ≤ c, then a < c.
Walk.ofSupport
Constructs a graph walk from a non-empty list of vertices that forms an adjacency chain.
Walk.support_ofSupport
The vertex support of the walk constructed by `Walk.ofSupport` is the defining list.
List.nodup_ofFn_ofInjective
Applying an injective function to all elements of a finite type produces a list with no duplicate entries.
Walk.IsPath.mk'
A walk whose vertex support contains no duplicate vertices is a simple path.
Finset.card_le_card
If s ⊆ t for finite sets, then |s| ≤ |t|.
Reachable.refl
Every vertex is reachable from itself in a simple graph.
ds1310_unpolarized_root_path_embed_fin
If k ≤ |S|, there exists an embedding of Fin k into S.
Finset.card_compl_add_card
For any subset s of a finite type V, |sᶜ| + |s| = |V|.
ds1310_unpolarized_root_path_alt_path
If t vertices in S ⊆ B have pairwise common neighborhood of size at least t - 1 in a disjoint set D, there exists an alternating simple path starting in S visiting at least t vertices of B.
Finset.card_union_le
The cardinality of a union of two finite sets is at most the sum of their cardinalities.
Finset.card_inter_add_card_union
For any two finite sets s and t, |s ∩ t| + |s ∪ t| = |s| + |t|.
Finset.card_sdiff_of_subset
If s ⊆ t for finite sets, then |t \ s| = |t| - |s|.
not_lt_of_ge
If a ≤ b, then b < a is false.
even_linked_double_star_rooted_cycle_cover
If vertex v is reachable from s and c is a cycle through v, there exists a simple path starting at s covering the vertex support of c.
lt_of_le_of_lt
If a ≤ b and b < c, then a < c.
Finset.card_empty
The cardinality of the empty set is 0.
Finset.sum_le_sum
A sum of pointwise smaller values over a finite set is bounded by the sum of the larger values.
mul_nonneg
The product of two non-negative numbers is non-negative.
sq_nonneg
The square of any real or integer value is non-negative.

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

open SimpleGraph Classicalopen scoped BigOperatorsprivate theorem ds1310_unpolarized_root_path_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_unpolarized_root_path_greedy {V : Type*} [DecidableEq V] {k : ℕ}    (pool : Fin k → Finset V) (h : ∀ i, i.val < (pool i).card) :    ∃ f : Fin k ↪ V, ∀ i, f i ∈ pool i := by  induction k with  | zero => exact ⟨Function.Embedding.ofIsEmpty, fun i => i.elim0⟩  | succ k ih =>    obtain ⟨f,hf⟩ := ih (fun i => pool i.castSucc) (fun i => h i.castSucc)    have hcard : (Finset.univ.map f).card < (pool (Fin.last k)).card := by      simpa using h (Fin.last k)    obtain ⟨z,hz,hnew⟩ := Finset.exists_mem_notMem_of_card_lt_card hcard    have hnot : z ∉ Set.range f := by      rintro ⟨i,rfl⟩; exact hnew (Finset.mem_map.mpr ⟨i,Finset.mem_univ _,rfl⟩)    refine ⟨⟨Fin.snoc f z,Fin.snoc_injective_of_injective f.injective hnot⟩,?_⟩    intro i    refine Fin.lastCases ?_ (fun j => ?_) i    · simpa using hz    · simpa using hf jprivate theorem ds1310_unpolarized_root_path_alt_path {V : Type*} [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (B S D : Finset V)    (t : ℕ) (ht : 2 ≤ t) (X : Fin t ↪ V) (hX : ∀ i, X i ∈ S) (hSB : S ⊆ B)    (hdis : ∀ i, X i ∉ D)    (hpair : ∀ i j, t-1 ≤ ((D.filter (G.Adj (X i))) ∩ (D.filter (G.Adj (X j)))).card) :    ∃ s ∈ S, ∃ z, ∃ P : G.Walk s z, P.IsPath ∧ t ≤ (P.support.toFinset∩B).card := by  classical  let E (i : Fin (t-1)) := (D.filter (G.Adj (X ⟨i.val,by omega⟩))) ∩    (D.filter (G.Adj (X ⟨i.val+1,by omega⟩)))  obtain ⟨Y,hY⟩ := ds1310_unpolarized_root_path_greedy E (fun i => lt_of_lt_of_le i.isLt (hpair _ _))  have hn (i j) : X i ≠ Y j := fun he => hdis i (he ▸ (Finset.mem_filter.mp (Finset.mem_inter.mp (hY j)).1).1)  let F (i : Fin (2*t-1)) := if h : i.val%2=0 then X ⟨i.val/2,by omega⟩ else Y ⟨i.val/2,by omega⟩  have hf : Function.Injective F := by    intro i j he; unfold F at he; split at he <;> split at he    · have h := congrArg Fin.val (X.injective he); apply Fin.ext; dsimp at h; omega    · exact (hn _ _ he).elim    · exact (hn _ _ he.symm).elim    · have h := congrArg Fin.val (Y.injective he); apply Fin.ext; dsimp at h; omega  let L := List.ofFn F  have hl : L ≠ [] := by intro h; have hh := congrArg List.length h; simp [L] at hh; omega  have had : L.IsChain G.Adj := by    apply List.isChain_ofFn.mpr    intro i hi    dsimp [F]    split <;> split    · omega    · have hei : (i+1)/2=i/2 := by omega      rw [show (⟨(i+1)/2,by omega⟩ : Fin (t-1)) = ⟨i/2,by omega⟩ from Fin.ext hei]      exact (Finset.mem_filter.mp (Finset.mem_inter.mp (hY ⟨i/2,by omega⟩)).1).2    · have hei : (i+1)/2=i/2+1 := by omega      rw [show (⟨(i+1)/2,by omega⟩ : Fin t) = ⟨i/2+1,by omega⟩ from Fin.ext hei]      exact (Finset.mem_filter.mp (Finset.mem_inter.mp (hY ⟨i/2,by omega⟩)).2).2.symm    · omega  let P := Walk.ofSupport L hl had  have hsup : P.support=L := Walk.support_ofSupport hl had  have hf0 : L.head hl = X ⟨0,by omega⟩ := by    rw [List.head_eq_getElem]; simp [L,F]  have hsub : Finset.univ.map X ⊆ P.support.toFinset∩B := by    intro v hv; obtain ⟨i,_,rfl⟩ := Finset.mem_map.mp hv    refine Finset.mem_inter.mpr ⟨?_,hSB (hX i)⟩    rw [hsup,List.mem_toFinset]    apply List.mem_ofFn.mpr    exact ⟨⟨2*i.val,by omega⟩,by simp [F,Nat.mul_comm]⟩  refine ⟨_,hf0 ▸ hX _,_,P,Walk.IsPath.mk' (by rw [hsup]; exact List.nodup_ofFn_ofInjective hf),?_⟩  simpa using Finset.card_le_card hsubtheorem even_linked_double_star_unpolarized_root_path {V : Type*} [Fintype V] [DecidableEq V]    (G : SimpleGraph V) [DecidableRel G.Adj] (B S : Finset V) (p n t : ℕ)    (hn : p+3 ≤ n) (ht : 3 ≤ t) (htp : t < p) (hSB : S ⊆ B) (hSc : t ≤ S.card)    (hBsize : n+t-1 ≤ B.card) (hAsize : Bᶜ.card+t+2 ≤ n+2*p)    (hdeg : ∀ b ∈ B, B.card-1 ≤ G.degree b)    (hcross : ∀ b ∈ B, 2*p-t-2 ≤ (Bᶜ.filter (G.Adj b)).card)    (hweight : (∀ v, ∀ c : G.Walk v v, c.IsCycle → (c.support.toFinset∩B).card < t) →      (∑ b ∈ B, G.degree b) ≤ (t-1)*Fintype.card V) :    ∃ s ∈ S, ∃ z, ∃ P : G.Walk s z, P.IsPath ∧ t ≤ (P.support.toFinset∩B).card := by  classical  by_contra! hav  let C := Finset.univ.filter (fun v => ∃ s ∈ S, G.Reachable s v)  have hSC : S ⊆ C := fun s hs => Finset.mem_filter.mpr ⟨Finset.mem_univ _,s,hs,Reachable.refl _⟩  have hclosed (v w : V) (hv : v ∈ C) (h : G.Adj v w) : w ∈ C := by    obtain ⟨s,hs,hsv⟩ := (Finset.mem_filter.mp hv).2    exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,s,hs,hsv.trans h.reachable⟩  obtain ⟨X,hX⟩ := ds1310_unpolarized_root_path_embed_fin S t hSc  let T := Finset.univ.map X  have hT (i) : X i ∈ T := Finset.mem_map.mpr ⟨i,Finset.mem_univ _,rfl⟩  have hTc : T.card=t := by simp [T]  have hTC : T ⊆ C := by intro v hv; obtain ⟨i,_,rfl⟩ := Finset.mem_map.mp hv; exact hSC (hX i)  have hBC : B ⊆ C := by    intro w hwb    by_contra hwc    have hOut : G.neighborFinset w ⊆ Cᶜ.erase w := by      intro v hv      have ha := (G.mem_neighborFinset w v).mp hv      exact Finset.mem_erase.mpr ⟨ha.ne.symm,Finset.mem_compl.mpr (fun h => hwc (hclosed _ _ h ha.symm))⟩    have hcc := Finset.card_le_card hOut    rw [G.card_neighborFinset_eq_degree,Finset.card_erase_of_mem (Finset.mem_compl.mpr hwc)] at hcc    have hd := hdeg w hwb    have hcW := Finset.card_compl_add_card C    have hbW := Finset.card_compl_add_card B    have hcw : C.card+t+2 ≤ n+2*p := by omega    by_cases hsmall : C.card+3 ≤ 2*n    · obtain ⟨s,hs,z,P,hP,hcnt⟩ := ds1310_unpolarized_root_path_alt_path G B S (C \ T) t (by omega) X hX hSB        (fun i h => (Finset.mem_sdiff.mp h).2 (hT i)) (by          intro i j          have hbd (q) : B.card-1 ≤ ((C \ T).filter (G.Adj (X q))).card+t := by            have hs' : G.neighborFinset (X q) ⊆ (C \ T).filter (G.Adj (X q)) ∪ T := by              intro v hv; have ha := (G.mem_neighborFinset _ _).mp hv              by_cases hvt : v ∈ T              · exact Finset.mem_union_right _ hvt              · exact Finset.mem_union_left _ (Finset.mem_filter.mpr ⟨Finset.mem_sdiff.mpr ⟨hclosed _ _ (hSC (hX q)) ha,hvt⟩,ha⟩)            have h1 := Finset.card_le_card hs'            rw [G.card_neighborFinset_eq_degree] at h1            have h2 := Finset.card_union_le ((C \ T).filter (G.Adj (X q))) T            have h3 := hdeg _ (hSB (hX q)); omega          have h1 := hbd i; have h2 := hbd j          have h3 := Finset.card_sdiff_of_subset hTC          have hh := Finset.card_inter_add_card_union ((C \ T).filter (G.Adj (X i))) ((C \ T).filter (G.Adj (X j)))          have hsub := Finset.card_le_card (Finset.union_subset (Finset.filter_subset (G.Adj (X i)) (C \ T)) (Finset.filter_subset (G.Adj (X j)) (C \ T)))          omega)      exact (not_lt_of_ge hcnt) (hav s hs z P hP)    · let A := C ∩ Bᶜ      have hAw : Bᶜ.filter (G.Adj w) ⊆ Bᶜ \ A := by        intro v hv; obtain ⟨hb,ha⟩ := Finset.mem_filter.mp hv        exact Finset.mem_sdiff.mpr ⟨hb,fun h => hwc (hclosed _ _ (Finset.mem_inter.mp h).1 ha.symm)⟩      have haC : A.card ≤ n := by        have h1 := Finset.card_le_card hAw        have h2 := Finset.card_sdiff_of_subset (show A ⊆ Bᶜ from Finset.inter_subset_right)        have h3 := hcross w hwb        omega      have hrow (i) : 2*p-t-2 ≤ (A.filter (G.Adj (X i))).card := by        have he : A.filter (G.Adj (X i)) = Bᶜ.filter (G.Adj (X i)) := by          ext v; simp only [A,Finset.mem_filter,Finset.mem_inter]          exact ⟨fun h => ⟨h.1.2,h.2⟩,fun h => ⟨⟨hclosed _ _ (hSC (hX i)) h.2,h.1⟩,h.2⟩⟩        rw [he]; exact hcross _ (hSB (hX i))      obtain ⟨s,hs,z,P,hP,hcnt⟩ := ds1310_unpolarized_root_path_alt_path G B S A t (by omega) X hX hSB        (fun i h => Finset.mem_compl.mp (Finset.mem_inter.mp h).2 (hSB (hX i))) (by          intro i j          have h1 := hrow i; have h2 := hrow j          have hh := Finset.card_inter_add_card_union (A.filter (G.Adj (X i))) (A.filter (G.Adj (X j)))          have hsub := Finset.card_le_card (Finset.union_subset (Finset.filter_subset (G.Adj (X i)) A) (Finset.filter_subset (G.Adj (X j)) A))          omega)      exact (not_lt_of_ge hcnt) (hav s hs z P hP)  have hcirc : ∀ v, ∀ c : G.Walk v v, c.IsCycle → (c.support.toFinset∩B).card < t := by    intro v c hc    by_cases hz : (c.support.toFinset∩B).Nonempty    · obtain ⟨y,hy⟩ := hz      obtain ⟨hyc,hyB⟩ := Finset.mem_inter.mp hy      have hy' := List.mem_toFinset.mp hyc      obtain ⟨s,hs,hsy⟩ := (Finset.mem_filter.mp (hBC hyB)).2      obtain ⟨z,P,hP,hsup⟩ := even_linked_double_star_rooted_cycle_cover hsy (c.rotate y hy') (hc.rotate hy')      have hsub : c.support.toFinset∩B ⊆ P.support.toFinset∩B := by        intro w hw; obtain ⟨hsw,hwB⟩ := Finset.mem_inter.mp hw        exact Finset.mem_inter.mpr ⟨List.mem_toFinset.mpr (hsup ((c.mem_support_rotate_iff _ _).mpr (List.mem_toFinset.mp hsw))),hwB⟩      exact lt_of_le_of_lt (Finset.card_le_card hsub) (hav s hs z P hP)    · have he := Finset.not_nonempty_iff_eq_empty.mp hz      rw [he,Finset.card_empty]; omega  have hbound := hweight hcirc  have hlow : B.card*(B.card-1) ≤ ∑ b ∈ B, G.degree b := by    simpa using Finset.sum_le_sum (s := B) (f := fun _ => B.card-1) hdeg  have hW := Finset.card_compl_add_card B  have hp' : 1 ≤ B.card := by omega  have ht' : 1 ≤ t := by omega  have hnt' : 1 ≤ n+t := by omega  zify [hp',ht',hnt'] at hbound hlow hW hn ht htp hBsize hAsize  let b : ℤ := B.card  let a : ℤ := Bᶜ.card  have hb : (n:ℤ)+t-1 ≤ b := hBsize  have ha : a+t+2 ≤ n+2*(p:ℤ) := hAsize  have mul1 := mul_nonneg (show 0 ≤ b-((n:ℤ)+t-1) by omega) (show 0 ≤ b+n-1 by omega)  have mul2 := mul_nonneg (show 0 ≤ (t:ℤ)-1 by omega) (show 0 ≤ (n:ℤ)+2*p-t-2-a by omega)  have mul3 := mul_nonneg (show 0 ≤ (n:ℤ)-p by omega) (show 0 ≤ (n:ℤ)+p-1 by omega)  have sq := sq_nonneg ((p:ℤ)-t)  dsimp [b,a] at *  nlinarith only [hbound,hlow,hW,mul1,mul2,mul3,sq,hn,ht,htp,    congrArg (fun v : ℤ => ((t:ℤ)-1)*v) hW]
See it in the graphDiscuss this resultChallenge it