intros.
change (tail (a1 :: l1) = tail (a2 :: l2)) in |- *.
apply (f_equal (A:=list A)).
exact H.
Qed.
Hint Immediate eq_cons.
(* Lemma eq_cons2 : (l1,l2:(list A))(a1,a2:A) (cons a1 l1)=(cons a2 l2) -> a1=a2. *)

Lemma not_eq_cons :
forall (l1 l2 : list A) (a1 a2 : A), l1 <> l2 -> a1 :: l1 <> a2 :: l2.