0% found this document useful (0 votes)
23 views

Lecture10 PDF

This document discusses resolution, which is a complete inference procedure for propositional logic that works by attempting to derive contradictions from a knowledge base. It provides three examples of using resolution to prove conclusions from given premises in first-order logic, including translating the statements to clausal form and performing the resolution proof. Key aspects like Skolemization and handling existential quantifiers are also covered.

Uploaded by

Sia Sia
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Lecture10 PDF

This document discusses resolution, which is a complete inference procedure for propositional logic that works by attempting to derive contradictions from a knowledge base. It provides three examples of using resolution to prove conclusions from given premises in first-order logic, including translating the statements to clausal form and performing the resolution proof. Key aspects like Skolemization and handling existential quantifiers are also covered.

Uploaded by

Sia Sia
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

Lecture 10: Resolution

Artificial Intelligence
CS-6364
Resolution = Refutation

Definition - one complete inference procedure using resolution!


also known as - proof by contradiction
- reductio ad absurdum
➢ The idea: to prove P, assume P is false (i.e. add P
to KB) and prove by contradiction
(KB  P  False)  (KB  P)
Example Proof
Refutation on a more complex example:
In English:
Everyone who loves all animals is loved by someone.
Anyone who kills an animal is loved by no one.
Jack loves all animals.
Either Jack or Curiosity killed the cat who is named Tuna.
Did Curiosity kill the cat?
Translation in FOL
A. x [y Animal(y)  Loves(x, y)] 
[y Loves(y, x)]
B. x [y Animal(y)  Kills(x,y)] 
[z Loves(z,x)]
C. x Animal(x)  Loves(Jack, x)
D. Kills(Jack, Tuna)  Kills(Curiosity, Tuna)
E. Cat(Tuna)
F. x Cat(x)  Animal(x)
G. Kills(Curiosity, Tuna)
Conversion to CNF
A. x [y Animal(y)  Loves(x, y)]  [y Loves(y, x)]
B. x [y Animal(y)  Kills(x,y)]  [z Loves(z,x)]
C. x Animal(x)  Loves(Jack, x)
D. Kills(Jack, Tuna)  Kills(Curiosity, Tuna)
E. Cat(Tuna)
F. x Cat(x)  Animal(x)
G. Kills(Curiosity, Tuna)

A1. Animal(F(x))  Loves(G(x), x)


A2. Loves(x, F(x))  Loves(G(x), x)
B. Animal(y)  Kills(x,y)  Loves(z,x)]
C. Animal(x)  Loves(Jack, x)
D. Kills(Jack, Tuna)  Kills(Curiosity, Tuna)
E. Cat(Tuna)
F. Cat(x)  Animal(x)
G.Kills(Curiosity, Tuna)
Proof
A1.Animal(F(x))  Loves(G(x), x)
A2.Loves(x, F(x))  Loves(G(x), x)
B. Animal(y)  Kills(x,y)  Loves(z,x)]
C. Animal(x)  Loves(Jack, x)
D. Kills(Jack, Tuna)  Kills(Curiosity, Tuna)
E. Cat(Tuna)
F. Cat(x)  Animal(x)
G.Kills(Curiosity, Tuna)
R1: E&F  Animal(Tuna) {x/Tuna}
R2: R1&B  Loves(z, x)  Kills(x, Tuna) {y/Tuna}
R3: D & G Kills(Jack, Tuna)
R4:  Loves(z,Jack) {x/Jack}
R3 & R2
R5: A2 & C Animal(Jack)  Loves(G(Jack), Jack) {x/Jack,
F(x) =Identity_Function}
R6: R5 & A1  Loves(G(Jack), Jack) {x/Jack; F(x) =Identity_Function}
R7: R4 & R6  FALSE {z/G(Jack)}
Resolution Proof
Example 2
In English:
The custom officials searched everyone who entered the
country and was not a VIP. Some of the drug pushers
entered this country and they were only searched by
drug pushers. No drug pusher was a VIP.

At least one of the custom officials was a drug pusher.


Translation in FOL
“The custom officials searched everyone who
entered the country and was not a VIP”
x y (entered_country(x)  VIP(x)) 
(official(y)  searched(y,x))
with VIP(x) - x is a VIP
official(y) - y is a custom official
searched(x,y) x has searched y

“Some of the drug pushers entered this country and


they were only searched by drug pushers”
x y [entered_country(x)  d_pusher(x)] 
[searched(y,x)  d_pusher(y)]
More translations!
“No drug pusher was a VIP”

x [d_pusher(x)   VIP(x)]

Goal: “At least one of the custom officials is a drug


