Section UniqueKey.
Variables (A : Type) (B : Type).
(* An association list has unique keys if the keys appear only once *)
Inductive unique_key : list (A * B) -> Prop :=
| unique_key_nil : unique_key nil
| unique_key_cons :
forall (a : A) (b : B) l,
(forall b : B, ~ In (a, b) l) ->
unique_key l -> unique_key ((a, b) :: l).
Hint Constructors unique_key : core.
Proof using.
intros a l H; inversion H; auto.
Qed.
Proof using.
intros a b1 b2 l H; inversion H; auto.
Qed.

(* Inversion theorem *)
Theorem unique_key_in_inv :
forall a l1 l2 l, unique_key l -> In (a, l1) l -> In (a, l2) l -> l1 = l2.