fact: Fixpoint subst_rec (n:nat) (t:n_exp) (u :n_exp) (x:atom) : n_exp := match n with | 0 => t | S m => match t with | n_var y => if (x == y) then u else t | n_abs y t1 => if (x == y) then t else let (z,_) := atom_fresh (fv_nom u \u fv_nom t) in n_abs z (subst_rec m (swap y z t1) u x) | n_app t1 t2 => n_app (subst_rec m t1 u x) (subst_rec m t2 u x) end end.
imports: Lia Metalib.Metatheory Metalib.LibLNgen