cyclic_offset_eq_ite
theoremverified
For i, j in {0, ..., n-1}, the cyclic offset (j - i) mod n equals j - i when i <= j and j + n - i otherwise.
Statement
theorem cyclic_offset_eq_ite {n : ℕ} (i j : Fin n) : cyclic_offset i j = if (i : ℕ) ≤ j then (j : ℕ) - i else (j : ℕ) + n - i
- Source
- step towards hollow_shell_blocking_pairs_ncard_le (Shield-Core upper bound, A Quadratic Lower Bound for the Shield Number of the Stable Marriage Problem (2026), arXiv:2609.17418, Sec. 7.1)
- Verified
- 06 Oct 2026
- Axioms
Quot.soundpropext- Built on 1
- cyclic_offsetFor i, j in {0, ..., n-1}, the forward cyclic offset from i to j is (j - i) mod n, a number in {0, ..., n-1}.
- Used by 1
- hollow_shell_blocking_pairs_ncard_leThe upper half of the Shield-Core conjecture (arXiv:2609.17418, open): in the cyclic Hollow-Shell market C_n, every complete matching has…
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
theorem cyclic_offset_eq_ite {n : ℕ} (i j : Fin n) : cyclic_offset i j = if (i : ℕ) ≤ j then (j : ℕ) - i else (j : ℕ) + n - i := by unfold cyclic_offset have hi := i.isLt have hj := j.isLt split_ifs with h · have e : (j : ℕ) + n - i = ((j : ℕ) - i) + n := by omega rw [e, Nat.add_mod_right, Nat.mod_eq_of_lt (by omega)] · exact Nat.mod_eq_of_lt (by omega)