Set Implicit Arguments.
Set Strict Implicit.
Section parametric.
Variable T : Type.

(* Specifications: *)
Lemma nth_error_app_L : forall (A B : list T) n,
n < length A ->
nth_error (A ++ B) n = nth_error A n.
Lemma nth_error_app_R : forall (A B : list T) n,
length A <= n ->
nth_error (A ++ B) n = nth_error B (n - length A).
Lemma nth_error_weaken : forall ls' (ls : list T) n v,
nth_error ls n = Some v ->
nth_error (ls ++ ls') n = Some v.
Lemma nth_error_nil : forall n,
nth_error nil n = @None T.
Lemma nth_error_past_end : forall (ls : list T) n,
length ls <= n ->
nth_error ls n = None.
Lemma nth_error_length : forall (ls ls' : list T) n,
nth_error (ls ++ ls') (n + length ls) = nth_error ls' n.
Theorem nth_error_length_ge : forall T (ls : list T) n,
nth_error ls n = None -> length ls <= n.
Lemma nth_error_length_lt : forall {T} (ls : list T) n val,
nth_error ls n = Some val -> n < length ls.
Theorem nth_error_map : forall U (f : T -> U) ls n,
nth_error (map f ls) n = match nth_error ls n with
| None => None
| Some x => Some (f x)
end.