AFTD Auto-Formalizing Theoretical Domains

even_linked_double_star_ordered_alternating_cycle

theoremverified

Let S be a k-set, k≥2, disjoint from a finite set D of at least k+2m−1 vertices, m≥1. Each member of S misses at most m−1 neighbors in D. If a subset B of S has size at most half of k, there is a spanning alternating cycle through S and k different members of D. No two vertices of B are consecutive in the cyclic order on S, and every vertex of S retains at least m unused neighbors in D.

Statement

theorem even_linked_double_star_ordered_alternating_cycle {V : Type*} [DecidableEq V]
    (G : SimpleGraph V) [DecidableRel G.Adj] (S B D : Finset V) (k m : ℕ) (hk : 2 ≤ k) (hm : 1 ≤ m)
    (hS : S.card=k) (hdis : Disjoint S D) (hB : B ⊆ S) (hbad : 2*B.card ≤ k)
    (hD : k+2*m-1 ≤ D.card)
    (hmissing : ∀ x ∈ S, (D.filter (fun v => ¬G.Adj x v)).card ≤ m-1) :
    ∃ X Y : Fin k ↪ V, Finset.univ.map X=S ∧ Finset.univ.map Y ⊆ D ∧
      (∀ i, G.Adj (X i) (Y i) ∧ G.Adj (X (finRotate k i)) (Y i)) ∧
      (∀ i, X i ∉ B ∨ X (finRotate k i) ∉ B) ∧
      ∀ i, m ≤ ((D \ Finset.univ.map Y).filter (G.Adj (X i))).card
Source
https://arxiv.org/abs/2611.19632; structural lemma for OP-1853.
Verified
29 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Used by 2

The proof, explained

