Sie sind auf Seite 1von 7

‫اﻟوﺤدة اﻟﺜﺎﻟﺜﺔ‬

‫‪unification‬‬
‫اﻟذ�ﺎء اﻻﺼطنﺎﻋﻲ‬
‫د‪ .‬ﯿوﺴﻒ اﺒوزر‬
‫‪2011‬‬

‫‪1‬‬
• hate(X) hate(Y) {Y/X}
• We start the unification with the given expressions hate(X)
and hate(Y)
• With these we create our initial system {<hate(X),hate(Y)>};{}
• Decomposition: Due the same arity and functor we can
remove hate to obtain the set with the pair {<X,Y>}
• Current result: {<X,Y>};{}
• Variable Elimination: We can eliminate the variable X of the
pair <X,Y> by instantiating it to Y
• Current result: {<Y,Y>};{X->Y}
• Trivial case: We can drop the pair <Y,Y> because of equality.

• Success! We were able to unify the terms with the set of


substitutions {X->Y}!
2
• p(X, Y, Y) and p(Y, Y, Z) {Y\Z, X\Z}
• We start the unification with the given expressions p(X, Y, Y) and p(Y, Y, Z)
• With these we create our initial system {<p(X, Y, Y),p(Y, Y, Z)>};{}
• Decomposition: Due the same arity and functor we can remove p to obtain the set
with the pairs {<Y,Y>, <Y,Z>, <X,Y>}
• Current result: {<Y,Y>, <Y,Z>, <X,Y>};{}
• Trivial case: We can drop the pair <Y,Y> because of equality.
• Current result: {<Y,Z>, <X,Y>};{}
• Variable Elimination: We can eliminate the variable Y of the pair <Y,Z> by
instantiating it to Z
• Current result: {<Z,Z>, <X,Z>};{Y->Z}
• Trivial case: We can drop the pair <Z,Z> because of equality.
• Current result: {<X,Z>};{Y->Z}
• Variable Elimination: We can eliminate the variable X of the pair <X,Z> by
instantiating it to Z
• Current result: {<Z,Z>};{Y->Z, X->Z}
• Trivial case: We can drop the pair <Z,Z> because of equality.
• Success! We were able to unify the terms with the set of substitutions {Y->Z, X-
3
>Z}!
• p(X, f(X), m(j)) p(b, f(Y), m(Y)) Failure
• We start the unification with the given expressions p(X, f(X), m(j))
and p(b, f(Y), m(Y))
• With these we create our initial system {<p(X, f(X), m(j)),p(b, f(Y),
m(Y))>};{}
• Decomposition: Due the same arity and functor we can remove p to
obtain the set with the pairs {<f(X),f(Y)>, <m(j),m(Y)>, <X,b>}
• Current result: {<f(X),f(Y)>, <m(j),m(Y)>, <X,b>};{}
• Decomposition: Due the same arity and functor we can remove f to
obtain the set with the pairs {<X,Y>, <m(j),m(Y)>, <X,b>}
• Current result: {<X,Y>, <m(j),m(Y)>, <X,b>};{}
• Variable Elimination: We can eliminate the variable X of the pair
<X,Y> by instantiating it to Y
• Current result: {<Y,Y>, <m(j),m(Y)>, <Y,b>};{X->Y}
• Trivial case: We can drop the pair <Y,Y> because of equality.
• Current result: {<m(j),m(Y)>, <Y,b>};{X->Y}
4
• p(X, f(X), m(j)) p(b, f(Y), m(Y)) Failure
• Decomposition: Due the same arity and functor we can remove m to
obtain the set with the pairs {<j,Y>, <Y,b>}
• Current result: {<j,Y>, <Y,b>};{X->Y}
• Orient: Swap j and Y of <j,Y> because the left expressions is not a
variable.
• Current result: {<Y,j>, <Y,b>};{X->Y}
• Variable Elimination: We can eliminate the variable Y of the pair
<Y,j> by instantiating it to j
• Current result: {<j,j>, <j,b>};{Y->j, X->j}
• Trivial case: We can drop the pair <j,j> because of equality.
• Current result: {<j,b>};{Y->j, X->j}
• Unsuccessful trivial case: The pair <j,b> is not unifiyable!
• Fail! We cannot unify the terms.

5
‫ﺘدر�ب‬
‫اﻟموﺤد اﻷﺸمﻞ أو‬
‫ّ‬ ‫• ﺤﺎول ان ﺘوﺤد �ﻼ ﻤمﺎ ﯿﻠﻲ‪ .‬اﻤﺎ أن ﺘجد‬
‫ﺘشرح ﻟمﺎذا ﻻ �مكن ﺘوﺤیدﻫم‪.‬‬
‫‪ p(X,Y) -1‬و ) ‪p(a,Z‬‬
‫اﻟموﺤد اﻻﺸمﻞ ﻫو }‪{a/X,Y/Z‬‬
‫ّ‬ ‫–‬
‫‪ p(X,X) -2‬و ) ‪p(a,b‬‬
‫– ﻻ �مكن ﺘوﺤیدﻫم ﻻن ‪ X‬ﻻ �مكن أن ﺘﺄﺨذ اﻟق�م ‪b,a‬‬
‫‪ q(X,Y) -3‬و )) ‪q(ali,f(ali‬‬
‫اﻟموﺤد اﻻﺸمﻞ ﻫو }‪{ali/X,f(ali)/Y‬‬
‫ّ‬ ‫–‬
‫‪ p(X,a,Y) -4‬و )‪p( Z,Z,b‬‬
‫اﻟموﺤد اﻻﺸمﻞ ﻫو }‪{a/X,a/Z,b/Y‬‬
‫ّ‬ ‫–‬
‫‪6‬‬
• p(Z,Z,b) and p(X,a,Y) {a/X,a/Z,b/Y}
• We start the unification with the given expressions p(Z,Z,b) and p(X,a,Y)
• With these we create our initial system {<p(Z,Z,b), p(X,a,Y)>};{}
• Decomposition: Due the same arity and functor we can remove p to obtain the set
with the pairs {<Z,a>, <b,Y>,<Z,X>}
• Current result: {<Z,a>, <b,Y>,<Z,X>};{}
• Variable Elimination: We can eliminate the variable Z of the pair <Z,a> by instantiating it to a
• Current result: {<a,a>, <b,Y>, <a,X>};{Z->a}
• Trivial case: We can drop the pair <a,a> because of equality.
• Orient: Swap j and Y of <a,X> because the left expressions is not a variable a.
• Current result: {<a,a>, <b,Y>, <X,a>};{Z->a}
• Variable Elimination: We can eliminate the variable Z of the pair <X,b> by
instantiating it to b
• Current result: {<b,Y>, <a,a>};{Z->a, X->a }
• Trivial case: We can drop the pair <a,a> because of equality.
• Current result: { <b,Y> };{Z->a, X->a }
• Orient: Swap b and Y of <b,Y> because the left expressions is not a variable b
• Current result: { <Y,b> };{Z->a, X->a }
• Current result: {};{Z->a, X->a, Y->b } 7

Das könnte Ihnen auch gefallen