(***********************************************************************)
(** ** Connection for alpha-equivalence                                 *)
(***********************************************************************)
(** *** Challenge Exercise: [aeq_nom_to_exp]  Show that alpha-equivalence for the nominal representation is definitional equality for LN terms.  This result is not necessary for the simulation lemmas below, but it is another example of the a proof that takes advantage of the [swap_spec] and [close_exp_wrt_exp_freshen] lemmas  above.  The second proof is much more challenging than the first and requires lemmas from [Lemmas.v].  *)

Lemma nom_to_exp_eq_aeq : forall n1 n2, nom_to_exp n1 = nom_to_exp n2 -> aeq n1 n2.
Inductive scoped_heap (D : atoms) : heap -> Prop :=
| scoped_nil  : scoped_heap D nil
| scoped_cons : forall x e h,
x `notin` dom h \u D ->
fv_exp (nom_to_exp e) [<=] dom h \u D ->
scoped_heap D h ->
scoped_heap D ((x,e)::h).