The alternating cycle is constructed by first ordering the vertices of S cyclically so that all vertices of B occupy even positions; since 2|B| ≤ k, no two elements of B can be consecutive in this order. For each pair of cyclically consecutive vertices in S, their common neighborhood in D has size at least |D| - 2(m - 1) ≥ k + 1 by inclusion-exclusion. A greedy selection lemma then picks distinct vertices in D from each common neighborhood to form the alternating cycle. Finally, because each vertex of S misses at most m - 1 neighbors in D and only k vertices are used in D, every vertex of S retains at least m unused neighbors in D.

  1. For k = 0, the empty embedding trivially selects an element from each pool.

    When k = 0, the domain Fin 0 is empty, so the unique embedding from an empty type into V vacuously selects an element from each pool.

    lines 7–8

    uses Function.Embedding.ofIsEmpty

      induction k with
      | zero => exact ⟨Function.Embedding.ofIsEmpty, fun i => i.elim0⟩
  2. In the inductive step of greedy selection, applying the induction hypothesis to the first k pools leaves an unused element in the (k+1)-th pool.

    By the induction hypothesis on the first k pools, there is an embedding f choosing distinct elements from pool 0 through pool (k-1). The image of f has size k, while pool k has size strictly greater than k. By Finset.exists_mem_notMem_of_card_lt_card, there exists an element z in pool k that is not in the image of f.

    lines 9–15

    uses Finset.exists_mem_notMem_of_card_lt_card, Finset.mem_map.mpr, Finset.mem_univ

      | 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⟩)
  3. Extending the embedding by appending the unused element produces an injective choice from all k+1 pools.

    We extend f to Fin (k+1) by setting the last element to z using Fin.snoc. Because z was chosen outside the range of f, Fin.snoc_injective_of_injective ensures the extension remains injective. Fin.lastCases verifies that the last index lands in pool k and all previous indices land in their corresponding pools.

    lines 16–20

    uses Fin.snoc, Fin.snoc_injective_of_injective, Fin.lastCases

        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
  4. There exists a permutation σ of Fin k that maps each even index 2 · rank(b) to the coordinate of b ∈ B in S.

    We fix a bijection e between Fin k and S, and let idx(b) be the index in Fin k corresponding to b ∈ B. We map each b ∈ B to the even position pos(b) = 2 · rank(b), which is strictly less than k because 2|B| ≤ k. Since both idx and pos are injective maps from B to Fin k, Equiv.Perm.exists_extending_pair yields a permutation σ of Fin k with σ(pos(b)) = idx(b).

    lines 25–38

    uses Finset.equivFinOfCardEq, Equiv.Perm.exists_extending_pair, Fin.ext, Subtype.ext, congrArg

      classical
      let e := (Finset.equivFinOfCardEq hS).symm
      let idx (b : ↥B) := e.symm ⟨b.val,hB b.property⟩
      let pos (b : ↥B) : Fin k := ⟨2*(B.equivFin b).val,by have := (B.equivFin b).isLt; omega⟩
      have hinj : Function.Injective idx := by
        intro a b h
        have he := e.symm.injective h
        exact Subtype.ext (congrArg (fun z : ↥S => z.val) he)
      have hpos : Function.Injective pos := by
        intro a b h
        have hh := congrArg Fin.val h
        apply B.equivFin.injective; apply Fin.ext
        dsimp [pos] at hh; omega
      obtain ⟨σ,hσ⟩ := Equiv.Perm.exists_extending_pair pos idx hpos hinj
  5. The ordering X = e ∘ σ places every element of B at an even index.

    We define the embedding X by composing the permutation σ with the bijection e and the subtype inclusion. If X(i) ∈ B, then σ(i) = idx(X(i)) = σ(pos(X(i))). By injectivity of σ, i = pos(X(i)), so i is an even index.

    lines 39–45

    uses Function.Embedding.subtype, Subtype.ext

      let X : Fin k ↪ V := (σ.trans e).toEmbedding.trans (Function.Embedding.subtype _)
      have hx (i) : X i ∈ S := (e (σ i)).property
      have xpos (i) (hi : X i ∈ B) : i=pos ⟨X i,hi⟩ := by
        apply σ.injective
        rw [hσ]
        apply e.injective
        exact Subtype.ext (by simp [X,idx])
  6. The image of X is the entire set S.

    By construction, every value of X lies in S. Since X is injective, its image has cardinality k = |S|, so Finset.eq_of_subset_of_card_le implies that the image equals S.

    lines 46–49

    uses Finset.eq_of_subset_of_card_le, Finset.mem_map.mp

      refine ⟨X,?_,?_⟩
      · apply Finset.eq_of_subset_of_card_le
        · intro v hv; obtain ⟨i,_,rfl⟩ := Finset.mem_map.mp hv; exact hx i
        · simp [hS]
  7. No two vertices of B are adjacent in the cyclic order defined by X.

    Suppose for contradiction that both X(i) and X(i+1) belong to B, where i+1 is the cyclic successor under finRotate. Then both i and its cyclic successor would be even numbers. For i < k-1, finRotate_of_lt shows that the cyclic successor is i+1, which has opposite parity to i. Linear arithmetic over the index parities closes the contradiction.

    lines 50–62

    uses finRotate_of_lt, congrArg

      · intro i
        by_contra! hh
        have h1 := congrArg Fin.val (xpos i hh.1)
        have h2 := congrArg Fin.val (xpos (finRotate k i) hh.2)
        dsimp only [pos] at h1 h2
        have h3 := (B.equivFin ⟨X i,hh.1⟩).isLt
        have hir : (finRotate k i).val=i.val+1 := by
          cases k with
          | zero => exact i.elim0
          | succ k =>
            obtain ⟨a,ha⟩ := i
            exact congrArg Fin.val (finRotate_of_lt (by dsimp at *; omega : a < k))
        omega
  8. There exists an ordering X of S in which no two elements of B are cyclically consecutive.

    We apply ds1310_ordered_alternating_cycle_separate_bad to obtain an embedding X from Fin k into S such that for every index i, at least one of X(i) and X(i+1) does not belong to B.

    lines 73–75

    uses ds1310_ordered_alternating_cycle_separate_bad, Finset.mem_map.mpr, Finset.mem_univ

      classical
      obtain ⟨X,hX,hgood⟩ := ds1310_ordered_alternating_cycle_separate_bad S B k hS hB hbad
      have hx (i) : X i ∈ S := hX ▸ Finset.mem_map.mpr ⟨i,Finset.mem_univ _,rfl⟩
  9. Each vertex X(i) ∈ S has at least |D| - (m - 1) neighbors in D.

    Let A(i) be the set of neighbors of X(i) in D. By Finset.card_filter_add_card_filter_not, |D| is partitioned into the neighbors and non-neighbors of X(i). Because X(i) misses at most m-1 neighbors in D, we have |D| ≤ |A(i)| + (m-1).

    lines 76–79

    uses Finset.card_filter_add_card_filter_not

      let A (i) := D.filter (G.Adj (X i))
      have hdeg (i) : D.card ≤ (A i).card+(m-1) := by
        have h := Finset.card_filter_add_card_filter_not (s := D) (p := G.Adj (X i))
        have hh := hmissing _ (hx i); dsimp [A]; omega
  10. Any two cyclically consecutive vertices X(i) and X(i+1) share at least k common neighbors in D.

    Let Q(i) = A(i) ∩ A(i+1) be their common neighborhood in D. By inclusion-exclusion (Finset.card_inter_add_card_union), |Q(i)| = |A(i)| + |A(i+1)| - |A(i) ∪ A(i+1)|. Since the union is contained in D, its size is at most |D|. Combining this with the lower bounds on |A(i)| and |A(i+1)| and the hypothesis |D| ≥ k + 2m - 1, linear arithmetic proves |Q(i)| ≥ k.

    lines 80–85

    uses Finset.card_inter_add_card_union, Finset.card_le_card, Finset.union_subset, Finset.filter_subset

      let Q (i) := A i ∩ A (finRotate k i)
      have hQ (i : Fin k) : k ≤ (Q i).card := by
        have hU : (A i ∪ A (finRotate k i)).card ≤ D.card := Finset.card_le_card
          (Finset.union_subset (Finset.filter_subset _ _) (Finset.filter_subset _ _))
        have he := Finset.card_inter_add_card_union (A i) (A (finRotate k i))
        have h1 := hdeg i; have h2 := hdeg (finRotate k i); dsimp [Q]; omega
  11. There exists an injective choice Y : Fin k ↪ V with Y(i) ∈ Q(i) for all i.

    Because |Q(i)| ≥ k > i for every i in Fin k, we can apply the greedy selection lemma ds1310_ordered_alternating_cycle_greedy to Q to obtain an embedding Y selecting distinct common neighbors Y(i) ∈ Q(i).

    line 86

    uses ds1310_ordered_alternating_cycle_greedy, lt_of_lt_of_le

      obtain ⟨Y,hY⟩ := ds1310_ordered_alternating_cycle_greedy Q (fun i => lt_of_lt_of_le i.isLt (hQ i))
  12. The sequence Y is contained in D and alternates with X in the graph G.

    Each Y(i) belongs to Q(i) = A(i) ∩ A(i+1), which means Y(i) ∈ D and Y(i) is adjacent to both X(i) and X(i+1). Together with the separation property of X, this completes the alternating cycle.

    lines 87–93

    uses Finset.mem_map.mp

      refine ⟨X,Y,hX,?_,?_,hgood,?_⟩
      · intro v hv
        obtain ⟨i,_,rfl⟩ := Finset.mem_map.mp hv
        exact (Finset.mem_filter.mp (Finset.mem_inter.mp (hY i)).1).1
      · intro i
        obtain ⟨ha,hb⟩ := Finset.mem_inter.mp (hY i)
        exact ⟨(Finset.mem_filter.mp ha).2,(Finset.mem_filter.mp hb).2⟩
  13. Every vertex X(i) retains at least m unused neighbors in D \ Y.

    The neighbors of X(i) in D \ Y are A(i) \ Y. Since Y has size k, Finset.le_card_sdiff gives |A(i) \ Y| ≥ |A(i)| - k. Using |A(i)| ≥ |D| - (m-1) and |D| ≥ k + 2m - 1, linear arithmetic gives |A(i) \ Y| ≥ m.

    lines 94–100

    uses Finset.le_card_sdiff, Finset.card_map, Finset.card_univ, Fintype.card_fin

      · intro i
        have he : (D \ Finset.univ.map Y).filter (G.Adj (X i)) = A i \ Finset.univ.map Y := by
          ext v; simp only [A,Finset.mem_filter,Finset.mem_sdiff]; tauto
        rw [he]
        have h1 := Finset.le_card_sdiff (Finset.univ.map Y) (A i)
        have h2 := hdeg i
        simp only [Finset.card_map, Finset.card_univ,Fintype.card_fin] at h1; omega
