Have a quick question regarding m.g.u (most general unifier) in prolog.
We are asked what the m.g.u is of:
f(X, g(Y, h(Z))) = f(Z, g(P, h(a))).
With 2 possible answers
1. θ = {X/Z,Y/P,Z/a}.
2. θ = {X/a,Y/P,Z/a}.
I argued that the second answer was the most general unifier, however, it appears that the first answer is correct.
I have tried both substitutions and they both yield the same result, however the second answer was with fewer substitutions which is why I argued that it was the m.g.u
Any help would be appreciated, thanks!
+-----------X
|
| +-----Y
| |
f--+--g--+
|
+--h--Z
+-----------Z
|
| +-----P
| |
f--+--g--+
|
+--h--a