AFTD Auto-Formalizing Theoretical Domains

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

Lean source view module on GitHub

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)
See it in the graphDiscuss this resultChallenge it