primrec
  "subst s (Var x) = s x"
  "subst s (App f ts) = App f (substs s ts)"
