Definition no_dup (l : list A) : list A :=
  list_rec (fun _ => list A) nil
    (fun (a : A) _ (rec : list A) =>
     match In_dec Aeq_dec a rec with
     | left _ => rec
     | right _ => a :: rec
     end) l.

(* Specifications: *)
Lemma no_dup1 : forall (a : A) (l : list A), In a l -> In a (no_dup l).
Lemma no_dup2 : forall (a : A) (l : list A), In a (no_dup l) -> In a l.
Lemma no_dup3 : forall (k l : list A) (a : A), no_dup k = a :: l -> ~ In a l.