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_app : forall (xs ys : list A), (forall x y, In x xs -> In y ys -> x <> y) -> dedup (xs ++ ys) = dedup xs ++ dedup ys.