Notation firstn := firstn.Notation skipn := skipn.

(* Specifications: *)
Lemma firstn_nil n: firstn n [] = [].
Lemma firstn_cons n a l: firstn (S n) (a::l) = a :: (firstn n l).
Lemma nth_error_firstn n l i : nth_error (firstn n l) i = if Nat.ltb i n then nth_error l i else None.
Lemma nth_firstn (n : nat) (l : list A) (i : nat) (d : A) : nth i (firstn n l) d = if i <? n then nth i l d else d.
Lemma firstn_all l: firstn (length l) l = l.
Lemma firstn_all2 n: forall (l:list A), (length l) <= n -> firstn n l = l.
Lemma firstn_0 l: firstn 0 l = [].
Lemma firstn_le_length n: forall l:list A, length (firstn n l) <= n.
Lemma firstn_length_le: forall l:list A, forall n:nat, n <= length l -> length (firstn n l) = n.
Lemma firstn_app n: forall l1 l2, firstn n (l1 ++ l2) = (firstn n l1) ++ (firstn (n - length l1) l2).
Lemma firstn_app_2 n: forall l1 l2, firstn ((length l1) + n) (l1 ++ l2) = l1 ++ firstn n l2.
Lemma firstn_firstn: forall l:list A, forall i j : nat, firstn i (firstn j l) = firstn (min i j) l.
Lemma nth_error_skipn n l i : nth_error (skipn n l) i = nth_error l (n + i).
Lemma nth_skipn n l i d : nth i (skipn n l) d = nth (n + i) l d.
Lemma hd_error_skipn n l : hd_error (skipn n l) = nth_error l n.
Lemma firstn_skipn_comm : forall m n l, firstn m (skipn n l) = skipn n (firstn (n + m) l).
Lemma skipn_firstn_comm : forall m n l, skipn m (firstn n l) = firstn (n - m) (skipn m l).
Lemma skipn_0 : forall l, skipn 0 l = l.
Lemma skipn_nil : forall n, skipn n ([] : list A) = [].
Lemma skipn_cons n a l: skipn (S n) (a::l) = skipn n l.
Lemma skipn_all : forall l, skipn (length l) l = [].
Lemma skipn_all2 n: forall l, length l <= n -> skipn n l = [].
Lemma skipn_all_iff n l : length l <= n <-> skipn n l = [].
Lemma skipn_skipn : forall x y l, skipn x (skipn y l) = skipn (x + y) l.
Lemma firstn_skipn : forall n l, firstn n l ++ skipn n l = l.
Lemma firstn_skipn_middle n l x : nth_error l n = Some x -> firstn n l ++ x :: skipn (S n) l = l.
Lemma length_firstn : forall n l, length (firstn n l) = min n (length l).
Lemma length_skipn n : forall l, length (skipn n l) = length l - n.
Lemma skipn_app n : forall l1 l2, skipn n (l1 ++ l2) = (skipn n l1) ++ (skipn (n - length l1) l2).
Lemma firstn_skipn_rev: forall x l, firstn x l = rev (skipn (length l - x) (rev l)).
Lemma firstn_rev: forall x l, firstn x (rev l) = rev (skipn (length l - x) l).
Lemma skipn_rev: forall x l, skipn x (rev l) = rev (firstn (length l - x) l).
Lemma removelast_firstn : forall n l, n < length l -> removelast (firstn (S n) l) = firstn n l.
Lemma removelast_firstn_len : forall l, removelast l = firstn (pred (length l)) l.
Lemma firstn_removelast : forall n l, n < length l -> firstn n (removelast l) = firstn n l.
Lemma firstn_map : forall n l, firstn n (map f l) = map f (firstn n l).
Lemma skipn_map : forall n l, skipn n (map f l) = map f (skipn n l).
Lemma combine_nil : forall (l : list A), combine l (@nil B) = @nil (A*B).
Lemma combine_firstn_l : forall (l : list A) (l' : list B), combine l l' = combine l (firstn (length l) l').
Lemma combine_firstn_r : forall (l : list A) (l' : list B), combine l l' = combine (firstn (length l') l) l'.
Lemma combine_firstn : forall (l : list A) (l' : list B) (n : nat), firstn n (combine l l') = combine (firstn n l) (firstn n l').