(** Compatibility with other operations *)

(* Specifications: *)
Lemma length_nil : length (@nil A) = 0.
Lemma length_cons : forall (l : list A) a, length (a :: l) = S (length l).
Lemma length_app : forall l l' : list A, length (l++l') = length l + length l'.
Lemma last_length : forall (l : list A) a, length (l ++ [a]) = S (length l).
Lemma app_inv_head_iff:
forall l l1 l2 : list A, l ++ l1 = l ++ l2 <-> l1 = l2.
Lemma app_inv_head:
forall l l1 l2 : list A, l ++ l1 = l ++ l2 -> l1 = l2.
Lemma app_inv_tail:
forall l l1 l2 : list A, l1 ++ l = l2 ++ l -> l1 = l2.
Lemma app_inv_tail_iff:
forall l l1 l2 : list A, l1 ++ l = l2 ++ l <-> l1 = l2.
Lemma in_rev : forall l x, In x l <-> In x (rev l).
Lemma length_rev : forall l, length (rev l) = length l.
Lemma rev_nth : forall l d n, n < length l ->
nth n (rev l) d = nth (length l - S n) l d.
Lemma nth_error_rev n l : nth_error (rev l) n =
if Nat.ltb n (length l) then nth_error l (length l - S n) else None.