What is Unification?
Let Ψ_{1} = King(x), Ψ_{2} = King(John), Substitution θ = {John/x} is a unifier for these atoms and applying this substitution, and both expressions will be identical.
E.g. Let's say there are two different expressions, P(x, y), and P(a, f(z)). In this example, we need to make both above statements identical to each other. For this, we will perform the substitution. P(x, y)......... (i)
Conditions for Unification:Following are some basic conditions for unification:
Unification Algorithm:Algorithm: Unify(Ψ_{1}, Ψ_{2}) Step. 1: If Ψ_{1} or Ψ_{2} is a variable or constant, then: a) If Ψ_{1} or Ψ_{2} are identical, then return NIL. b) Else if Ψ_{1}is a variable, a. then if Ψ_{1} occurs in Ψ_{2}, then return FAILURE b. Else return { (Ψ_{2}/ Ψ_{1})}. c) Else if Ψ_{2} is a variable, a. If Ψ_{2} occurs in Ψ_{1} then return FAILURE, b. Else return {( Ψ_{1}/ Ψ_{2})}. d) Else return FAILURE. Step.2: If the initial Predicate symbol in Ψ_{1} and Ψ_{2} are not same, then return FAILURE. Step. 3: IF Ψ_{1} and Ψ_{2} 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 Ψ_{1}. a) Call Unify function with the ith element of Ψ_{1} and ith element of Ψ_{2}, 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. Implementation of the AlgorithmStep.1: Initialize the substitution set to be empty. Step.2: Recursively unify atomic sentences:
For each pair of the following atomic sentences find the most general unifier (If exist). 1. Find the MGU of {p(f(a), g(Y)) and p(X, X)} Sol: S_{0} => Here, Ψ_{1} = p(f(a), g(Y)), and Ψ_{2} = p(X, X) Unification is not possible for these expressions. 2. Find the MGU of {p(b, X, f(g(Z))) and p(Z, f(Y), f(Y))} Here, Ψ_{1} = p(b, X, f(g(Z))) , and Ψ_{2} = p(Z, f(Y), f(Y)) S_{1} => { p(b, X, f(g(b))); p(b, f(Y), f(Y))} S_{2} => { p(b, f(Y), f(g(b))); p(b, f(Y), f(Y))} S_{2} => { p(b, f(g(b)), f(g(b)); p(b, f(g(b)), f(g(b))} Unified Successfully. 3. Find the MGU of {p (X, X), and p (Z, f(Z))} Here, Ψ_{1} = {p (X, X), and Ψ_{2} = p (Z, f(Z)) Hence, unification is not possible for these expressions. 4. Find the MGU of UNIFY(prime (11), prime(y)) Here, Ψ_{1} = {prime(11) , and Ψ_{2} = prime(y)} S_{1} => {prime(11) , prime(11)} , Successfully unified. 5. Find the MGU of Q(a, g(x, a), f(y)), Q(a, g(f(b), a), x)} Here, Ψ_{1} = Q(a, g(x, a), f(y)), and Ψ_{2} = Q(a, g(f(b), a), x) SUBST θ= {b/y} Unifier: [a/a, f(b)/x, b/y]. 6. UNIFY(knows(Richard, x), knows(Richard, John)) Here, Ψ_{1} = knows(Richard, x), and Ψ_{2} = knows(Richard, John)
Next TopicResolution in FOL

Ansible
Mockito
Talend
Azure
SharePoint
Powershell
Kali Linux
OpenCV
Kafka
Pandas
Joomla
Reinforcement