IN-FEED-AD

Unification in Artificial Intelligence


Unification:-

Unification is a process of making two different logical atomic expressions identical by finding a substitution. Unification depends on the substitution process.It takes two literals as input and makes them identical using substitution.

Example:-

P(x,f(y)) , P(a,f(g(z)))
Substitution set=> [a/x,g(z)/y]
It can be read as a for x.

Example-2:-  

Q(a,g(x,a),f(y)) , Q(a,g(f(b),a),x)
Substitution set [a/a,f(b)/x,b/y]
Substitution:- a Substitution ti/vi specifies Substitution of term ti and variable vi

Unification Algorithm:

Algorithm: Unify(L1, L2)
Step. 1: If L1 or L2 is a variable or constant, then:
                a) If L1 or L2 are identical, then return NIL.
                b) Else if L1  is a variable,
                                a. then if L1 occurs in L2, then return FAILURE
                                b. Else return { (L2/ L1)}.
                c) Else if L2 is a variable,
                                a. If L2 occurs in L1 then return FAILURE,
                                b. Else return {( L1/ L2)}.
                d) Else return FAILURE.
Step.2: If the initial Predicate symbol in L1 and L2 are not same, then return FAILURE.
Step. 3: IF L1 and L2 have a different number of arguments, then return FAILURE.
Step. 4: Set Substitution set(SUBST) to NIL.
Step. 5: For i=1 to the number of elements in L1.
                a) Call Unify function with the ith element of L1 and ith element of L2, and put the result into S.
                b) If S = failure then returns Failure
                c) If S ≠ NIL then do,
                                a. Apply S to the remainder of both L1 and L2.
                                b. SUBST= APPEND(S, SUBST).
Step.6: Return SUBST.

Ask question #Pywix

Please Like, Comment, Share and Subscribe THANK YOU!

Post a Comment

0 Comments