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.

Lemma dedup_not_in_cons : forall x xs, (~ In x xs) -> x :: dedup xs = dedup (x :: xs).