560 likes | 935 Views
Outline. History of Reasoning FOL Inference Rules Generalized Modus Ponens Unification and MGU Soundness and Completeness Forward and Backward Chaining using GMP. A Brief History of Reasoning. 450BCE Stoics PL, inference (?) 32BCE Aristotle inference rules (syllogisms), quantifiers1
E N D
1. Foundations of Artificial Intelligence
2. Outline History of Reasoning
FOL Inference Rules
Generalized Modus Ponens
Unification and MGU
Soundness and Completeness
Forward and Backward Chaining using GMP
3. A Brief History of Reasoning 450BCE Stoics PL, inference (?)
32BCE Aristotle inference rules (syllogisms), quantifiers
1565 Cardano PL + uncertainty (probability theory)
1847 Boole PL (again)
1879 Frege FOL
1922 Wittgenstein proof using truth table
1930 Gödel complete algo for FOL exists
1930 Herbrand complete algo for FOL (reduce to PL)
1931 Gödel complete algo doesn't exist if induction used
1960 Davis/ practical algo for PL Putnam
1965 Robinson practical algo for FOL (resolution)
4. Inference Rules for FOL Universal Elimination, UEvariable substituted with ground term
"x Eats(Jim,x) infer Eats(Jim,Cake) UE: ground term can be any constant symbol or function symbol applied to only ground terms
EE: constant symbol must not exist in the KB or else accidental inferences may be drawn
Ex Mother(x,Joy) infer with EE Mother(Joy,Joy) leads to an illogical inferenceUE: ground term can be any constant symbol or function symbol applied to only ground terms
EE: constant symbol must not exist in the KB or else accidental inferences may be drawn
Ex Mother(x,Joy) infer with EE Mother(Joy,Joy) leads to an illogical inference
5. PL Inference Rules also for FOL Implication Elimination (IE) (Modus Ponens, MP) AE if jointly true then separately true
AI if separately true then jointly true
OI if at least one true then disjointly trueAE if jointly true then separately true
AI if separately true then jointly true
OI if at least one true then disjointly true
6. PL Inference Rules also for FOL Unit Resolution (UR) monotonicity: set of entailed sentences can only increase as information is added to the KB
adding a new sentence to KB does not affect what can be entailed from the original KB and does not invalidate old sentencesmonotonicity: set of entailed sentences can only increase as information is added to the KB
adding a new sentence to KB does not affect what can be entailed from the original KB and does not invalidate old sentences
7. A Simple FOL Proof using Natural Deduction Jim is a turtle.
Turtle(Jim)
Deb is a rabbit.
Rabbit(Deb)
Turtles outlast Rabbits.
"x,y Turtle(x) Ù Rabbit(y) Þ Outlast(x,y)
Query: Jim outlasts Deb.
Outlast(Jim,Deb)
8. A Simple FOL Proof using Natural Deduction And Introduction AI 1. & 2.
Turtle(Jim) Ù Rabbit(Deb)
Universal Elimination UE 3. {x/Jim, y/Deb}
Turtle(Jim) Ù Rabbit(Deb) Þ Outlast(Jim,Deb)
Modus Ponens MP 4. & 5.
Outlast(Jim,Deb)
AI, UE, MP is a common inference pattern.
Automated inference harder with FOL than PL.Variables can take on a potentially infinite numberof possible values from their domain and thus UE can be applied in a potentially infinite number of ways to KB. Propositionalization runs into problems with FOL functions since then the set of ground term substitutions becomes infinite.
Fortunately Herbrand proved that only a finite subset of of the propositionalized KB is required to prove a sentence that is entailed by the FOL KBPropositionalization runs into problems with FOL functions since then the set of ground term substitutions becomes infinite.
Fortunately Herbrand proved that only a finite subset of of the propositionalized KB is required to prove a sentence that is entailed by the FOL KB
9. Proof as Search using Inference Rules Operators are inference rules
States are the KB
Goal test checks if query in KB
10. Generalized Modus Ponens (GMP) Unify rule premises with known factsand apply unifier to conclusion.
Rule: "x,y Turtle(x) Ù Rabbit(y) Þ Outlast(x,y)
Known facts: Turtle(Jim), Rabbit(Deb)
Unifier: {x/Jim, y/Deb}
Apply unifier to conclusion: Outlast(Jim,Deb)
11. Generalized Modus Ponens (GMP) Combines AI, UE, and MP (IE) into a single rule
12. Generalized Modus Ponens (GMP) Combines AI, UE, and MP (IE) into a single rule
13. Generalized Modus Ponens (GMP) Combines AI, UE, and MP (IE) into a single rule
14. Unification Substitution q unifies p1' and p1 if SUBST(q,p1' ) = SUBST(q, p1). assume all variables universally quantified
Turtle(x) means x is a turtle
Hears(x,y) means x hears yassume all variables universally quantified
Turtle(x) means x is a turtle
Hears(x,y) means x hears y
15. Unification Substitution q unifies p1' and p1 if SUBST(q,p1' ) = SUBST(q, p1). assume all variables universally quantified
must standardize apart the variables (third example)
Turtle(x) means x is a turtle
Hears(x,y) means x hears y
Eats(x,y) means x eats y
Sees(x,y,z) means x sees y at z
assume all variables universally quantified
must standardize apart the variables (third example)
Turtle(x) means x is a turtle
Hears(x,y) means x hears y
Eats(x,y) means x eats y
Sees(x,y,z) means x sees y at z
16. Unification: Simplified Algorithm //see figure 9.1 of text for full implementation
//returns a unifier or null if failure
//assumes predicates match and variables are separated apart
List unify (Literal m, Literal n, List theta) {
scan m and n left-to-right and find the first corresponding terms where m and n are not the same
if (no difference in terms) return theta; //success
else {r = term in m; s = term in n;} //where term r != term s
if (isVariable(r)) {
theta = unionOf(theta,{r/s});//should fail if r occurs in s
unify(substitute(theta, m), substitute(theta, n), theta);
}
else if (isVariable(s)) {
theta = unionOf(theta,{s/r});//should fail if s occurs in r
unify(substitute(theta, m), substitute(theta, n), theta);
}
else return null; //failure
} scan looks at terms of functions too: P(F(x)) and P(F(y))
OC: Everyone that helps themselves is successful. Helps(x,x) => Successful(x)
Everyone helps their mother. Helps(y, Mother(y))
unify without OC {y/Mother(y)} Successful(Mother(y)) Everyone's mother is successful!!!
or SUBST is infinite recursion Mother(Mother(Mother(Mother(…scan looks at terms of functions too: P(F(x)) and P(F(y))
OC: Everyone that helps themselves is successful. Helps(x,x) => Successful(x)
Everyone helps their mother. Helps(y, Mother(y))
unify without OC {y/Mother(y)} Successful(Mother(y)) Everyone's mother is successful!!!
or SUBST is infinite recursion Mother(Mother(Mother(Mother(…
17. Unification Unify returns q a most general unifier (MGU)
shortest length substitution list to make a match
in general, more than one MGU
AIMA algorithm recursively explores the two expressions and simultaneously builds q.
Occurs-Check prevents a variable from replacing a term that contains that variable, e.g. prevents {x/F(x)}.
this slows down the unify algorithm
Unify with the occurs-check has a time complexity of O(n2) where n is the size of the expressions. MGU: Knows(Anne,x) Knows(y,z)
{y/Anne, x/z} {y/Anne, z/x} {y/Anne, x/w, z/w} {y/Anne, x/Deb, z/Deb} {y/Anne, x/Deb, z/Deb, w/Jim}MGU: Knows(Anne,x) Knows(y,z)
{y/Anne, x/z} {y/Anne, z/x} {y/Anne, x/w, z/w} {y/Anne, x/Deb, z/Deb} {y/Anne, x/Deb, z/Deb, w/Jim}
18. Soundness ofGeneralized Modus Ponens (GMP) Show:p1', p2', …, pn', (p1 Ù p2 Ù…Ù pn Þ q) ¦ qq
provided that unification succeeds(i.e. pi'q = piq for all i where aq is SUBST(q,a))
Lemma:for any Horn clause p, p ¦ pq by UE
(p1 Ù …Ù pn Þ q) ¦(p1 Ù …Ù pn Þ q)q = (p1q Ù…Ù pnq Þ qq) (by lemma)
p1', …, pn‘ ¦ p1' Ù …Ù pn‘ (by AI)
p1' Ù …Ù pn' ¦ p1'q Ù…Ù pn'q (by lemma)
qq (by MP 1 & 3, since pi'q = piq for all i)
19. Completeness of FOL Automated Inference Truth table enumeration: incomplete for FOLtable may be infinite in size for infinite domain
Natural Deduction: complete for FOL but impractical since branching factor too large
GMP: incomplete for FOLnot every sentence can be converted to Horn form
GMP: complete for FOL KB in HNF
forward chaining: move from KB to query
backward chaining: move from query to KB
20. Forward Chaining (FC) with GMP Move "forwards" from KB to query
Simplified FC Algorithm (see figure 9.3):Assume query q is asked of KB
repeat until no new sentences are inferred initialize NEW to empty
for each rule that can have all of its premises satisfied
apply composed substitution to the conclusion
add the new conclusion to NEW if it's not just a renaming
done if the new conclusion unifies with the query
add sentences in NEW to KB
return false since q never concluded
21. Forward Chaining (FC) with GMP In Class FC Example
Production systems earliest formof forward-chaining systems
XCON (1980s) used several thousand rulesto configure DEC systems
ACT (1983), SOAR (1987)popular form of cognitive architecture
working memory models short-term memory
productions model long-term memory
22. Backward Chaining (BC) with GMP Move "backwards" from query to KB
Simplified BC Algorithm (see figure 9.6): Assume query q is asked of KB
if a matching fact q' is known, return unifier (base case)
for each rule whose consequent q' matches q (recursive)
attempt to prove each premise of the rule by BC (depth first)
(Complication added to keep track of unifiers, i.e. composition)(Further complications help avoid infinite loops)
23. Backward Chaining (BC) with GMP In Class BC Example
BC versions
find any solution
find all solutions
BC is basis for logic programming, e.g. Prolog:
a program is a set of logic sentencesin HNF, which is called the database
it is executed by specifying a query to be proved
24. Limits of GMP FC and BC are complete for Horn KBsbut are incomplete for general FOL KBs:
PhD(x) Þ HighlyQualified(x)
ØPhD(x) Þ EarlyEarnings(x)
HighlyQualified(x) Þ Rich(x)
EarlyEarnings(x) Þ Rich(x)
Query: Rich(Me)
What is the problem with the example above?
Is there a complete inferencing algorithmthat works for any FOL knowledge base?
Yes! Resolution Refutation Assume variables universally quantified
second sentence cannot be converted to HNFAssume variables universally quantified
second sentence cannot be converted to HNF
25. Resolution Refutation Resolution refutation isan inferencing techniquethat requires a CNF representation.
Any FOL KB can be converted into CNF.
CNF: Conjunctive Normal Form
conjunction of clauses where
CNF clause: a disjunction of literals
e.g. Hot(x) Ú Warn(x) Ú Cold(x)
Literal: an atomeither positive (unnegated) or negative (negated)
e.g. ØHappy(Sally), Rich(x)
26. Resolution Refutation: The Inference Rule PL Resolution Rule (R) resolution reminder:
if it's not expensive I can buy it, if I can buy it I'll be happy, deduce: if it's not expensive I'll be happy
GR can equivalently be written as implicationsresolution reminder:
if it's not expensive I can buy it, if I can buy it I'll be happy, deduce: if it's not expensive I'll be happy
GR can equivalently be written as implications
27. Resolution Refutation: GMP Example
28. Resolution Refutation: Proofs Resolution proofs are a refutation technique:
to prove KB¦ a show that KB Ù Øa is unsatisfiable
Resolution refutation repeatedly combinestwo clauses to make a new one untilthe empty clause is derived.
the new clauses are called resolvents
empty clause: False, unsatisfiable, a contradiction
Entailment in FOL is only semidecidable:
can prove a if KB¦ a
cannot always prove that KB doesn't¦ a (halting)
Given a consistent set of axioms KB and query Q, we want to show that KB |= Q. This means that every interpretation I that satisfies KB, satisfies Q. But we know that any interpretation I satisfies either Q or ~Q, but not both. Therefore if in fact KB |= Q, an interpretation that satisfies KB, satisfies Q and does not satisfy ~Q. Hence KB union {~Q} is unsatisfiable, i.e., that it's false under all interpretations.
In other words, (KB |- Q) <=> (KB ^ ~Q |- False)
To show Q is entailed by KB use resolution refutation to show a finite subset of sentences is unsatisfiable.
To show Q isn't entailed by KB use resolution to generate all logical consequences and show Q isn't one of them. In general, it cannot be used to generate all logical consequences of KB. Thus entailment in FOL is only semidecidable.
This is a nuisance since we generally don't know if Q is entailed by KB until it is proved. If a sentence isn't entailed the proof procedure can go on and on (the halting problem)
Note you can't just run two proofs in parallel, one trying to prove Q and the other trying to prove ~Q, since KB might not entail either one.
If you have a KB of sports facts, it won't entail whether or not Picasso is a painter.Given a consistent set of axioms KB and query Q, we want to show that KB |= Q. This means that every interpretation I that satisfies KB, satisfies Q. But we know that any interpretation I satisfies either Q or ~Q, but not both. Therefore if in fact KB |= Q, an interpretation that satisfies KB, satisfies Q and does not satisfy ~Q. Hence KB union {~Q} is unsatisfiable, i.e., that it's false under all interpretations.
In other words, (KB |- Q) <=> (KB ^ ~Q |- False)
To show Q is entailed by KB use resolution refutation to show a finite subset of sentences is unsatisfiable.
To show Q isn't entailed by KB use resolution to generate all logical consequences and show Q isn't one of them. In general, it cannot be used to generate all logical consequences of KB. Thus entailment in FOL is only semidecidable.
This is a nuisance since we generally don't know if Q is entailed by KB until it is proved. If a sentence isn't entailed the proof procedure can go on and on (the halting problem)
Note you can't just run two proofs in parallel, one trying to prove Q and the other trying to prove ~Q, since KB might not entail either one.
If you have a KB of sports facts, it won't entail whether or not Picasso is a painter.
29. Resolution Refutation: Simplified Algorithm //returns true if KB |- q, false otherwise
//KB is a set of consistent, true FOL sentences
//q is the query to be proved
//requires KB and q are in CNF
boolean resolutionRefutation(CNFlist KB, CNFsentence q) {
KB = unionOf(KB, logicalNegationOf(q));
while (False not in KB) {
pick two sentences s1 and s2 in KB with literals that unify // different strategies can limit the choice of s1 and s2
if (none) return false; //failure
CNFsentence resolvent = resolutionRule(s1, s2);
KB = unionOf(KB, resolvent);
}
return true; //success
}
30. Resolution Refutation: Short Example KB:
PhD(x) Þ HighlyQualified(x)
ØPhD(x) Þ EarlyEarnings(x)
HighlyQualified(x) Þ Rich(x)
EarlyEarnings(x) Þ Rich(x)
Prove:KB¦ Rich(Me)
Negate query and convert to CNF.ØRich(Me)
Add query to CNF KB.Must convert KB sentences above into CNF.
Infer a contradiction, i.e., False.
31. Resolution Refutation: Converting KB to CNF Replace implications:
PhD(x) Þ HighlyQualified(x) becomes?
ØPhD(x) Ú HighlyQualified(x)
ØPhD(x) Þ EarlyEarnings(x) becomes?
PhD(x) Ú EarlyEarnings(x)
HighlyQualified(x) Þ Rich(x) becomes…Ø HighlyQualified(x) Ú Rich(x)
EarlyEarnings(x) Þ Rich(x) becomes…Ø EarlyEarnings(x) Ú Rich(x)
In Class Resolution Refutation Example
32. Converting FOL Sentences to CNF Replace Û with equivalent (added step)
convert P Û Q to P Þ Q Ù Q Þ P
Example:
"x,y {Above(x,y) Û (OnTop(x,y) Ú $z{OnTop(x,z) Ù Above(z,y)})}
Becomes?
"x,y {
[ Above(x,y) Þ (OnTop(x,y) Ú $z{OnTop(x,z) Ù Above(z,y)}) ]
Ù
[ (OnTop(x,y) Ú $z{OnTop(x,z) Ù Above(z,y)}) Þ Above(x,y) ]
}
33. Converting FOL Sentences to CNF Replace Þ with equivalentconvert P Þ Q to ØP Ú Q
"x,y {
[ Above(x,y) Þ (OnTop(x,y) Ú $z{OnTop(x,z) Ù Above(z,y)}) ]
Ù
[ (OnTop(x,y) Ú $z{OnTop(x,z) Ù Above(z,y)}) Þ Above(x,y) ]
}
Becomes?
"x,y {
[ ØAbove(x,y) Ú (OnTop(x,y) Ú $z{OnTop(x,z) Ù Above(z,y)}) ]
Ù
[ Ø(OnTop(x,y) Ú $z{OnTop(x,z) Ù Above(z,y)}) Ú Above(x,y) ]
}
34. Converting FOL Sentences to CNF Reduce scope of Ø to single literalsconvert ØØP to P (DNE)convert Ø(P Ú Q) to ØP Ù ØQ (de Morgan's)convert Ø(P Ù Q) to ØP Ú ØQ (de Morgan's)convert Ø"x P to $x ØPconvert Ø$x P to "x ØP
"x,y {
[ ØAbove(x,y) Ú (OnTop(x,y) Ú $z{OnTop(x,z) Ù Above(z,y)}) ] Ù
[ Ø(OnTop(x,y) Ú $z{OnTop(x,z) Ù Above(z,y)}) Ú Above(x,y) ] }
Highlighted part becomes in stages:
(ØOnTop(x,y) Ù Ø$z {OnTop(x,z) Ù Above(z,y)}) (de Morgan's)
"z Ø {OnTop(x,z) Ù Above(z,y)} (Ø$x P to "x ØP)
{Ø OnTop(x,z) Ú Ø Above(z,y)} (de Morgan's)
Highlighted part result:
(ØOnTop(x,y) Ù "z{Ø OnTop(x,z) Ú Ø Above(z,y)})
35. Converting FOL Sentences to CNF Standardize variables aparteach quantifier must have a unique variable namewhich avoids confusion in steps 5 and 6e.g. convert "x P Ú $x Q to "x P Ú $y Q
"x,y {
[ ØAbove(x,y)Ú(OnTop(x,y) Ú $z{OnTop(x,z) Ù Above(z,y)}) ]
Ù
[ (ØOnTop(x,y) Ù "z{ØOnTop(x,z) Ú ØAbove(z,y)}) Ú Above(x,y) ] }
Becomes?
"x,y {
[ ØAbove(x,y) Ú (OnTop(x,y) Ú $z{OnTop(x,z) Ù Above(z,y)}) ]
Ù
[ (ØOnTop(x,y) Ù "w{ØOnTop(x,w) Ú ØAbove(w,y)}) Ú Above(x,y) ] }
36. Converting FOL Sentences to CNF Eliminate existential quantifiers (Skolemize)
convert $x P(x) to P(K) (EE)K must be a new constant (Skolem constant)
convert "x,y $z P(x,y,z) to "x,y P(x,y,F(x,y))F() must be a new function (Skolem function)its arguments are all enclosing universally quantified variables
e.g. Everyone has a name."x Person(x)Þ $y Name(y)Ù Has(x,y)
wrong: "x Person(x)Þ Name(K)Ù Has(x,K)
Everyone has the same name K.
Want everyone to have a name based on who they are.
right: "x Person(x)Þ Name(F(x))Ù Has(x,F(x))
37. Converting FOL Sentences to CNF Eliminate existential quantifiers (Skolemize)
convert "x,y $z P(x,y,z) to "x,y P(x,y,F(x,y))F() must be a new function (Skolem function)its arguments are all enclosing universally quantified variables
"x,y {
[ ØAbove(x,y)Ú(OnTop(x,y) Ú $z{OnTop(x,z) Ù Above(z,y)}) ]
Ù
[ (ØOnTop(x,y) Ù "w{ØOnTop(x,w) Ú ØAbove(w,y)}) Ú Above(x,y) ] }
Becomes?
"x,y {
[ØAbove(x,y)Ú(OnTop(x,y)Ú(OnTop(x,F(x,y))ÙAbove(F(x,y),y)))]
Ù
[ (ØOnTop(x,y) Ù "w{ØOnTop(x,w) Ú ØAbove(w,y)}) Ú Above(x,y) ] }
38. Converting FOL Sentences to CNF Drop quantifiersafter step 5. all variables are universally quantified e.g. convert "x P(x) Ú "y Q(y) to P(x) Ú Q(y)all variables in KB assumed to be universally quantified
"x,y {
[ØAbove(x,y)Ú(OnTop(x,y)Ú(OnTop(x,F(x,y))ÙAbove(F(x,y),y)))]
Ù
[(ØOnTop(x,y) Ù "w{ØOnTop(x,w) Ú ØAbove(w,y)}) Ú Above(x,y)] }
Becomes?
[ØAbove(x,y)Ú(OnTop(x,y)Ú(OnTop(x,F(x,y))ÙAbove(F(x,y),y)))]
Ù
[(ØOnTop(x,y) Ù (ØOnTop(x,w) Ú ØAbove(w,y))) Ú Above(x,y)]
39. Converting FOL Sentences to CNF Distribute Ù over Údone to get conjunction of disjunctionsconvert (P Ù Q)Ú R to (P Ú R)Ù(Q Ú R)
[ØAbove(x,y)Ú(OnTop(x,y)Ú(OnTop(x,F(x,y))ÙAbove(F(x,y),y)))]
Ù
[ (ØOnTop(x,y) Ù (ØOnTop(x,w) Ú ØAbove(w,y))) Ú Above(x,y) ]
Highlighted part becomes in stages:
given A Ú (B Ú (C Ù D))
converts to A Ú ((B Ú C) Ù (B Ú D))
converts to (A Ú (B Ú C)) Ù (A Ú (B Ú D))
Highlighted part result:
[ (ØAbove(x,y) Ú (OnTop(x,y) Ú OnTop(x,F(x,y)))) Ù (ØAbove(x,y) Ú (OnTop(x,y) Ú Above(F(x,y),y))) ]
40. Converting FOL Sentences to CNF Distribute Ù over Údone to get conjunction of disjunctionsconvert (P Ù Q)Ú R to (P Ú R)Ù(Q Ú R)
[ØAbove(x,y)Ú(OnTop(x,y)Ú(OnTop(x,F(x,y))ÙAbove(F(x,y),y)))]
Ù
[(ØOnTop(x,y) Ù (ØOnTop(x,w) Ú ØAbove(w,y))) Ú Above(x,y)]
Highlighted part becomes in stages:
given (A Ù B) Ú C
converts to (A Ú C) Ù (B Ú C)
Highlighted part result:
[ (ØOnTop(x,y) Ú Above(x,y) ) Ù ((ØOnTop(x,w) Ú ØAbove(w,y)) Ú Above(x,y) ) ]
41. Converting FOL Sentences to CNF Flatten nested conjunctions and disjunctionsconvert (P Ù Q)Ù R to (P Ù Q Ù R)convert (P Ú Q)Ú R to (P Ú Q Ú R)
[ (ØAbove(x,y) Ú (OnTop(x,y) Ú OnTop(x,F(x,y)))) Ù (ØAbove(x,y) Ú (OnTop(x,y) Ú Above(F(x,y),y))) ]Ù
[ (ØOnTop(x,y) Ú Above(x,y)) Ù ((ØOnTop(x,w) Ú ØAbove(w,y)) Ú Above(x,y)) ]
Becomes?
(ØAbove(x,y) Ú OnTop(x,y) Ú OnTop(x,F(x,y))) Ù(ØAbove(x,y) Ú OnTop(x,y) Ú Above(F(x,y),y))
Ù
(ØOnTop(x,y) Ú Above(x,y)) Ù(ØOnTop(x,w) Ú ØAbove(w,y) Ú Above(x,y))
42. Converting FOL Sentences to CNF Separate each conjunct (added step)split at Ù's so each conjunct is now a CNF clause
(ØAbove(x,y) Ú OnTop(x,y) Ú OnTop(x,F(x,y))) Ù(ØAbove(x,y) Ú OnTop(x,y) Ú Above(F(x,y),y))
Ù
(ØOnTop(x,y) Ú Above(x,y)) Ù(ØOnTop(x,w) Ú ØAbove(w,y) Ú Above(x,y))
Becomes?
ØAbove(x,y)Ú OnTop(x,y)Ú OnTop(x,F(x,y))ØAbove(x,y)Ú OnTop(x,y)Ú Above(F(x,y),y)ØOnTop(x,y)Ú Above(x,y)ØOnTop(x,w)Ú ØAbove(w,y)Ú Above(x,y)
43. Converting FOL Sentences to CNF Standardize variables apart in each clause (added)
so each clause in KB contains unique variable names
during unification the standardize apart step need only be done on deduced clauses (i.e. resolvents)
ØAbove(x,y)Ú OnTop(x,y)Ú OnTop(x,F(x,y))ØAbove(x,y)Ú OnTop(x,y)Ú Above(F(x,y),y)ØOnTop(x,y)Ú Above(x,y)ØOnTop(x,w)Ú ØAbove(w,y)Ú Above(x,y)
Becomes?:
ØAbove(a,b)Ú OnTop(a,b)Ú OnTop(a,F(a,b))ØAbove(c,d)Ú OnTop(c,d)Ú Above(F(c,d),d)ØOnTop(e,f)Ú Above(e,f)ØOnTop(g,h)Ú ØAbove(h,i)Ú Above(g,i)
44. Resolution Strategies
Resolution refutation proofscan be thought of as search:
reversed construction of search tree (leaves to root)
leaves are KB clauses and Øquery
resolvent is new node with arcs to parent clauses
root is a clause containing False
A search is complete if it guarantees theempty clause can be derived whenever KB¦ q.
45. Resolution Strategies: Idea
Goal is to design a complete searchthat efficiently finds a contradiction(i.e. empty clause, False).
Instead of resolving any two clauses in the KB,we’ll limit the choice to be from some subset of clauses in the KB. Different resolution strategies specify what is in the subset.
46. Resolution Strategies
Breadth First:
level 0 clauses: KB clauses and Øquery
level k clauses: resolvents computed from 2 clauses:
one of which must be from level k-1
other from any earlier level
compute all possible level 1 clauses,then all possible level 2 clauses, etc.
complete but very inefficient
47. Resolution Strategies Unit Preference:
prefer resolutions where 1 sentenceis a single literal, a unit clause
goal is to produce the empty clause,focus search by producing resolvents that are shorter
complete but too slow for medium sized problems
Unit Resolution:
requires at least 1 clause to be a unit clause
resembles forward chaining
complete for FOL KB in HNF
48. Resolution Strategies
Set-of-Support (SoS):
identify some subset of sentences, called SoS
P and Q can be resolved if one is from SoS
resolvent is added to the SoS
common approach:
Øquery is the initial SoS, resolvents are added
assumes KB is true (i.e. consistent, jointly satisfiable)
complete if KB is jointly satisfiable without SoS
49. Resolution Strategies Input Resolution:
P and Q can be resolved if at least one is fromthe set of original clauses, i.e. KB and Øquery
proof trees have a single "spine" (see fig 9.11)
Modus Ponens is a form of input resolutionsince each step a rule (input) is usedto generate a new fact
complete for FOL KB in HNF
Linear Resolution:
a slight generalization of input resolution
P and Q can be resolved if:
at least 1 is from the set of original clauses
or P must be an ancestor of Q in the proof tree
complete
50. Dealing with Equality Limitation of unification:
can't unify different terms that refer to same object
uses syntactic matching
doesn't do semantic test of sameness
Equational Unification axiomizes properties of =:
reflexivity: "x x = x
symmetricity: "x,y x = y Þ y = x
transitivity: "x,y,z x = y Ù y = z Þ x = z
for all Pi "x,y x = y Þ Pi(x) Û Pi(y)
etc…
Terms are unifiable if they're provably equal under some substitution.
51. Dealing with Equality: Paramodulation Another approach is to use a special inference rule:
Paramodulation:
52. Sentences to be paramodulated:
L(v) Ú F(H,v) = F(J,v), M(J) Ú N(F(H,I))
Predicates: L, M, N Function: FVariable: v Constants: H, I, J
x = y is F(H,v) = F(J,v) where x is F(H,v) and y is F(J,v)
mn[z] is N(F(H,I)) where z is F(H,I)
UNIFY(x, z) result in q = {v/I}
SUBST(q, L(v) Ú M(J)Ú N(F(J,v)) results in:L(I) Ú M(J)Ú N(F(J,I)) Dealing with Equality: Paramodulation
53. Summary FOL is a more expressive languagebut inferencing is more complicated
Inferencing in FOL can be done by:
Propositionalizing the FOL KB(universal and existential elimination rules)and using sound inference rules from PL
complete for FOL but impractical
Converting KB to Horn Normal Formand using Generalized Modus Ponens rule
complete for HNF, but not all FOL KBs can be converted to HNF
Converting KB to Conjunctive Normal Formand using Resolution Refutation
complete, all FOL KB can be converted to CNF
54. Summary: Converting FOL Sentences to CNF Replace Û with equivalent (added step)
convert P Û Q to P Þ Q Ù Q Þ P
Replace Þ with equivalent: convert P Þ Q to ØP Ú Q
Reduce scope of Ø to single literals
convert ØØP to P (DNE)
convert Ø(P Ú Q) to ØP Ù ØQ (de Morgan's)
convert Ø(P Ù Q) to ØP Ú ØQ (de Morgan's)
convert Ø"x P to $x ØP
convert Ø$x P to "x ØP
Standardize variables apart
each quantifier must have a unique variable name
avoids confusion in steps 5 and 6
e.g. convert "x P Ú $x Q to "x P Ú $y Q
55. Summary: Converting FOL Sentences to CNF Eliminate existential quantifiers (Skolemize)
convert $x P(x) to P(C) (EE)C must be a new constant (Skolem constant)
convert "x,y $z P(x,y,z) to "x,y P(x,y,F(x,y))F() must be a new function (Skolem function) with arguments that are all enclosing universally quantified variables
Drop quantifiers
all variables are only universally quantified after step 5
e.g. convert "x P(x) Ú "y Q(y) to P(x) Ú Q(y)
all variables in KB will be assumed to be universally quantified
Distribute Ù over Ú to get conjunction of disjunctions
convert(P Ù Q)Ú R to(P Ú R)Ù(Q Ú R)
56. Summary: Converting FOL Sentences to CNF Flatten nested conjunctions and disjunctions
convert (P Ù Q)Ù R to (P Ù Q Ù R)
convert (P Ú Q)Ú R to (P Ú Q Ú R)
Separate each conjunct (added step)
split at Ù's so each conjunct is now a CNF clause
Standardize variables apart in each clause (added step)
each clause in KB must contain unique variable names
now during unification the standardize apart stepneed only be done on deduced clauses (i.e. resolvents)