AFTD Auto-Formalizing Theoretical Domains

cyclic_rotate_left

def

Given a type α, a natural number k, and a word w : Fin k → α, cyclic_rotate_left k w is the function Fin k → α mapping each index j : Fin k to w evaluated at the index (j.val + 1) % k.

Statement

def cyclic_rotate_left {α : Type*} (k : ℕ) (w : Fin k → α) : Fin k → α
Defined in
folklore
Verified
01 Nov 2026
Axioms
none listed
Used by 7

Read back from the Lean

Given a type α, a natural number k, and a function w : Fin k → α, cyclic_rotate_left k w is the function Fin k → α sending each index j : Fin k to w evaluated at (j.val + 1) % k (as an element of Fin k).

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

/-- The 1-step cyclic left-shift of a length-k word w. -/
def cyclic_rotate_left {α : Type*} (k : ℕ) (w : Fin k → α) : Fin k → α := fun j => w ⟨(j.val + 1) % k, Nat.mod_lt _ (pos_of_gt j.isLt)⟩
See it in the graphDiscuss this resultChallenge it