Resolution

advertisement
Resolution
And yet Another Example:
Resolving P  Q  R with P  W  Q  R
• on Q yields P  R  R  W, which is True.
• on R yields P  Q  Q  W, which is also True.
You cannot resolve on Q and R simultaneously!
Note:
• Any set of wffs containing  and   is unsatisfiable,
i.e. if one wff is the negation of another wff in that set,
it is impossible that all wffs in that set are true.
• Any clause that contains  and  has value True
regardless of the value of .
March 8, 2016
Introduction to Artificial Intelligence
Lecture 13: Knowledge Representation & Reasoning II
1
Converting wffs to Conjunctions of Clauses
Resolution is a powerful tool for algorithmic inference,
but we can only apply it to conjunctions of clauses
(conjunctive normal form, CNF).
So is there a way to convert any wff into such a
conjunction of clauses?
Fortunately, there is such a way, allowing us to apply
resolution to any wff.
March 8, 2016
Introduction to Artificial Intelligence
Lecture 13: Knowledge Representation & Reasoning II
2
Converting wffs to Conjunctions of Clauses
Example: (P  Q)  (R  P).
Step 1: Eliminate implication operators:
(P  Q)  (R  P)
Step 2: Reduce the scopes of  operators by using
DeMorgan’s laws and eliminating double  operators:
(P  Q)  (R  P)
Step 3: Convert to CNF by using the associative and
distributive laws:
(P  R  P)  (Q  R  P), and then
(P  R)  (Q  R  P)
March 8, 2016
Introduction to Artificial Intelligence
Lecture 13: Knowledge Representation & Reasoning II
3
Resolution Refutations
Resolution is a sound rule of inference, but it is not
complete.
For example, PR = PR, but the resolution rule
does not allow us to infer PR from {P}, {R}.
However, we can use resolution to show that the
negation of PR is inconsistent with {P}, {R} and
thereby showing that PR = PR.
The negation of PR is P  R.
Conjunctively combining all clauses results in
P  R  P  R.
This resolves to the empty set, so by contradiction we
have indirectly shown that PR = PR.
March 8, 2016
Introduction to Artificial Intelligence
Lecture 13: Knowledge Representation & Reasoning II
4
More Explanation of Resolution Refutations
You have a set of hypotheses h1, h2, …, hn, and a
conclusion c.
Your argument is that whenever all of the h1, h2, …,
hn are true, then c is true as well.
In other words, whenever all of the h1, h2, …, hn are
true, then c is false.
If and only if the argument is valid, then the
conjunction h1  h2  …  hn  c is false, because
either (at least) one of the h1, h2, …, hn is false, or if
they are all true, then c is false.
Therefore, if this conjunction resolves to false, we
have shown that the argument is valid.
March 8, 2016
Introduction to Artificial Intelligence
Lecture 13: Knowledge Representation & Reasoning II
5
Resolution Refutations
The following statements about resolution refutation
are true (see p. 234 for references to proof):
• Completeness of resolution refutation: For a set of
wffs  and a wff , if  = , then resolution
refutation will produce the empty clause. This
means that propositional resolution is refutation
complete.
• Decidability of propositional calculus by resolution
refutation: if  is a finite set of clauses and if   ,
then resolution refutation will terminate without
producing the empty clause.
March 8, 2016
Introduction to Artificial Intelligence
Lecture 13: Knowledge Representation & Reasoning II
6
Resolution Refutations
Example:
“Gary is intelligent or a good actor.
If Gary is intelligent, then he can count
from 1 to 10.
Gary can only count from 1 to 2.
Therefore, Gary is a good actor.”
Propositions:
I: “Gary is intelligent.”
A: “Gary is a good actor.”
C: “Gary can count from 1 to 10.”
March 8, 2016
Introduction to Artificial Intelligence
Lecture 13: Knowledge Representation & Reasoning II
7
Resolution Refutations
Hypotheses:
I  A, I  C, C
In CNF: (I  A)  (I  C)  C
Conclusion:
A
Conjunction of Clauses for Resolution Refutation:
(I  A)  (I  C)  C  A
March 8, 2016
Introduction to Artificial Intelligence
Lecture 13: Knowledge Representation & Reasoning II
8
Resolution Refutations
(I  A)  (I  C)  C  A
Resolution on A:
I  (I  C)  C
Resolution on I:
C  C
Resolution on C:
False
Therefore, the initial set of clauses is inconsistent,
and the conclusion is correct: Gary is a good actor.
March 8, 2016
Introduction to Artificial Intelligence
Lecture 13: Knowledge Representation & Reasoning II
9
Resolution Refutations
Another Example:
“If Jim visits a pub on Thursday, he is late for work on
Friday.
If Jim is late for work on Friday, he has to work during
the weekend.
Jim had to work during the weekend.
Therefore, Jim visited a pub on Thursday.”
Propositions:
T: “Jim visits a pub on Thursday.”
F: “Jim is late for work on Friday.”
W: “Jim has to work during the weekend.”
March 8, 2016
Introduction to Artificial Intelligence
Lecture 13: Knowledge Representation & Reasoning II
10
Resolution Refutations
Hypotheses:
T  F, F  W, W
In CNF: (T  F)  (F  W)  W
Conclusion:
T
Conjunction of Clauses for Resolution Refutation:
(T  F)  (F  W)  W  T
March 8, 2016
Introduction to Artificial Intelligence
Lecture 13: Knowledge Representation & Reasoning II
11
Resolution Refutations
(T  F)  (F  W)  W  T
Resolution on F:
(T  W)  W  T
Simplification:
W  T
No further resolution is possible.
Therefore, the argument is invalid and the conclusion
that Jim went to a pub on Thursday is incorrect.
(He could have been forced to work during the
weekend for other reasons.)
March 8, 2016
Introduction to Artificial Intelligence
Lecture 13: Knowledge Representation & Reasoning II
12
Propositional Calculus
You have seen that resolution, including resolution
refutation, is a suitable tool for automated reasoning
in the propositional calculus.
If we build a machine that represents its knowledge
as propositions, we can use these mechanisms to
enable the machine to deduce new knowledge from
existing knowledge and verify hypotheses about the
world.
However, propositional calculus has some serious
restrictions in its capability to represent knowledge.
March 8, 2016
Introduction to Artificial Intelligence
Lecture 13: Knowledge Representation & Reasoning II
13
Propositional Calculus
In propositional calculus, atoms have no internal
structure; we cannot reuse the same proposition for
a different object, but each proposition always refers
to the same object.
For example, in the toy block world, the propositions
ON_A_B and ON_A_C are completely different from
each other.
We could as well call them PETER and BOB instead.
So if we want to express rules that apply to a whole
class of objects, in propositional calculus we would
have to define separate rules for every single object
of that class.
March 8, 2016
Introduction to Artificial Intelligence
Lecture 13: Knowledge Representation & Reasoning II
14
Predicate Calculus
So it is a better idea to use predicates instead of
propositions.
This leads us to predicate calculus.
Predicate calculus has symbols called
• object constants,
• relation constants, and
• function constants
These symbols will be used to refer to objects in the
world and to propositions about the word.
March 8, 2016
Introduction to Artificial Intelligence
Lecture 13: Knowledge Representation & Reasoning II
15
Components
Object constants:
Strings of alphanumeric characters beginning with
either a capital letter or a numeral.
Examples: XY, George, 154, H1B
Function constants:
Strings of alphanumeric characters beginning with a
lowercase letter and (sometimes) superscripted by
their “arity”:
Examples: fatherOf1, distanceBetween2
March 8, 2016
Introduction to Artificial Intelligence
Lecture 13: Knowledge Representation & Reasoning II
16
Components
Relation constants:
Strings of alphanumeric characters beginning with a
capital letter and (sometimes) superscripted by their
“arity”:
Examples: BeatsUp2, Tired1
Other symbols:
Propositional connectives , , , and , delimiters
(, ), [, ], and separator ,.
March 8, 2016
Introduction to Artificial Intelligence
Lecture 13: Knowledge Representation & Reasoning II
17
Terms
• An object constant is a term.
• A function constant of arity n, followed by n terms in
parentheses and separated by commas, is a term.
Examples: fatherOf(George), times(3, minus(5, 2))
March 8, 2016
Introduction to Artificial Intelligence
Lecture 13: Knowledge Representation & Reasoning II
18
Wffs
Atoms:
• A relation constant of arity n followed by n terms in
parentheses and separated by commas is an atom.
An atom is a wff.
• Examples: Tired(John), OlderThan(Hans, Peter)
Propositional wffs:
• Any expression formed out of predicate-calculus
wffs in the same way that the propositional calculus
forms wffs out of other wffs is a propositional wff.
• Example: OlderThan(John, Peter) 
OlderThan(Peter, Jennifer)
March 8, 2016
Introduction to Artificial Intelligence
Lecture 13: Knowledge Representation & Reasoning II
19
Interpretations
An interpretation of an expression in the predicate
calculus is an assignment that maps
• object constants into objects in the world,
• n-ary function constants into n-ary functions,
• n-ary relation constants into n-ary relations.
These assignments are called the denotations of
their corresponding predicate-calculus expressions.
March 8, 2016
Introduction to Artificial Intelligence
Lecture 13: Knowledge Representation & Reasoning II
20
Interpretations
Example: Blocks world:
B
A
C
Floor
Predicate Calculus
A
B
C
Fl
On
Clear
March 8, 2016
World
A
B
C
Floor
On = {<B,A>, <A,C>, <C, Floor>}
Clear = {<B>}
Introduction to Artificial Intelligence
Lecture 13: Knowledge Representation & Reasoning II
21
Quantification
Introducing the universal quantifier  and the
existential quantifier  facilitates the translation of
world knowledge into predicate calculus.
Examples:
Paul beats up all professors who fail him.
x(Professor(x)  Fails(x, Paul)  BeatsUp(Paul, x))
There is at least one intelligent UMB professor.
x(UMBProf(x)  Intelligent(x))
March 8, 2016
Introduction to Artificial Intelligence
Lecture 13: Knowledge Representation & Reasoning II
22
Homework!
a) There are no crazy UMB students.
x (UMBStudent(x)  Crazy(x))
b) All computer scientists are either rich or crazy, but not both.
c) All UMB students except one are intelligent.
d) Jerry and Betty have the same friends.
e) No mouse is bigger than an elephant.
March 8, 2016
Introduction to Artificial Intelligence
Lecture 13: Knowledge Representation & Reasoning II
23
Download