Unit 3-Unifications
Unit 3-Unifications
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.
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