Proof using.
intros l; elim l; simpl in |- *; auto.
intros a; case a.
intros a0 b l0 H H0; apply unique_key_cons; auto.
intros b0; red in |- *; intros H1; absurd (In a0 (map (fst (B:=_)) l0)); auto.
inversion H0; auto.
change (In (fst (a0, b0)) (map (fst (B:=_)) l0)) in |- *; auto with datatypes.
apply in_map; auto.
apply H; apply ulist_inv with (1 := H0); auto.
Qed.
End UniqueKey.
Hint Constructors unique_key : core.
Arguments unique_key [A B].

(* Uniqueness is compatible with map for injective functions *)
Theorem unique_key_map :
forall (A B C D : Type) l (f : A * B -> C * D),
unique_key l ->
(forall a b, fst (f a) = fst (f b) -> fst a = fst b) -> unique_key (map f l).