Finding an MGU (Cont.)
4a. If t1 = t2, go to Step 3.
4b. Otherwise, if either t1 or t2 is a variable (call it v and call the other term t), then attempt to add t/v to S (see below).
4c. Otherwise if t1 and t2 both begin with function symbols, and these symbols are the same, move the cursors to the first argument of these symbols and go to step 4a.
4d. Otherwise, return NOT-UNIFIABLE.