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.

Lemma NoDup_nth l d : NoDup l <-> (forall i j, i<length l -> j<length l -> nth i l d = nth j l d -> i = j).