Section ListFacts.
Context {A : Type}.
Variable Aeq : forall (x y : A), {x = y} + {x <> y}.
(** common_prefix *)
Fixpoint common_prefix (xs ys : list A) : list A :=
match xs, ys with
| x :: xs', y :: ys' =>
if Aeq x y then x :: common_prefix xs' ys' else nil
| _, _ => nil
end.
Definition strip_common_prefix (xs ys : list A) : list A :=
let longer := if length xs <=? length ys then ys else xs in
skipn (length (common_prefix xs ys)) longer.

Lemma skipn_tl : forall n (xs : list A),
skipn (S n) xs = tl (skipn n xs).