type unification and substitution