Introduction to
Logic Programming
What
versus
How
 

Exercise 8.2 - Unification


For each of the following pairs of expressions, say which substitution, if any, is a most general unifier.

(a)p(X,X) and p(a,Y) 
  {X←a} 
  {Y←a} 
  {X←a, Y←a} 
  Not unifiable 
 
(b)p(X,X) and p(f(Y),Z) 
  {X←f(a), Y←a, z←f(a)} 
  {X←f(Y), z←f(Y)} 
  {X←f(Y)} 
  Not unifiable 
 
(c)p(X,X) and p(f(Y),Y) 
  {X←f(a), Y←a} 
  {X←f(Y), Y←f(Y)} 
  {X←f(Y)} 
  Not unifiable 
 
(d)p(f(X,Y),g(Z,Z)) and p(f(f(W,Z),V),W) 
  {X←W, Y←Z, W←g(Z,Z)} 
  {X←f(f(W,Z),V), Y←V, W←g(Z,Z)} 
  {X←f(g(Z,Z),Z), Y←V, W←g(Z,Z)} 
  Not unifiable