First-Order Logic (FOL) and Its Inference Methods
1. What is First-Order Logic (FOL)?
First-Order Logic (FOL) is a way to represent knowledge using objects, properties, and relationships
between them. It is more powerful than simple logic (propositional logic) because it allows reasoning
about multiple objects and their connections.
2. Basic Elements of FOL
- Constants - Specific names of objects (e.g., John, Dog, Apple).
- Variables - Represent any object (e.g., x, y, z).
- Predicates - Show relationships (e.g., Loves(John, Mary), GreaterThan(5, 2)).
- Functions - Map objects to other objects (e.g., Father(John) = Robert).
- Quantifiers:
- Universal ( forall ) -> "For all" (e.g., forallx Dog(x) -> Animal(x) -> All dogs are animals).
- Existential ( exists ) -> "There exists" (e.g., existsx Loves(x, Mary) -> Someone loves Mary).
3. Difference Between Propositional and First-Order Inference
- Propositional Logic only uses whole statements (e.g., If it rains, the ground is wet).
- First-Order Logic allows variables and rules (e.g., If x is a bird, then x can fly).
- FOL is more powerful because it works with general rules rather than just specific cases.
4. Unification (Matching Rules)
Unification means matching logical statements by finding values for variables.
Example:
We have:
1. Knows(John, x)
2. Knows(y, Alice)
To make them the same, we set x = Alice and y = John, making both statements match.
5. Forward Chaining (From Facts to Conclusion)
Forward chaining starts with known facts and applies rules to find new facts.
Example:
1. We know: Bird(Tweety)
2. We have a rule: If something is a bird, it can fly -> Bird(x) -> CanFly(x)
3. Since Bird(Tweety), we can conclude CanFly(Tweety).
Used in AI expert systems (like rule-based systems).
6. Backward Chaining (From Goal to Facts)
Backward chaining starts with a goal and works backward to see if facts support it.
Example:
- Goal: Can Tweety fly? (CanFly(Tweety)?)
- Check rule: Bird(x) -> CanFly(x)
- Ask: Is Bird(Tweety) true? (Yes, we know Tweety is a bird)
- So, we confirm CanFly(Tweety) is true.
Used in AI and Prolog programming.
7. Resolution (Proof by Contradiction)
Resolution is used to prove something by contradiction.
Example:
1. Given:
- All humans are mortal: forallx (Human(x) -> Mortal(x))
- Socrates is human: Human(Socrates)
2. Suppose the opposite of what we want to prove: not Mortal(Socrates) (Socrates is NOT mortal).
3. Use the rule Human(x) -> Mortal(x), which means Human(Socrates) -> Mortal(Socrates).
4. Since we assumed not Mortal(Socrates), it contradicts the fact that Socrates is human.
5. So, our assumption is wrong, meaning Mortal(Socrates) must be true.
Used in AI, theorem proving, and automated reasoning.
8. Summary of Inference Methods
| Method | How it Works | Example |
|---------|------------|---------|
| Unification | Matches statements by finding variable values | Knows(John, x) and Knows(y, Alice)
unify with x = Alice, y = John |
| Forward Chaining | Starts from known facts, applies rules to find new facts | Bird(Tweety) ->
CanFly(Tweety) |
| Backward Chaining | Starts from a goal and checks if facts support it | Prove CanFly(Tweety) by
checking if Bird(Tweety) is true |
| Resolution | Proves by contradiction | All humans are mortal, Socrates is human, so Socrates is
mortal |
9. Conclusion
First-Order Logic helps us represent real-world knowledge better than simple logic. Using
unification, forward chaining, backward chaining, and resolution, we can automate logical reasoning,
which is important in AI, expert systems, and automated theorem proving.