cyclic_dist
def
The cyclic distance between two vertices u and v of the n-cycle is the minimum of (u - v) mod n and (v - u) mod n.
Statement
def cyclic_dist (n : ℕ) (u v : Fin n) : ℕ- Defined in
- scout/2611-22830-independent-sets-in-the-2-token-graph-of-a-cycle-and-kings.md:159
- Verified
- 20 Nov 2026
- Axioms
- none listed
- Used by 2
- token_king_sharp_family_indepFor every natural number n divisible by 4 with 8 ≤ n, the candidate sharp family token_king_sharp_family n is an independent set in the…
- token_king_sharp_familyFor n : ℕ, token_king_sharp_family n is the finset of elements e in { s : Finset (Fin n) // s.card = 2 } for which there exist u, v : Fin…
Read back from the Lean
Defines cyclic_dist, which takes a natural number n and two elements u, v : Fin n, and returns the natural number min (u - v).val (n - (u - v).val), where u - v is subtraction in Fin n, .val is the natural number representative in {0, ..., n - 1}, and - in n - (u - v).val is natural number subtraction.
Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.
Lean source view module on GitHub
/-- Cyclic distance between two vertices in the cycle graph of order n. -/ def cyclic_dist (n : ℕ) (u v : Fin n) : ℕ := min (u - v).val (n - (u - v).val)