pusher”
x (official(x)  d_pusher(x))
More details
Convert the translation in FOL into CNF:
“The custom officials searched everyone who
entered the country and was not a VIP”
x y (entered_country(x)  VIP(x))  (official(y) 
searched(y,x))
Eliminate ““
x y ((entered_country(x)  VIP(x))  (official(y)
 searched(y,x))
Eliminate Exist. Quantifiers
x (entered_country(x)  VIP(x)  (official(f(x)) 
searched(f(x),x))
Skolem function
The axioms
We obtain the first 2 sentences in CNF:
1. entered_country(x)  VIP(x)  official(f(x))
2. entered_country(x)  VIP(x)  searched(f(x),x)
Next sentence in FOL:
x y [entered_country(x)  d_pusher(x)]  [searched(y,x)
 d_pusher(y)]
eliminate “”
x y [entered_country(x)  d_pusher(x)]  [searched(y,x)
 d_pusher(y)]
Then what? When eliminating the exist. Quantifier:
x=a (a constant) + standardize variables (change y into x)
We obtain the next 3 sentences in CNF:
3. entered_country(a)
4. d_pusher(a)
5. searched(x,a)  d_pusher(x)
Last axioms

From statement x (d_pusher(x)  VIP(x))


6. d_pusher(x)  VIP(x)
Finally:
The goal: x (official(x)  d_pusher(x))
Negated: x (official(x)  d_pusher(x))
Generates the sentence in CNF:
7. official(x)  d_pusher(x)
Axioms in CNF
1. entered_country(x)  VIP(x)  official(f(x))
2. entered_country(x)  VIP(x)  searched(f(x),x)
3. entered_country(a)
4. d_pusher(a)
5. searched(x,a)  d_pusher(x)
6. d_pusher(x)  VIP(x)
7. official(x)  d_pusher(x)
Prove (by refutation)
The refutation
2: entered_country(x)  VIP(x)  searched(f(x),x)

6. d_pusher(x)  VIP(x)
𝜃 = {}
8: d_pusher(x)  entered_country(x)  searched(f(x),x)

4. d_pusher(a)
𝜃 = {𝑥/𝑎}
9: entered_country(a)  searched(f(a),a)
𝜃 = {}
3. entered_country(a)
10: searched(f(a),a)
The refutation-2
1: entered_country(x)  VIP(x)  official(f(x))

6. d_pusher(x)  VIP(x)
𝜃 = {}
11: d_pusher(x)  entered_country(x)  official(f(x))

4. d_pusher(a)
𝜃 = {𝑥/𝑎}
12: entered_country(a)  official(f(a))

3. entered_country(a)
𝜃 = {}
13: official(f(a))
The refutation-3
7: official(x)  d_pusher(x)

4. d_pusher(a)
𝜃 = {𝑥/𝑎}
14: official(f(a))

13. official(f(a))

NIL
The statement in the goal is valid.
Example 3
John likes all kinds of food.
Apple is food.
Chicken is food.
Anything anyone eats and isn’t killed by is food.
Bill eats peanuts and is alive.
Sue eats anything Bill eats.

Show that John likes peanuts.


What food does Sue eat?
Translation in FOL
“John likes all kinds of food.”
x food(x)  likes(John, x)
“Apple is food.” food(Apple)
“Chicken is food.” food(Chicken)
“Anything anyone eats and isn’t killed by is food.”
x y (eats(x,y)   killed(x,y))  food(y)
More translations
“Bill eats peanuts and is alive.”
We need some commonsense knowledge:
I assume alive(x)  y (killed(x,y)) is too
general for the context of the sentence
I prefer the conversion:
eats(Bill,Peanuts)   killed(Bill, Peanuts)
I could have used:
eats(Bill,Peanuts)  x killed(Bill, x)

“Sue eats anything Bill eats.”


x eats(Bill,x)  eats(Sue,x)
Refute “John likes peanuts”
Transformation to CNF:
1. food(x)  likes(John, x)
2. food(Apple)
3. food(Chicken)
4. eats(x,y)  killed(x,y))  food(y)
5. eats(Bill, Peanuts)
6. killed(Bill, Peanuts)
7. eats(Bill,x)  eats(Sue,x)
+Goal: 8. likes(John,Peanuts)
The proof
9. food(Peanuts) from 1&8 𝜃 = {𝑥/𝑃𝑒𝑎𝑛𝑢𝑡𝑠}

10. killed(Bill, Peanuts)  food(Peanuts)


from 4&5 𝜃 = {𝑥/𝐵𝑖𝑙𝑙; 𝑦/𝑃𝑒𝑎𝑛𝑢𝑡𝑠}

11. food(Peanuts) from 6&10 𝜃 = {}

12. NIL from 9&11 𝜃 = {}

 This resolution theorem proving showed that the


clause “John likes peanuts” is valid
“What food does Sue eat?”
We do again theorem proving, changing the goal
clause to:
likes(John, Peanuts)  eats(Sue,z)
Axioms
1. food(x)  likes(John, x)
2. food(Apple)
3. food(Chicken)
4. eats(x,y)  killed(x,y)  food(y)
5. eats(Bill, Peanuts)
6. killed(Bill, x)
7. eats(Bill,x)  eats(Sue,x)
8. likes(John,Peanuts)  eats(Sue,z)
Proof
9. food(Peanuts)  eats(Sue,z)
from 1&8 𝜃 = {𝑥/𝑃𝑒𝑎𝑛𝑢𝑡𝑠}
10. eats(Sue, Peanuts) from 5&7 𝜃 = {𝑥/𝑃𝑒𝑎𝑛𝑢𝑡𝑠}
11. food(Peanuts) from 9&10 𝜃 = {𝑧/𝑃𝑒𝑎𝑛𝑢𝑡𝑠}
12. killed(Bill, Peanuts)  food(Peanuts)
from 4&5 𝜃 = {𝑥/𝐵𝑖𝑙𝑙; 𝑦/𝑃𝑒𝑎𝑛𝑢𝑡𝑠}

13. food(Peanuts) from 6&12 𝜃 = {𝑥/𝑃𝑒𝑎𝑛𝑢𝑡𝑠}


14. NIL from 11&13

From the substitution in 11, we see that


z=Peanuts  Sue eats Peanuts
Another proof
9. food(Peanuts)  eats(Sue,z)
from 1&8 𝜃 = {𝑥/𝑃𝑒𝑎𝑛𝑢𝑡𝑠}
10. killed(Bill, Peanuts)  food(Peanuts)
from 4&5 𝜃 = {𝑥/𝐵𝑖𝑙𝑙; 𝑦/𝑃𝑒𝑎𝑛𝑢𝑡𝑠}

11. food(Peanuts) from 6&10 𝜃 = {𝑥/𝑃𝑒𝑎𝑛𝑢𝑡𝑠}


12. eats(Sue, z) from 9&11 𝜃 = {}
13. eats(Sue, Peanuts) from 5&7 𝜃 = {𝑥/𝑃𝑒𝑎𝑛𝑢𝑡𝑠}
14. NIL from 12&13 𝜃 = {𝑧/𝑃𝑒𝑎𝑛𝑢𝑡𝑠}

eats(Sue, Peanuts)
Answering questions

IMPORTANT: when answering questions that are


not YES/NO questions, the goal needs to have the
negated predication with the argument(s) that will be
substituted by the answer.
Example:
“What food does Sue eat?”
Set the goal to:
8’. x (eats(Sue,x)  eats(Sue,x))
Lessons learned

3 examples
Several kinds of proofs
Formal method of answering questions
Resolution Strategies
➢ Strategies that help find proofs efficiently. We know that repeated
applications of the resolution rule will find the proof if one exists → what
about the efficiency of this process?
▪ We look back at 4 strategies used to guide the search for the proof

➢ Unit Preference
– Prefers sentences that are a single literal (unit clauses)
– The idea is that we are trying to produce an empty clause,
so it might be a good idea to prefer inferences that
produce shorter clauses
– For example, resolving a unit sentence A with any other
sentence B  A  C always yields a shorter clause: B 
C
Set of Support
➢ The set of support is a sub-set of sentences such that
one sentence from this set should be used in each resolution
step! The result of resolution is also added to the set of
support.
– If we chose a set of support that is small enough
when compared with the rest of the KB, the search
space is reduced dramatically.

– Common approach: use the negated query as the


set of support, on the assumption that the
original knowledge base is consistent.
Input Resolution
Every application of resolution combines one of the input
sentences (from the KB or the query) with some other
sentence (generated by a prior application of resolution)

The proof looks like this

Shape of a single spine


With sentences coming in the spine!
Input Resolution
Every resolution combines one of the input
sentences with some other sentences (from
the KB or the query)
P(w)  Q(w) Q(y)  S(y)
{y/w}
P(w)  S(w) P(x)  R(x)
{w/x}
S(x)  R(x) R(z)  S(z)
{z/x}
S(x) S(A)
{x/A}
False
Subsumption
Eliminates all sentences that are subsumed by an
existing sentence in the KB.
For example, if P(x) is in the KB, then there is no
sense in adding P(A) and even less sense in adding
P(A)  Q(B). It helps keep the KB small, and thus
helps keep the search space small.

Subsumption keeps the KB small


Demodulation Rule → the other way
of dealing with equality
Definition: Informally:
For equality x=y
+ any sentence with a nested term
that unifies with x, it derives the
same sentence with y substituted
for the nested term
Formally:
x,y,z where UNIFY(x,z)= :
x=y, (...z ...)
_______________________________
( ...SUBST(,y)... )
Theorem Provers
OTTER (Organized Techniques for Theorem-proving
and Effective Research) (McCune 1992) PROVER 9
In preparing a problem for Otter, the user must divide
the knowledge into four parts:
1. A set of clauses known as the set of support (SoS) which define the
important facts about the problem. Every resolution step resolves a
member of the set of support against another axiom, so the search
is focused on the set of support.
2. A set of usable axioms that are outside the set of support. These
provide background knowledge about the problem area. The
boundary between what is part of the problem and what is
background (thus in usable axioms) is up to the user’s judgment.
3. A set of equations known as rewrites or demodulators.
4. A set of parameters and clauses that defines the control strategy.
The user specifies a heuristic function to control the search and a
filtering function to eliminate some sub-goals as un-interesting.

You might also like