Inference in First Order Logic (FOL) Detailed
Notes with Examples
1. Propositional Logic
Definition:
Propositional Logic is the branch of logic that deals with propositions or statements that are either True or False.
A proposition does not describe objects or relationships. It only represents facts.
Examples:
P = “It is raining”
Q = “Road is wet”
Rule:
If it rains, then the road becomes wet.
Symbolically:
P→Q
If P is true, then Q becomes true.
Limitations:
• Cannot represent relationships.
• Cannot represent variables or objects.
• Cannot express “All humans are mortal”.
2. First Order Logic (FOL)
Definition:
First Order Logic is an extension of propositional logic that allows the use of:
• Objects
• Variables
• Predicates
• Quantifiers
Main Components:
Predicates: Describe properties or relationships.
Example: Human(x), Loves(Ram, Sita)
Variables: Symbols representing objects.
Example: x, y, z
Quantifiers:
• Universal Quantifier (∀): “For all”
• Existential Quantifier (∃): “There exists”
Example:
“All humans are mortal”
∀x Human(x) → Mortal(x)
Meaning:
For every object x, if x is a human, then x is mortal.
If Human(Socrates) is true, then Mortal(Socrates) is also true.
3. Unification
Definition:
Unification is the process of making two logical expressions identical by replacing variables with suitable values.
Example 1:
Likes(x, IceCream)
Likes(Ram, IceCream)
Substitute:
x = Ram
Both expressions become identical.
Example 2:
Parent(x, y)
Parent(John, Bob)
Substitution:
x = John
y = Bob
Applications:
• Automated reasoning
• Logic programming
• AI systems
• Prolog language
4. Forward Chaining
Definition:
Forward chaining is an inference method that starts from known facts and applies rules to derive new facts until the
goal is reached.
It is called a data-driven approach.
Example:
Facts:
Human(Ram)
Human(Shyam)
Rule:
Human(x) → Mortal(x)
From Human(Ram), infer Mortal(Ram).
From Human(Shyam), infer Mortal(Shyam).
Working Steps:
1. Start with known facts.
2. Apply rules.
3. Generate new facts.
4. Continue until goal is reached.
Applications:
• Medical diagnosis
• Monitoring systems
• Recommendation systems
5. Backward Chaining
Definition:
Backward chaining starts with a goal and works backward to determine whether the available facts support the goal.
It is called a goal-driven approach.
Example:
Goal: Mortal(Ram)
Rule:
Human(x) → Mortal(x)
The system asks:
Is Human(Ram) true?
If Human(Ram) exists as a fact, then Mortal(Ram) is proved.
Applications:
• Expert systems
• Question answering systems
• Troubleshooting systems
6. Resolution
Definition:
Resolution is an inference rule used in Artificial Intelligence and automated theorem proving. It derives conclusions
using contradiction.
Basic Idea:
If two clauses contain opposite literals, they can be resolved to produce a new clause.
Example:
Clause 1: A ∨ B
Clause 2: ¬B
Resolving B and ¬B gives:
A
FOL Example:
Human(x) → Mortal(x)
Convert into clause form:
¬Human(x) ∨ Mortal(x)
Given:
Human(Socrates)
Using resolution:
Mortal(Socrates)
Applications:
• Theorem proving
• AI reasoning systems
• Logic-based search systems
7. Difference Between Forward and Backward Chaining
Forward Chaining:
• Starts from facts
• Data-driven approach
• Generates all possible conclusions
• Suitable when many conclusions are needed
Backward Chaining:
• Starts from goal
• Goal-driven approach
• Searches for specific conclusion
• Efficient for expert systems
8. Conclusion
First Order Logic is a powerful knowledge representation method used in Artificial Intelligence. Concepts such as
unification, forward chaining, backward chaining, and resolution help AI systems perform logical reasoning and
decision making.
These techniques are widely used in: • Expert systems
• Robotics
• Natural Language Processing
• Automated reasoning systems
• Machine intelligence applications
Comparison Table
Feature Forward Chaining Backward Chaining
Starting Point Facts Goal
Approach Data-driven Goal-driven
Search Direction Facts → Goal Goal → Facts
Usage Monitoring systems Expert systems