Set Implicit Arguments.
Section dedup.
Variable A : Type.
Hypothesis A_eq_dec : forall x y : A, {x = y} + {x <> y}.
Fixpoint dedup (xs : list A) : list A :=
match xs with
| [] => []
| x :: xs => let tail := dedup xs in
if in_dec A_eq_dec x xs then
tail
else
x :: tail
end.

(* Specifications: *)
Lemma dedup_eliminates_duplicates : forall a l l',
dedup (a :: l ++ a :: l') = dedup (l ++ a :: l').