Background — Propositional logic is simple, but it lacks expressive power.11. First Order Logic is the standard formal language of mathematics and is expressive enough to define almost any rule-based system. In propositional logic, to say “All men are mortal”, we would need to write a separate proposition for every single human.
First Order Logic (FOL): A logic that assumes the world contains Objects (people, houses, numbers), Relations (red, round, brother of), and Functions (father of, best friend).
KingJohn, 2, CS4200).Brother(Richard, John), > (3, 2)).LeftLegOf(John)).x, y).Allow us to express properties of entire collections of objects.
“All kings are persons.” \to \forall x \text{ King}(x) \implies \text{Person}(x)
“There is a king who is evil.” \to \exists x \text{ King}(x) \land \text{Evil}(x)
“Everyone likes apples.” \to \forall x \text{ Likes}(x, Apples)
Inference in FOL is harder than propositional logic because of variables. We need ways to instantiate variables with objects.
Finding a substitution that makes two different logical expressions look identical.22. Standard Unification algorithms must also include an “occurs check” to prevent recursive variable assignments like x / F(x).
UNIFY(Knows(John, x), Knows(John, Jane)) = {x / Jane}UNIFY(Knows(John, x), Knows(y, Bill)) = {x / Bill, y / John}
An upgraded version of Modus Ponens that handles variables.33. GMP is efficient because it takes one big step rather than requiring us to instantiate a rule with every single known object just to use regular Modus Ponens once.
If we have a rule P(x) \implies Q(x) and a fact P(John), GMP unifies x with John and immediately concludes Q(John).
Start with the facts in the KB, apply rules that trigger, and add the new conclusions to the KB. Repeat until the goal is found.
Start with the goal, find rules that could prove it, and recursively try to prove the premises of those rules.
Just like in propositional logic, we can use Resolution for a complete inference procedure, but we must first convert FOL sentences into Conjunctive Normal Form (CNF).
Steps to CNF:
“Everyone has a heart.” \to \forall x \exists y \text{ Heart}(y) \land \text{Has}(x, y)
Skolemizing y means we can’t just pick a constant H1, because everyone has a different heart. We replace y with a Skolem function F(x) that maps a person to their specific heart:
\forall x \text{ Heart}(F(x)) \land \text{Has}(x, F(x))
First Order Logic is the standard formal language of mathematics and is expressive enough to define almost any rule-based system.↩︎
Standard Unification algorithms must also include an “occurs check” to prevent recursive variable assignments like x / F(x).↩︎
GMP is efficient because it takes one big step rather than requiring us to instantiate a rule with every single known object just to use regular Modus Ponens once.↩︎