Definition move_forward {A}(i j:nat)(l:list A)(d:A) : list A :=
  firstn i l ++ firstn j (skipn (S i) l) ++ (nth i l d :: skipn (S (i+j)) l).

(* Specifications: *)
Lemma move_forward_map A B d1 d2 i j (f:A->B) l : f d1 = d2 -> move_forward i j (map f l) d2 = map f (move_forward i j l d1).
Lemma length_move_forward : forall A i j (l:list A) d, i+j < length l -> length (move_forward i j l d) = length l.
Lemma in_move_forward_iff : forall A x i j d (l:list A), i < length l -> (In x (move_forward i j l d) <-> In x l).
Lemma firstn_simpl : forall A B (l : list A) (l2 : list B), length l2 = length l -> firstn (length l2) l = l.
Lemma firstn_app2 : forall (A : Type) (l l' : list A) n, length l = n -> firstn n (l ++ l') = l .
Lemma firstn_firstn : forall A n (l : list A), firstn n (firstn n l) = firstn n l.
Lemma In_firstn : forall A n a (l : list A), In a (firstn n l) -> In a l.