Finding an MGU (Cont.)
When trying to add t/v to S, apply { t/v } to each term in S. If this results in any elementary substitution whose term includes its variable, return NOT-UNIFIABLE. Otherwise, replace each elementary substitution in S by the result of applying { t/v } and add t/v itself to S.