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.

(** Misc tl/hd_error facts *)
Lemma in_tail : forall (xs : list A) x,
In x (tl xs) -> In x xs.