(** ** Challenge Exercise [subst]  Use the definitions above to prove the following results about the nominal substitution function.  *)

Lemma subst_abs : forall u x y t1,
subst u x (n_abs y t1) =
if (x == y) then (n_abs y t1)
else let (z,_) := atom_fresh (fv_nom u \u fv_nom (n_abs y t1)) in
n_abs z (subst u x (swap y z t1)).