First-Order Logic (Chapters 8 - 9)
Goal query: Does Ziggy eat fish?
To prove eats(Ziggy, Fish), first see if this is known from one of the axioms directly. Here it is not known, so see if there is a Horn clause that has the consequent (i.e., right-hand side) of the implication matching the goal. Here,
procedure unify(p, q, theta) Scan p and q left-to-right and find the first corresponding terms where p and q "disagree" ; where p and q not equal If there is no disagreement, return theta ; success Let r and s be the terms in p and q, respectively, where disagreement first occurs If variable(r) then theta = union(theta, ) unify(subst(theta, p), subst(theta, q), theta) else if variable(s) then theta = union(theta, ) unify(subst(theta, p), subst(theta, q), theta) else return "failure" end
Literal 1 | Literal 2 | Result of Unify |
---|---|---|
parents(x, father(x), mother(Bill)) | parents(Bill, father(Bill), y) | |
parents(x, father(x), mother(Bill)) | parents(Bill, father(y), z) | |
parents(x, father(x), mother(Jane)) | parents(Bill, father(y), mother(y)) | Failure |
procedure resolution-refutation(KB, Q) ;; KB is a set of consistent, true FOL sentences ;; Q is a goal sentence that we want to derive ;; return success if KB |- Q, and failure otherwise KB = union(KB, ~Q) while false not in KB do pick 2 sentences, S1 and S2, in KB that contain literals that unify if none, return "failure" resolvent = resolution-rule(S1, S2) KB = union(KB, resolvent) return "success" end
Sentence 1 | Sentence 2 | Resolvent |
---|---|---|
~IWin | ~Heads v IWin | ~Heads |
~Heads | Heads v Tails | Tails |
Tails | ~Tails v YouLose | YouLose |
YouLose | ~YouLose v IWin | IWin |
IWin | ~IWin | False |
Convert the sentence (Ax)(P(x) => ((Ay)(P(y) => P(f(x,y))) ^ ~(Ay)(Q(x,y) => P(y))))
procedure resolution-refutation(KB, Q) ;; KB is a set of consistent, true FOL sentences ;; Q is a goal sentence that we want to derive ;; return success if KB |- Q, and failure otherwise KB = union(KB, ~Q) KB = clause-form(KB) ; convert sentences to clause form while false not in KB do pick 2 clauses, C1 and C2, that contain literals that unify if none, return "failure" resolvent = resolution-rule(C1, C2) KB = union(KB, resolvent) return "success" end
Tony, Shi-Kuo and Ellen belong to the Hoofers Club. Every member of the Hoofers Club is either a skier or a mountain climber or both. No mountain climber likes rain, and all skiers like snow. Ellen dislikes whatever Tony likes and likes whatever Tony dislikes. Tony likes rain and snow.
Is there a member of the Hoofers Club who is a mountain climber but not a skier?
Let S(x) mean x is a skier, M(x) mean x is a mountain climber, and L(x,y) mean x likes y, where the domain of the first variable is Hoofers Club members, and the domain of the second variable is snow and rain. We can now translate the above English sentences into the following FOL wffs:
Clause 1 | Clause 2 | Resolvent | MGU (i.e., Theta) |
---|---|---|---|
8 | 1 | 9. S(x1) | |
9 | 3 | 10. L(x1, Snow) | |
10 | 4 | 11. ~L(Tony, Snow) | |
11 | 7 | 12. False | <> |
Clause 1 | Clause 2 | Resolvent | MGU (i.e., Theta) |
---|---|---|---|
~M(x7) v S(x7) v (M(x7) ^ ~S(x7)) | 1 | 9. S(x1) v (M(x1) ^ ~S(x1)) | |
9 | 3 | 10. L(x1, Snow) v (M(x1) ^ ~S(x1)) | |
10 | 4 | 11. ~L(Tony, Snow) v (M(Ellen) ^ ~S(Ellen)) | |
11 | 7 | 12. M(Ellen) ^ ~S(Ellen) | <> |
Last modified October 14, 1998
Copyright © 1996 by Charles R. Dyer. All rights reserved.