Professional Documents
Culture Documents
Tuomas Sandholm
Carnegie Mellon University
Computer Science Department
First-Order Logic (FOL)
Syntax
• User defines these primitives:
– Constant symbols (i.e., the "individuals" in the world)
E.g., Mary, 3
• Universal quantifiers are usually used with "implies" to form "if-then rules."
– E.g., (Ax) cs15-381-student(x) => smart(x) means "All cs15-381 students are
smart."
– You rarely use universal quantification to make blanket statements about every
individual in the world: (Ax)cs15-381-student(x) ^ smart(x) meaning that
everyone in the world is a cs15-381 student and is smart.
Quantifiers …
• Existential quantifiers are usually used with "and" to specify a list of
properties or facts about an individual.
– E.g., (Ex) cs15-381-student(x) ^ smart(x) means "there is a cs15-381
student who is smart."
– A common mistake is to represent this English sentence as the FOL sentence:
(Ex) cs15-381-student(x) => smart(x)
• Switching the order of universal quantifiers does not change the meaning:
(Ax)(Ay)P(x,y) is logically equivalent to (Ay)(Ax)P(x,y). Similarly, you
can switch the order of existential quantifiers.
Forward chaining
∀x P(x) => Q(x)
∀x ¬P(x) => Q(x) Cannot be converted to Horn
∀x Q(x) => S(x)
∀x R(x) => S(x)
Proof: Data-driven
• Use GMP with (1) and (3) to derive: 4. likes(Ziggy, Fish)
• Use GMP with (3), (4) and (2) to derive eats(Ziggy, Fish)
• So, Yes, Ziggy eats fish.
Backward chaining
• Backward-chaining deduction using GMP is complete for KBs containing only
Horn clauses. Proofs start with the goal query, find implications that would allow
you to prove it, and then prove each of the antecedents in the implication,
continuing to work "backwards" until we get to the axioms, which we know are true.
KB = union(KB, resolvent)
return "success"
Resolution example (using PL sentences)
• From “Heads I win, tails you lose” prove that “I win”
• First, define the axioms in KB:
• "Heads I win, tails you lose."
(Heads => IWin) or, equivalently, (~Heads v IWin)
(Tails => YouLose) or, equivalently, (~Tails v YouLose)
• Add some general knowledge axioms about coins, winning, and losing:
(Heads v Tails)
(YouLose => IWin) or, equivalently, (~YouLose v IWin)
(IWin => YouLose) or, equivalently, (~IWin v YouLose)
• Goal: IWin
Resolution example (using PL sentences)…
• Eliminate <=>
Nothing to do here.
• Eliminate =>
(Ax)(~P(x) v ((Ay)(~P(y) v P(f(x,y))) ^ ~(Ay)(~Q(x,y) v P(y))))
• Standardize variables
(Ax)(~P(x) v ((Ay)(~P(y) v P(f(x,y))) ^ (Ez)(Q(x,z) ^ ~P(z))))
2. Standardize variables
– ~P(x) v ~P(y) v P(f(x,y))
– ~P(z) v Q(z,g(z))
– ~P(w) v ~P(g(w))
Example: Hoofers Club [example from Charles Dyer]
1. S(x1) v M(x1)
2. ~M(x2) v ~L(x2, Rain)
3. ~S(x3) v L(x3, Snow)
4. ~L(Tony, x4) v ~L(Ellen, x4)
5. L(Tony, x5) v L(Ellen, x5)
6. L(Tony, Rain)
7. L(Tony, Snow)
8. Negation of the Query: ~M(x7) v S(x7)
11 7 12. False {}
Example: Hoofers Club…
• Answer Extraction
Clause 1 Clause 2 Resolvent MGU (i.e.,
Theta)
~M(x7) v S(x7) v 1 9. S(x1) v (M(x1) ^ ~S(x1)) {x7/x1}
(M(x7) ^ ~S(x7))