1. Unification Algorithm
SRM Institute of Science and Technology
BTech Biotechnology
21CSC206T Artificial Intelligence
Shanmathi M
RA2311009020039 TEAM 16
2. Key terms you SHOULD know before we start:
1) Term:
Variable (eg: x,y,z)
Constant (eg: 3,hello,chocolate)
Function (eg: f(x), symptom(john,cold)
2)Substitution: replacing a variable with a term
parents(x,y)
x=John y=Emma
parents(John,Emma)
3. 3)Unifier: It is the substitution which makes two expressions the same
For example
In our previous example:
parents(x,y)
x=John y=Emma this is the unifier
parents(John,Emma)
4. 4)Most General Unifier: the simplest substitution that makes both the expressions
match
Example:
likes(x,music)
likes(y,music)
x=y
5. What is unification?
Process of making two logical expressions identical by determining a suitable
substitution of variables.
Expression 1: X + 2
Expression 2: 4 + 2
What value can you put in place of the letter so that expression 1 equals expression
2?
Expression 1: (x , 3 , y)
Expression 2: (2 , z , 5)
6. STEPS OF THE ALGORITHM:
1. Start with two expressions
2. Compare parts
3. Find substitutions
4. Apply substitutions
5. Repeat until both expressions match or fail
7. Use of Unification Algorithm:
● It is essential for automated reasoning, theorem proving, and inference
engines, enabling AI systems to derive new knowledge from existing facts
and rules.
● It is used in predicate logic to match variables with constants or other
variables, allowing AI to make logical deductions. This is widely applied in
knowledge representation, expert systems, and natural language
understanding.
8. How is Unification Algorithm used in AI?
Match facts with rules in logic programming (like Prolog)
Example:
fruits(apple,x)
fruits(apple,orange)
x=?
9. Perform reasoning and inference in expert systems
Example:
symptom(james,fever)
symptom(james,cough)
System infers flu!
10. Understand natural language by matching sentence structures (Natural
Language processing)
Example:
Subject + verb + object -> She eats apples.
She- subject eats- verb apple-object
11. Theorem proving (to match logical statements for proof)
Example:
p(y)=q(y)
p(hello)
y=hello (unification works here)
Therefore it is q(hello)
12. RULES FOR UNIFICATION:
1)Identical constants must match
Example:
“apple” = “apple” (valid unification)
“apple” ≠ “banana” (invalid unification)
13. 2) Variables can be replace with other variables or constants in order to achieve
unification
Example:
If X = “red”
then color(X) equals color(“red”) making them identical
14. 3)Function terms and the number of parts should match
f(a, X) = f(a, b)
Here X matches b (X=b)
Exp 1: f(x)
Exp 2: f(a,b)
Number of parts do not match!
15. Unification fails when
● f(x)
g(x)
Cannot unify f=g
● x=f(x)
infinite substitution loops fails too
16. Limitations
1)Handling infinite recursion:
In statements like x=f(x) unification is not possible
2)Complex expressions and Nested functions:
Unification becomes computationally intensive because the structure of the terms needs to
be matched at multiple levels.
3)Higher Order Logic Complexity:
Beyond first-order logic, unification becomes significantly more complex. Higher-order unification
involves variables that can represent functions, requiring advanced techniques that increase
computational overhead.