Function.Embedding.ofIsEmpty
the unique embedding from an empty type into any other type
Finset.exists_mem_notMem_of_card_lt_card
if a finite set s is strictly smaller than a finite set t, there exists an element in t that does not belong to s
Finset.mem_univ
every element of a finite type belongs to the universal finset `univ`
Fin.snoc
extends a function on `Fin n` by appending a specified value at index `n`
Fin.snoc_injective_of_injective
appending a value outside the range of an injective function yields an injective function
Fin.lastCases
proof by cases on `Fin (n + 1)`: either the index is the last element `Fin.last n` or it is an earlier element `j.castSucc`
Finset.equivFinOfCardEq
a finite set of cardinality n is in bijection with `Fin n`
Fin.ext
two elements of `Fin n` are equal if and only if their underlying natural numbers are equal
Subtype.ext
two elements of a subtype are equal if and only if their underlying values are equal
congrArg
a function applied to equal inputs yields equal outputs
Equiv.Perm.exists_extending_pair
any partial bijection between subsets of equal size can be extended to a permutation of the whole finite set
Function.Embedding.subtype
the canonical inclusion embedding from a subtype into its ambient type
Finset.eq_of_subset_of_card_le
if s ⊆ t and |t| ≤ |s| for finite sets, then s = t
Finset.mem_map.mp
if an element belongs to the image under an embedding, it is the image of some element in the domain
finRotate_of_lt
for k < n, rotating `Fin (n + 1)` maps index k to k + 1
ds1310_ordered_alternating_cycle_separate_bad
a subset S of size k with a subcollection B of size at most k/2 can be ordered cyclically so that no two elements of B are adjacent
Finset.mem_map.mpr
the image of an element in the domain belongs to the mapped finset
Finset.card_filter_add_card_filter_not
the number of elements satisfying a predicate plus the number satisfying its negation equals the cardinality of the original set
Finset.card_inter_add_card_union
for finite sets s and t, |s ∩ t| + |s ∪ t| = |s| + |t|
Finset.card_le_card
if s ⊆ t, then |s| ≤ |t|
Finset.union_subset
if s ⊆ u and t ⊆ u, then s ∪ t ⊆ u
Finset.filter_subset
filtering a finset produces a subset of the original finset
ds1310_ordered_alternating_cycle_greedy
given k finite sets where the i-th set has size strictly greater than i, one can injectively choose an element from each set
lt_of_lt_of_le
strict inequality is transitive with non-strict inequality: a < b ≤ c implies a < c
Finset.le_card_sdiff
for finite sets, |t \\ s| ≥ |t| - |s|
Finset.card_map
the cardinality of the image under an embedding equals the cardinality of the domain set
Finset.card_univ
the cardinality of `univ` on a finite type equals the cardinality of the type
Fintype.card_fin
the cardinality of `Fin n` is n

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_ordered_alternating_cycle_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_ordered_alternating_cycle_separate_bad {V : Type*} (S B : Finset V) (k : ℕ) (hS : S.card=k)    (hB : B ⊆ S) (hsmall : 2*B.card ≤ k) :    ∃ X : Fin k ↪ V, Finset.univ.map X=S ∧ ∀ i, X i ∉ B ∨ X (finRotate k i) ∉ B := by  classical  let e := (Finset.equivFinOfCardEq hS).symm  let idx (b : ↥B) := e.symm ⟨b.val,hB b.property⟩  let pos (b : ↥B) : Fin k := ⟨2*(B.equivFin b).val,by have := (B.equivFin b).isLt; omega⟩  have hinj : Function.Injective idx := by    intro a b h    have he := e.symm.injective h    exact Subtype.ext (congrArg (fun z : ↥S => z.val) he)  have hpos : Function.Injective pos := by    intro a b h    have hh := congrArg Fin.val h    apply B.equivFin.injective; apply Fin.ext    dsimp [pos] at hh; omega  obtain ⟨σ,hσ⟩ := Equiv.Perm.exists_extending_pair pos idx hpos hinj  let X : Fin k ↪ V := (σ.trans e).toEmbedding.trans (Function.Embedding.subtype _)  have hx (i) : X i ∈ S := (e (σ i)).property  have xpos (i) (hi : X i ∈ B) : i=pos ⟨X i,hi⟩ := by    apply σ.injective    rw [hσ]    apply e.injective    exact Subtype.ext (by simp [X,idx])  refine ⟨X,?_,?_⟩  · apply Finset.eq_of_subset_of_card_le    · intro v hv; obtain ⟨i,_,rfl⟩ := Finset.mem_map.mp hv; exact hx i    · simp [hS]  · intro i    by_contra! hh    have h1 := congrArg Fin.val (xpos i hh.1)    have h2 := congrArg Fin.val (xpos (finRotate k i) hh.2)    dsimp only [pos] at h1 h2    have h3 := (B.equivFin ⟨X i,hh.1⟩).isLt    have hir : (finRotate k i).val=i.val+1 := by      cases k with      | zero => exact i.elim0      | succ k =>        obtain ⟨a,ha⟩ := i        exact congrArg Fin.val (finRotate_of_lt (by dsimp at *; omega : a < k))    omegatheorem even_linked_double_star_ordered_alternating_cycle {V : Type*} [DecidableEq V]    (G : SimpleGraph V) [DecidableRel G.Adj] (S B D : Finset V) (k m : ℕ) (hk : 2 ≤ k) (hm : 1 ≤ m)    (hS : S.card=k) (hdis : Disjoint S D) (hB : B ⊆ S) (hbad : 2*B.card ≤ k)    (hD : k+2*m-1 ≤ D.card)    (hmissing : ∀ x ∈ S, (D.filter (fun v => ¬G.Adj x v)).card ≤ m-1) :    ∃ X Y : Fin k ↪ V, Finset.univ.map X=S ∧ Finset.univ.map Y ⊆ D ∧      (∀ i, G.Adj (X i) (Y i) ∧ G.Adj (X (finRotate k i)) (Y i)) ∧      (∀ i, X i ∉ B ∨ X (finRotate k i) ∉ B) ∧      ∀ i, m ≤ ((D \ Finset.univ.map Y).filter (G.Adj (X i))).card := by  classical  obtain ⟨X,hX,hgood⟩ := ds1310_ordered_alternating_cycle_separate_bad S B k hS hB hbad  have hx (i) : X i ∈ S := hX ▸ Finset.mem_map.mpr ⟨i,Finset.mem_univ _,rfl⟩  let A (i) := D.filter (G.Adj (X i))  have hdeg (i) : D.card ≤ (A i).card+(m-1) := by    have h := Finset.card_filter_add_card_filter_not (s := D) (p := G.Adj (X i))    have hh := hmissing _ (hx i); dsimp [A]; omega  let Q (i) := A i ∩ A (finRotate k i)  have hQ (i : Fin k) : k ≤ (Q i).card := by    have hU : (A i ∪ A (finRotate k i)).card ≤ D.card := Finset.card_le_card      (Finset.union_subset (Finset.filter_subset _ _) (Finset.filter_subset _ _))    have he := Finset.card_inter_add_card_union (A i) (A (finRotate k i))    have h1 := hdeg i; have h2 := hdeg (finRotate k i); dsimp [Q]; omega  obtain ⟨Y,hY⟩ := ds1310_ordered_alternating_cycle_greedy Q (fun i => lt_of_lt_of_le i.isLt (hQ i))  refine ⟨X,Y,hX,?_,?_,hgood,?_⟩  · intro v hv    obtain ⟨i,_,rfl⟩ := Finset.mem_map.mp hv    exact (Finset.mem_filter.mp (Finset.mem_inter.mp (hY i)).1).1  · intro i    obtain ⟨ha,hb⟩ := Finset.mem_inter.mp (hY i)    exact ⟨(Finset.mem_filter.mp ha).2,(Finset.mem_filter.mp hb).2⟩  · intro i    have he : (D \ Finset.univ.map Y).filter (G.Adj (X i)) = A i \ Finset.univ.map Y := by      ext v; simp only [A,Finset.mem_filter,Finset.mem_sdiff]; tauto    rw [he]    have h1 := Finset.le_card_sdiff (Finset.univ.map Y) (A i)    have h2 := hdeg i    simp only [Finset.card_map, Finset.card_univ,Fintype.card_fin] at h1; omega
See it in the graphDiscuss this resultChallenge it