Answer:
a) P(B,A,B), P(x,y,z)
=> P(B,A,B) , P(B,A,B}
Hence, most general unifier = {x/B , y/A , z/B }.
b. P(x,x), Q(A,A)
No mgu exists for this expression as any substitution will not make P(x,x), Q(A, A) equal as one function is of P and the other is of Q.
c. Older(Father(y),y), Older(Father(x),John)
Thus , mgu ={ y/x , x/John }.
d) Q(G(y,z),G(z,y)), Q(G(x,x),G(A,B))
=> Q(G(x,x),G(x,x)), Q(G(x,x),G(A,B))
This is not unifiable as x cannot be bound for both A and B.
e) P(f(x), x, g(x)), P(f(y), A, z)
=> P(f(A), A, g(A)), P(f(A), A, g(A))
Thus , mgu = {x/y, z/y , y/A }.
Explanation:
Unification: Any substitution that makes two expressions equal is called a unifier.
a) P(B,A,B), P(x,y,z)
Use { x/B}
=> P(B,A,B) , P(B,y,z)
Now use {y/A}
=> P(B,A,B) , P(B,A,z)
Now, use {z/B}
=> P(B,A,B) , P(B,A,B}
Hence, most general unifier = {x/B , y/A , z/B }
b. P(x,x), Q(A,A)
No mgu exists for this expression as any substitution will not make P(x,x), Q(A, A) equal as one function is of P and the other is of Q
c. Older(Father(y),y), Older(Father(x),John)
Use {y/x}
=> Older(Father(x),x), Older(Father(x),John)
Now use { x/John }
=> Older(Father(John), John), Older(Father(John), John)
Thus , mgu ={ y/x , x/John }
d) Q(G(y,z),G(z,y)), Q(G(x,x),G(A,B))
Use { y/x }
=> Q(G(x,z),G(z,x)), Q(G(x,x),G(A,B))
Use {z/x}
=> Q(G(x,x),G(x,x)), Q(G(x,x),G(A,B))
This is not unifiable as x cannot be bound for both A and B
e) P(f(x), x, g(x)), P(f(y), A, z)
Use {x/y}
=> P(f(y), y, g(y)), P(f(y), A, z)
Now use {z/g(y)}
P(f(y), y, g(y)), P(f(y), A, g(y))
Now use {y/A}
=> P(f(A), A, g(A)), P(f(A), A, g(A))
Thus , mgu = {x/y, z/y , y/A }.