Sunteți pe pagina 1din 3

ArtificialIntelligence

LearneverythingaboutArtificialIntelligenceherefromaSubjectExpert.
bidvertiser01

Monday,July26,2010

UnificationAlgrithm.
UNIFICATIONALGORITHM
In propsoitional logic it is easy to determine that two literals can not both be true at the
same time. Simply look for L and ~L . In predicate logic, this matching process is more
complicated,sincebindingsofvariablesmustbeconsidered.
For example man (john) and man(john) is a contradiction while man (john) and
man(Himalayas) is not. Thus in order to determine contradictions we need a matching
procedure that compares two literals and discovers whether there exist a set of
substitutions that makes them identical . There is a recursive procedure that does this
matching.ItiscalledUnificationalgorithm.

InUnificationalgorithmeachliteralisrepresentedasalist,wherefirstelementisthename
of a predicate and the remaining elements are arguments. The argument may be a single
element(atom)ormaybeanotherlist.Forexamplewecanhaveliteralsas
(tryassassinateMarcusCaesar)
(tryassassinateMarcus(rulerofRome))
To unify two literals , first check if their first elements re same. If so proceed. Otherwise
theycannotbeunified.Forexampletheliterals
(tryassassinateMarcusCaesar)
(hateMarcusCaesar)
Can not be Unfied. The unification algorithm recursively matches pairs of elements, one
pairatatime.Thematchingrulesare:
i)Differentconstants,functionsorpredicatescannotmatch,whereasidenticalonescan.
ii) A variable can match another variable , any constant or a function or predicate
expression, subject to the condition that the function or [predicate expression must not
contain any instance of the variable being matched (otherwise it will lead to infinite
recursion).
iii) The substitution must be consistent. Substituting y for x now and then z for x later is
inconsistent.(asubstitutionyforxwrittenasy/x)
The Unification algorithm is listed below as a procedure UNIFY (L1, L2). It returns a list
representing the composition of the substitutions that were performed during the match.
An empty list NIL indicates that a match was found without any substitutions. If the list
containsasinglevalueF,itindicatesthattheunificationprocedurefailed.
UNIFY(L1,L2)
1.ifL1orL2isanatompartofsamethingdo

(a)ifL1orL2areidenticalthenreturnNIL
(b)elseifL1isavariablethendo
(i)ifL1occursinL2thenreturnFelsereturn(L2/L1)
elseifL2isavariablethendo
(i)ifL2occursinL1thenreturnFelsereturn(L1/L2)
elsereturnF.
2.Iflength(L!)isnotequaltolength(L2)thenreturnF.
3.SetSUBSTtoNIL
( at the end of this procedure , SUBST will contain all the substitutions used to unify L1
andL2).
4.ForI=1tonumberofelementsinL1do
i)callUNIFYwiththeithelementofL1andIthelementofL2,puttingtheresultinS
ii)ifS=FthenreturnF
iii)ifSisnotequaltoNILthendo
(A)applyStotheremainderofbothL1andL2
(B)SUBST:=APPEND(S,SUBST)returnSUBST.

PostedbyGurram.VeeraRaghavavaiahat3:11AM

EmailThisBlogThis!SharetoTwitterSharetoFacebookSharetoPinterest

3comments:
1.
HarshDecember21,2011at6:48AM
Sirwhatistheremainderofl1andl2
ReplyDelete
2.
AshuDahiyaOctober21,2015at11:51PM
whatusSandSUBST?
ReplyDelete
3.
JonesMorrisSeptember11,2016at3:29AM
Wowicansaythatthisisanothergreatarticleasexpectedofthisblog.Bookmarkedthis
site..computerai
ReplyDelete
Addcomment
Loadmore...

NewerPost OlderPost Home


Subscribeto:PostComments(Atom)
SearchThisBlog

Loading...
Clock

S-ar putea să vă placă și