(***********************************************************************)
(** * Connecting "freshening" *)
(***********************************************************************)
(** The abstract machine uses the nominal [swap] operation to make sure that the variables in abstractions are "fresh".  To be able prove that this machine implements the step relation for LN terms, we need to connect this operation to a LN version of "freshening".  The [swap_spec] lemma below states that connection. If a variable [y] is "fresh", then substituting with it (in the LN representation) is the same as swapping with it (in the nominal representation).  << Lemma swap_spec : forall  n w y, y `notin` fv_exp (nom_to_exp n) -> w <> y -> [w ~> var_f y] (nom_to_exp n) = nom_to_exp (swap w y n). >>  *)
(** *** Exercise [close_exp_wrt_exp_freshen] *)

Lemma swap_spec : forall t w y,
y `notin` fv_exp (nom_to_exp t) ->
w <> y ->
[w ~> var_f y] (nom_to_exp t) =
nom_to_exp (swap w y t).