In: Computer Science
Unify (if possible) the following pairs of predicates and give the resulting substitutions, assume b is a constant.
a. |
P(x, f(x), z) |
¬ P(g(y),f(g(b)),y) |
|
b. |
P(x, f(x)) |
¬ P(f(y), y) |
|
c. |
P(x, f(z)) |
¬ P(f(y), y) |
a) Here,1 = P(x,f(x),z) and 2 = P(g(y),f(g(b)),y)
Step 1: Check if the predicates match. Atoms with different predicate symbols cannot be unified.[here both the predicates match].
Step 2:To unify each pair of terms.
This substitution must be applied to both the clauses which give,
P(g(y),f(g(y)),z)
P(g(y),f(g(b)),y)
The substitution must be applied for both the clauses which give,
P(g(b),f(g(b)),z)
P(g(b),f(g(b)),y)
The substitution must be applied bor both the clauses which give,
P(g(b),f(g(b)),y)
P(g(b),f(g(b)),y)
Unified successfully
The substitutions are g(y)/x, b/y and z/y .
b) Here,1 = P(x,f(x)) and 2 = P(f(y),y)
The substitution must be applied bor both the clause which give,
P(f(y),f(f(y)))
P(f(y),y)
It is not possible to substitute f(f(y))/y.
Hence Unification failed.
c)Here,1 = P(x,f(z)) and 2 = P(f(y),y)
The substitution must be applied bor both the clause which give,
P(f(y),f(z))
P(f(y),y)
The substitution must be applied bor both the clause which give,
P(f(y),f(z))
P(f(y),f(z))
Hence Unified successfully.
The substitutions are f(y)/x and f(z)/y.