Definition one (C : Set) (item : C) : list C := cons item nil.Inductive asn (A:Set) (B:Set) : Set :=
      | VarAsn : atom -> A -> asn A B
      | AltAsn : B         -> asn A B
    .Inductive asn (A:Set) (B:Set) : Set :=
      | VarAsn : atom -> A -> asn A B
      | AltAsn : B         -> asn A B
    .Inductive asn (A:Set) (B:Set) : Set :=
      | VarAsn : atom -> A -> asn A B
      | AltAsn : B         -> asn A B
    .Definition map (f1 : A -> A) (f2: B -> B) (E : list (asn A B)) : list (asn A B) :=
      List.map (fun x => match x with
                         | VarAsn _ x a => VarAsn B x (f1 a)
                         | AltAsn _ b   => AltAsn A (f2 b)
                         end) E.Fixpoint dom (A: Set) (B: Set) (E : list (asn A B)) {struct E} : atoms :=
      match E with
        | nil => empty
        | (VarAsn _ x _) :: E' => add x (dom E')
        | _ :: E' => dom E'
      end.Definition disjoint (E : list (asn A B)) (F : list (asn A B)) : Prop :=
      Subset (inter (dom E) (dom F)) empty.Definition binds (x : atom) (a : A) (E : list (asn A B)) : Prop :=
      List.In (VarAsn  B x a) E.Definition bindsAlt (b : B) (E : list (asn A B)) : Prop :=
      List.In (AltAsn A b) E.Local Notation "x ~~ a" := (one (VarAsn B x a)) (at level 68).Local Notation "x `notin` E" :=
    (~ In x E)
    (at level 70).Fixpoint erase (E : list (asn A B)) : list B :=
      match E with
      | nil => nil
      | (AltAsn _ b) :: E => b :: erase E
      | (VarAsn _ x a) :: E => erase E
      end.(* ********************************************************************* *)
  (** ** Local notations *)

  (** We make a local notation for [one], and for operations and
      predicate on finite sets, in order to make the statements of the
      lemmas below more readable.  The notations are local so that
      users of this functor may choose their own notations. *)

  Local Notation "[ i ]" := (one i).(*  Local Notation "x ~~ T" := (one (VarAsn B x T)) (at level 68). *)

  Local Notation "E `union` F" :=
    (union E F)
    (at level 65, right associativity).Local Notation "x `in` E" :=
    (In x E)
    (at level 70).Local Notation "E [=] F" :=
    (Equal E F)
    (at level 70, no associativity).Local Notation "E [<=] F" :=
    (Subset E F)
    (at level 70, no associativity).

Lemma one_eq_app : [ x ] ++ l1 = l2 ++ l3 -> (exists qs, l2 = x :: qs /\ l1 = qs ++ l3) \/ (l2 = nil /\ l3 = x :: l1).