AFTD Auto-Formalizing Theoretical Domains

three_token_cycle_adj_sum_diff

theoremverified

For any natural number n ≥ 3 and any two adjacent vertices x and y in the 3-token graph of C_n, the difference in ZMod n between the sum of elements in x and the sum of elements in y is either 1 or -1.

Statement

theorem three_token_cycle_adj_sum_diff (n : ℕ) (hn : 3 ≤ n)
    (x y : { s : Finset (Fin n) // s.card = 3 })
    (h : (token_graph (SimpleGraph.cycleGraph n) 3).Adj x y) :
    let sx : ZMod n := x.val.sum (fun i => (i : ZMod n))
    let sy : ZMod n := y.val.sum (fun i => (i : ZMod n))
    sx - sy = 1 ∨ sy - sx = 1
Source
arXiv:2611.22830 Section 5; open problem OP-2010
Verified
22 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • token_graphThe k-token graph F_k(G) of a simple graph G has as vertices the k-subsets of V(G), with two k-subsets adjacent whenever their symmetric…
Used by 1
  • three_token_cycle_sum_fiber_indepFor any natural number n ≥ 3 and any subset S of ZMod n with no two elements differing by 1, the set of 3-element subsets of Fin n whose…

Read back from the Lean

For any natural number $n \ge 3$, and any two 3-element subsets $x$ and $y$ of Fin n (i.e., elements of { s : Finset (Fin n) // s.card = 3 }): if $x$ and $y$ are adjacent in the 3-token graph of SimpleGraph.cycleGraph n, then the sums of their elements modulo $n$, defined by $sx = \sum_{i \in x} (i : \text{ZMod } n)$ and $sy = \sum_{i \in y} (i : \text{ZMod } n)$, satisfy $sx - sy = 1$ or $sy - sx = 1$ in $\text{ZMod } n$.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

The proof, explained

Two adjacent 3-subsets x and y in the token graph of the cycle C_n differ by a single vertex replacement: their symmetric difference is a pair {u, v} where u and v are adjacent in C_n. By partitioning sums over x and y into their common intersection and their disjoint relative complements, the difference of their coordinate sums sx - sy in ZMod n reduces to the difference between u and v (or v and u). Since u and v are adjacent in C_n, their difference in ZMod n is 1 or -1, proving that sx - sy = 1 or sy - sx = 1.

  1. If the natural difference (u - v : Fin n) equals 1, then the difference u - v in ZMod n is 1.

    First, casting the equality (u - v : Fin n) = 1 to ZMod n gives that the cast of this difference is 1. Next, unfolding the definition of subtraction in Fin n as (n - v + u) % n and projecting into ZMod n eliminates the modulus via ZMod.natCast_mod; since the characteristic is n, the term n vanishes (CharP.cast_eq_zero), reducing the cast of the difference to -v + u = u - v. Equating these two evaluations shows u - v = 1 in ZMod n.

    lines 6–17

    uses Nat.cast_one, Fin.sub_def, ZMod.natCast_mod, le_of_lt, Nat.cast_sub, CharP.cast_eq_zero, zero_sub

      have h1 : (((u - v : Fin n) : ℕ) : ZMod n) = 1 := by
        rw [h, Nat.cast_one]
      have h2 : (((u - v : Fin n) : ℕ) : ZMod n) = (u : ZMod n) - (v : ZMod n) := by
        rw [Fin.sub_def]
        dsimp
        rw [ZMod.natCast_mod]
        push_cast
        have : (v.val ≤ n) := le_of_lt v.isLt
        rw [Nat.cast_sub this]
        simp only [CharP.cast_eq_zero, zero_sub]
        abel
      rw [← h2, h1]
  2. Adjacent vertices u and v in the cycle graph C_n satisfy u - v = 1 or v - u = 1 in ZMod n.

    By cycleGraph_adj', adjacency in the cycle graph C_n means that the natural difference in Fin n is 1 in one direction or the other: either (u - v : Fin n) = 1 or (v - u : Fin n) = 1. Applying the previous lemma to the appropriate case converts this to u - v = 1 or v - u = 1 in ZMod n.

    lines 22–25

    uses cycleGraph_adj', three_token_cycle_adj_sum_diff_fin_sub_to_zmod

      rw [cycleGraph_adj'] at h
      rcases h with h1 | h2
      · left; exact three_token_cycle_adj_sum_diff_fin_sub_to_zmod n u v h1
      · right; exact three_token_cycle_adj_sum_diff_fin_sub_to_zmod n v u h2
  3. For any finite sets s and t and any function f into an abelian group, the difference ∑_s f - ∑_t f equals ∑_{s \ t} f - ∑_{t \ s} f.

    Using sum_sdiff, the sum over s decomposes into the sum over s \ t plus the sum over s ∩ t, and similarly the sum over t decomposes into the sum over t \ s plus the sum over s ∩ t. Taking the difference of the two sums cancels the common summand over s ∩ t, leaving ∑_{s \ t} f - ∑_{t \ s} f.

    lines 30–37

    uses inter_comm, sdiff_inter_self_right, sum_sdiff, inter_subset_left, inter_subset_right

      have hs : s \ (s ∩ t) = s \ t := by rw [inter_comm, sdiff_inter_self_right]
      have ht : t \ (s ∩ t) = t \ s := sdiff_inter_self_right t s
      have h1 := sum_sdiff (s₁ := s ∩ t) (s₂ := s) inter_subset_left (f := f)
      have h2 := sum_sdiff (s₁ := s ∩ t) (s₂ := t) inter_subset_right (f := f)
      rw [hs] at h1
      rw [ht] at h2
      rw [← h1, ← h2]
      abel
  4. If |s| = |t| and the symmetric difference of s and t is a 2-element set {u, v} with u ≠ v, then |s \ t| = 1.

    The symmetric difference is the disjoint union (s \ t) ∪ (t \ s) = {u, v}, which has cardinality 2 because u ≠ v. Writing |s| = |s \ t| + |s ∩ t| and |t| = |t \ s| + |s ∩ t| shows that |s \ t| = |t \ s| since |s| = |t|. Because the union of these two disjoint equicardinal sets has size 2, linear arithmetic (omega) forces |s \ t| = 1.

    lines 43–58

    uses Finset.symmDiff_def, disjoint_sdiff_sdiff, card_pair, card_sdiff_add_card_inter, inter_comm, card_union_of_disjoint

      have h_symm : s \ t ∪ t \ s = {u, v} := by
        rw [← Finset.symmDiff_def, hdiff]
      have h_disj : Disjoint (s \ t) (t \ s) := disjoint_sdiff_sdiff
      have h_card_uv : ({u, v} : Finset α).card = 2 := card_pair hne
      have h_card_st : (s \ t).card = (t \ s).card := by
        have h1 : s.card = (s \ t).card + (s ∩ t).card := by
          rw [← card_sdiff_add_card_inter]
        have h2 : t.card = (t \ s).card + (t ∩ s).card := by
          rw [← card_sdiff_add_card_inter]
        rw [inter_comm] at h2
        omega
      have h_union_card : (s \ t ∪ t \ s).card = (s \ t).card + (t \ s).card :=
        card_union_of_disjoint h_disj
      have h_card_one : (s \ t).card = 1 := by
        rw [h_symm, h_card_uv] at h_union_card
        omega
  5. The set difference s \ t is a singleton {a} with a ∈ {u, v}, and t \ s consists of the elements of {u, v} not in s \ t.

    Since |s \ t| = 1, we obtain a witness a such that s \ t = {a}. Because {a} ⊆ (s \ t) ∪ (t \ s) = {u, v}, the element a must be in {u, v}, meaning a = u or a = v. Furthermore, since (s \ t) and (t \ s) partition {u, v}, any element x is in t \ s if and only if x ∈ {u, v} and x ∉ s \ t.

    lines 59–78

    uses mem_union, mem_singleton, Or.inl, mem_insert, Or.inr

      obtain ⟨a, ha⟩ := card_eq_one.mp h_card_one
      have ha_mem : a ∈ ({u, v} : Finset α) := by
        have : a ∈ s \ t ∪ t \ s := by
          rw [mem_union, ha, mem_singleton]
          exact Or.inl rfl
        rw [h_symm] at this
        exact this
      simp only [mem_insert, mem_singleton] at ha_mem
      have h_sub_union (x : α) : x ∈ t \ s ↔ x ∈ ({u, v} : Finset α) ∧ x ∉ s \ t := by
        have h_mem_u : x ∈ s \ t ∪ t \ s ↔ x ∈ ({u, v} : Finset α) := by rw [h_symm]
        rw [mem_union] at h_mem_u
        constructor
        · intro hx
          refine ⟨h_mem_u.mp (Or.inr hx), ?_⟩
          intro h_st
          exact (disjoint_left.mp h_disj h_st) hx
        · intro ⟨h_uv, h_not_st⟩
          rcases h_mem_u.mpr h_uv with h1 | h2
          · exact (h_not_st h1).elim
          · exact h2
  6. Either s \ t = {u} and t \ s = {v}, or s \ t = {v} and t \ s = {u}.

    We split into cases based on whether a = u or a = v. If a = u, then s \ t = {u}, and the previous characterization shows t \ s = {u, v} \ {u} = {v}. If a = v, then s \ t = {v} and similarly t \ s = {u}. The set equality in each case is completed by extensionality and propositional logic via aesop.

    lines 79–91

    uses mem_insert, mem_singleton

      rcases ha_mem with rfl | rfl
      · left
        refine ⟨ha, ?_⟩
        ext x
        rw [h_sub_union, ha]
        simp only [mem_insert, mem_singleton]
        aesop
      · right
        refine ⟨ha, ?_⟩
        ext x
        rw [h_sub_union, ha]
        simp only [mem_insert, mem_singleton]
        aesop
  7. In the token graph, the difference sx - sy of coordinate sums between adjacent 3-subsets x and y reduces to the difference between singletons {u} and {v}, where u and v differ by 1 in ZMod n.

    Adjacency of x and y in the 3-token graph provides adjacent vertices u, v in C_n such that symmDiff x y = {u, v}. Since both subsets have size 3 and u ≠ v, helper lemma three_token_cycle_adj_sum_diff_sdiff_cases_of_symmDiff_pair applies, showing {x \ y, y \ x} = {{u}, {v}}. Helper lemma three_token_cycle_adj_sum_diff_finset_sum_sub_sum rewrites sx - sy as the difference of sums over x \ y and y \ x, and helper lemma three_token_cycle_adj_sum_diff_cycle_adj_zmod establishes that u - v = 1 or v - u = 1 in ZMod n.

    lines 100–108

    uses three_token_cycle_adj_sum_diff_sdiff_cases_of_symmDiff_pair, three_token_cycle_adj_sum_diff_finset_sum_sub_sum, three_token_cycle_adj_sum_diff_cycle_adj_zmod

      intro sx sy
      obtain ⟨u, v, hadj, hdiff⟩ := h
      have hne : u ≠ v := hadj.ne
      have hcard : x.val.card = y.val.card := by rw [x.2, y.2]
      have hcases := three_token_cycle_adj_sum_diff_sdiff_cases_of_symmDiff_pair hcard hne hdiff
      have hsum : sx - sy = (x.val \ y.val).sum (fun i : Fin n => (i : ZMod n)) -
                            (y.val \ x.val).sum (fun i : Fin n => (i : ZMod n)) :=
        three_token_cycle_adj_sum_diff_finset_sum_sub_sum x.val y.val (fun i : Fin n => (i : ZMod n))
      have hadj_zmod := three_token_cycle_adj_sum_diff_cycle_adj_zmod n u v hadj
  8. The coordinate sum difference sx - sy in ZMod n satisfies sx - sy = 1 or sy - sx = 1.

    We analyze the two cases for the set differences. If x \ y = {u} and y \ x = {v}, then sx - sy = u - v; if u - v = 1 this yields sx - sy = 1, while if v - u = 1 we have sy - sx = -(sx - sy) = v - u = 1. If instead x \ y = {v} and y \ x = {u}, then sx - sy = v - u; if u - v = 1 this gives sy - sx = 1, and if v - u = 1 it gives sx - sy = 1. In all cases, the coordinate sums differ by 1 in ZMod n.

    lines 109–121

    uses sum_singleton, neg_sub

      rcases hcases with ⟨hxy, hyx⟩ | ⟨hxy, hyx⟩
      · rw [hxy, hyx, sum_singleton, sum_singleton] at hsum
        rcases hadj_zmod with h1 | h2
        · left; rw [hsum, h1]
        · right
          have : sy - sx = -(sx - sy) := (neg_sub sx sy).symm
          rw [this, hsum, neg_sub, h2]
      · rw [hxy, hyx, sum_singleton, sum_singleton] at hsum
        rcases hadj_zmod with h1 | h2
        · right
          have : sy - sx = -(sx - sy) := (neg_sub sx sy).symm
          rw [this, hsum, neg_sub, h1]
        · left; rw [hsum, h2]
Nat.cast_one
The cast of 1 into any ring or additive monoid with one equals 1.
Fin.sub_def
Subtraction of elements a, b in Fin n is defined by (n - b + a) % n.
ZMod.natCast_mod
In ZMod n, casting a natural number modulo n equals casting the number itself.
le_of_lt
A strict inequality a < b implies a non-strict inequality a ≤ b.
Nat.cast_sub
The cast of a difference of natural numbers m - k with k ≤ m equals the difference of their casts.
CharP.cast_eq_zero
In a ring of characteristic p, the cast of p equals 0.
zero_sub
Subtracting an element from zero yields its negation (0 - a = -a).
cycleGraph_adj'
Two vertices u and v are adjacent in the cycle graph of order n if and only if their difference in Fin n is 1 in one direction or the other.
three_token_cycle_adj_sum_diff_fin_sub_to_zmod
If the difference u - v in Fin n equals 1, then the difference of their casts in ZMod n equals 1.
inter_comm
Intersection of finite sets is commutative (s₁ ∩ s₂ = s₂ ∩ s₁).
sdiff_inter_self_right
Removing the intersection t ∩ s from s is the same as removing t from s.
sum_sdiff
If s₁ ⊆ s₂, the sum of f over s₂ splits into the sum over s₂ \ s₁ plus the sum over s₁.
inter_subset_left
The intersection s₁ ∩ s₂ is a subset of s₁.
inter_subset_right
The intersection s₁ ∩ s₂ is a subset of s₂.
Finset.symmDiff_def
The symmetric difference of two sets is the union of their set differences (s \ t) ∪ (t \ s).
disjoint_sdiff_sdiff
The set differences x \ y and y \ x are disjoint.
card_pair
A set of two distinct elements {a, b} with a ≠ b has cardinality 2.
card_sdiff_add_card_inter
The cardinality of s equals the cardinality of s \ t plus the cardinality of s ∩ t.
card_union_of_disjoint
The cardinality of the union of two disjoint finite sets is the sum of their cardinalities.
mem_union
An element belongs to the union s ∪ t if and only if it belongs to s or to t.
mem_singleton
An element belongs to the singleton {a} if and only if it equals a.
mem_insert
An element belongs to insert a s if and only if it equals a or belongs to s.
Or.inl
Infers the disjunction a ∨ b from a proof of a.
Or.inr
Infers the disjunction a ∨ b from a proof of b.
three_token_cycle_adj_sum_diff_sdiff_cases_of_symmDiff_pair
If two finite sets of equal size have symmetric difference {u, v} with u ≠ v, their relative complements are {u} and {v} in one order or the other.
three_token_cycle_adj_sum_diff_finset_sum_sub_sum
The difference of sums over two sets equals the difference of sums over their set differences.
three_token_cycle_adj_sum_diff_cycle_adj_zmod
Adjacent vertices u and v in the cycle graph C_n satisfy u - v = 1 or v - u = 1 in ZMod n.
sum_singleton
The sum of a function over a singleton set {a} equals the function value at a.
neg_sub
The negation of a difference a - b equals b - a.

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 Finsetprivate theorem three_token_cycle_adj_sum_diff_fin_sub_to_zmod (n : ℕ) (u v : Fin n)    (h : ((u - v : Fin n) : ℕ) = 1) :    (u : ZMod n) - (v : ZMod n) = 1 := by  have h1 : (((u - v : Fin n) : ℕ) : ZMod n) = 1 := by    rw [h, Nat.cast_one]  have h2 : (((u - v : Fin n) : ℕ) : ZMod n) = (u : ZMod n) - (v : ZMod n) := by    rw [Fin.sub_def]    dsimp    rw [ZMod.natCast_mod]    push_cast    have : (v.val ≤ n) := le_of_lt v.isLt    rw [Nat.cast_sub this]    simp only [CharP.cast_eq_zero, zero_sub]    abel  rw [← h2, h1]private theorem three_token_cycle_adj_sum_diff_cycle_adj_zmod (n : ℕ) (u v : Fin n)    (h : (cycleGraph n).Adj u v) :    (u : ZMod n) - (v : ZMod n) = 1 ∨ (v : ZMod n) - (u : ZMod n) = 1 := by  rw [cycleGraph_adj'] at h  rcases h with h1 | h2  · left; exact three_token_cycle_adj_sum_diff_fin_sub_to_zmod n u v h1  · right; exact three_token_cycle_adj_sum_diff_fin_sub_to_zmod n v u h2private theorem three_token_cycle_adj_sum_diff_finset_sum_sub_sum {α β : Type*} [DecidableEq α] [AddCommGroup β]    (s t : Finset α) (f : α → β) :    s.sum f - t.sum f = (s \ t).sum f - (t \ s).sum f := by  have hs : s \ (s ∩ t) = s \ t := by rw [inter_comm, sdiff_inter_self_right]  have ht : t \ (s ∩ t) = t \ s := sdiff_inter_self_right t s  have h1 := sum_sdiff (s₁ := s ∩ t) (s₂ := s) inter_subset_left (f := f)  have h2 := sum_sdiff (s₁ := s ∩ t) (s₂ := t) inter_subset_right (f := f)  rw [hs] at h1  rw [ht] at h2  rw [← h1, ← h2]  abelprivate theorem three_token_cycle_adj_sum_diff_sdiff_cases_of_symmDiff_pair    {α : Type*} [DecidableEq α] {s t : Finset α}    (hcard : s.card = t.card) {u v : α} (hne : u ≠ v) (hdiff : symmDiff s t = {u, v}) :    (s \ t = {u} ∧ t \ s = {v}) ∨ (s \ t = {v} ∧ t \ s = {u}) := by  have h_symm : s \ t ∪ t \ s = {u, v} := by    rw [← Finset.symmDiff_def, hdiff]  have h_disj : Disjoint (s \ t) (t \ s) := disjoint_sdiff_sdiff  have h_card_uv : ({u, v} : Finset α).card = 2 := card_pair hne  have h_card_st : (s \ t).card = (t \ s).card := by    have h1 : s.card = (s \ t).card + (s ∩ t).card := by      rw [← card_sdiff_add_card_inter]    have h2 : t.card = (t \ s).card + (t ∩ s).card := by      rw [← card_sdiff_add_card_inter]    rw [inter_comm] at h2    omega  have h_union_card : (s \ t ∪ t \ s).card = (s \ t).card + (t \ s).card :=    card_union_of_disjoint h_disj  have h_card_one : (s \ t).card = 1 := by    rw [h_symm, h_card_uv] at h_union_card    omega  obtain ⟨a, ha⟩ := card_eq_one.mp h_card_one  have ha_mem : a ∈ ({u, v} : Finset α) := by    have : a ∈ s \ t ∪ t \ s := by      rw [mem_union, ha, mem_singleton]      exact Or.inl rfl    rw [h_symm] at this    exact this  simp only [mem_insert, mem_singleton] at ha_mem  have h_sub_union (x : α) : x ∈ t \ s ↔ x ∈ ({u, v} : Finset α) ∧ x ∉ s \ t := by    have h_mem_u : x ∈ s \ t ∪ t \ s ↔ x ∈ ({u, v} : Finset α) := by rw [h_symm]    rw [mem_union] at h_mem_u    constructor    · intro hx      refine ⟨h_mem_u.mp (Or.inr hx), ?_⟩      intro h_st      exact (disjoint_left.mp h_disj h_st) hx    · intro ⟨h_uv, h_not_st⟩      rcases h_mem_u.mpr h_uv with h1 | h2      · exact (h_not_st h1).elim      · exact h2  rcases ha_mem with rfl | rfl  · left    refine ⟨ha, ?_⟩    ext x    rw [h_sub_union, ha]    simp only [mem_insert, mem_singleton]    aesop  · right    refine ⟨ha, ?_⟩    ext x    rw [h_sub_union, ha]    simp only [mem_insert, mem_singleton]    aesop/-- Adjacent 3-subsets in the token graph of C_n have coordinate sums in ZMod n differing by 1. -/theorem three_token_cycle_adj_sum_diff (n : ℕ) (hn : 3 ≤ n)    (x y : { s : Finset (Fin n) // s.card = 3 })    (h : (token_graph (SimpleGraph.cycleGraph n) 3).Adj x y) :    let sx : ZMod n := x.val.sum (fun i => (i : ZMod n))    let sy : ZMod n := y.val.sum (fun i => (i : ZMod n))    sx - sy = 1 ∨ sy - sx = 1 := by  intro sx sy  obtain ⟨u, v, hadj, hdiff⟩ := h  have hne : u ≠ v := hadj.ne  have hcard : x.val.card = y.val.card := by rw [x.2, y.2]  have hcases := three_token_cycle_adj_sum_diff_sdiff_cases_of_symmDiff_pair hcard hne hdiff  have hsum : sx - sy = (x.val \ y.val).sum (fun i : Fin n => (i : ZMod n)) -                        (y.val \ x.val).sum (fun i : Fin n => (i : ZMod n)) :=    three_token_cycle_adj_sum_diff_finset_sum_sub_sum x.val y.val (fun i : Fin n => (i : ZMod n))  have hadj_zmod := three_token_cycle_adj_sum_diff_cycle_adj_zmod n u v hadj  rcases hcases with ⟨hxy, hyx⟩ | ⟨hxy, hyx⟩  · rw [hxy, hyx, sum_singleton, sum_singleton] at hsum    rcases hadj_zmod with h1 | h2    · left; rw [hsum, h1]    · right      have : sy - sx = -(sx - sy) := (neg_sub sx sy).symm      rw [this, hsum, neg_sub, h2]  · rw [hxy, hyx, sum_singleton, sum_singleton] at hsum    rcases hadj_zmod with h1 | h2    · right      have : sy - sx = -(sx - sy) := (neg_sub sx sy).symm      rw [this, hsum, neg_sub, h1]    · left; rw [hsum, h2]
See it in the graphDiscuss this resultChallenge it