Definition rotate {A} (l : list A) n m := sublist (m - n) (Zlength l) l ++
  sublist 0 (m - n) l.

Lemma Znth_cons_eq : forall {A}{d : Inhabitant A} i x l, Znth i (x :: l) = if eq_dec i 0 then x else Znth (i - 1) l.