Corollary rebase_upd' : forall {A} (m : list A) i j x, 0 <= i < Zlength m -> 0 <= j < Zlength m ->
  rebase (upd_Znth ((i + j) mod Zlength m) m x) j = upd_Znth i (rebase m j) x.

(* Specifications: *)
Lemma lookup_set : forall m k v m', set m k v = Some m' -> Zlength m = size -> lookup m' k = lookup m k.
Lemma lookup_range : forall m k i, lookup m k = Some i -> Zlength m = size -> 0 <= i < Zlength m.
Lemma index_of'_upd2 : forall m k i k' v' (Hrange : 0 <= i < Zlength m) (Hi : index_of' m k <> Some i) (Hdiff : k' <> k /\ k' <> 0), index_of' (upd_Znth i m (k', v')) k = index_of' m k.
Lemma lookup_upd_same : forall m k i v', lookup m k = Some i -> Zlength m = size -> 0 <= i < Zlength m -> lookup (upd_Znth i m (k, v')) k = lookup m k.
Lemma lookup_upd_diff : forall m k i k' v', lookup m k <> Some i -> Zlength m = size -> 0 <= i < Zlength m -> k' <> k /\ k' <> 0 -> lookup (upd_Znth i m (k', v')) k = lookup m k.
Lemma Zlength_set : forall m k v m', set m k v = Some m' -> Zlength m = size -> Zlength m' = size.
Lemma get_set_same : forall m k v m', set m k v = Some m' -> Zlength m = size -> k <> 0 -> get m' k = Some v.
Lemma get_override : forall m k v m' v', set m k v = Some m' -> Zlength m = size -> set m' k v' = set m k v'.
Lemma index_of_app : forall k m1 m2, index_of (m1 ++ m2) k = match index_of m1 k with Some i => Some i | None => option_map (Z.add (Zlength m1)) (index_of m2 k) end.
Lemma index_of_out : forall k m, Forall (fun x => fst x <> k) m -> index_of m k = None.
Lemma index_of_sublist : forall m a b i k (HNoDup : NoDup (map fst m)) (Hi : index_of (sublist a b m) k = Some i) (Ha : 0 <= a) (Hb : b <= Zlength m), index_of m k = Some (i + a).
Lemma index_of_rotate : forall m n k, 0 <= n <= Zlength m -> NoDup (map fst m) -> index_of (rotate m n (Zlength m)) k = option_map (fun i => (i + n) mod Zlength m) (index_of m k).