(** Effective computation of a list without duplicates *)
Fixpoint nodup (l : list A) : list A :=
match l with
| [] => []
| x::xs => if in_dec decA x xs then nodup xs else x::(nodup xs)
end.

(* Specifications: *)
Lemma nodup_fixed_point (l : list A) :
NoDup l -> nodup l = l.
Lemma nodup_In l x : In x (nodup l) <-> In x l.
Lemma nodup_incl l1 l2 : incl l1 (nodup l2) <-> incl l1 l2.
Lemma NoDup_nodup l: NoDup (nodup l).
Lemma nodup_inv k l a : nodup k = a :: l -> ~ In a l.
Theorem NoDup_count_occ l:
NoDup l <-> (forall x:A, count_occ decA l x <= 1).
Theorem NoDup_count_occ' l:
NoDup l <-> (forall x:A, In x l -> count_occ decA l x = 1).