eliminates some wasted HashMap construction in variable substitution and unification