Predicate Resolution RichKnight
Predicate Resolution RichKnight
We could write:
SOCRATESMAN
Plato is a man.
PLATOMAN
which would be a totally separate assertion, and we would not be able to draw any conclusions about similarities
between Socrates and Plato. It would be much better to represent these facts as:
MAN(SOCRATES)
MANPLATO)
STnce now the structure of the representation reflects the structure of the knowledge itself. But to do that, we
needto be able to use predicates applied to arguments. We are in even more difficulty if we try to represent the
cqually classic sentence
MORTALMAN
Artificial Intelligence
100
individual being a man that indivvidual
and that
betwecn any
But that fails to capture
c the relationship
quantification
unless We are wiling to write seno.
paratee sstatemerhein
mortal. To do that, we really necd variables and
about the mortality of every known man.
(or just predicate logic sin gic, since
first-order predicate logic we do
O We be forced to move to
appear to
a way of
representing knowledge beca se t e
discuss higher «order theories in this chapter) as it perm
presentations ofthings that cannot reasonably
be represented in
as wil S.
prepositional logic. In
predicate Iogjc
Can represent real-world facts as statements wrilten
we use logical statemente
at all is that if
logic as
But a major motivation for choosing to use
Pompeian( Marcus)
3. All Pompeians were Romans.
ruler(Caesar)
Here we ignore the fact that proper names are often not
references to unique individuals, since many
people share the same name. Sometimes deciding which of several people of the same name is being
referred to in a particular statement may require a fair amount of
knowledge and reasoning.
5. All Romans were either loyal to Caesar or hated him.
Vx:>y:loyalto(x,y)
A major problem that arises when trying to convert English sentences into logical statements is the
have assumed in writing the logical formula above.
scope of quantifiers. Does this sentence say, as we
ditterent someone for
that for each person there exists someone to whom he or she is loyal, possibly a
would be written
everyone? Or does it say that there exists someone to whom everyone loyal (which
is
seems likely, so people tend to
as 3y: Vx
: loyalto(x,y))? Often only one of the two interpretations
favor it.
7. People only try to assassinate rulers they are not loyal to.
From this brief attempt to convert English sentences into logical statements, it should ho
difficult the task is. For a good deseription of many issues involved in this process, see Reich cleat
see Reichenhagh
1947.
Now suppose that we want to use these statements to answer the question
It seems that using 7 and 8, we should be able to prove that Marcus was not loyal to Caesor
ignoring the distinction between past and present tense). Now let's try to produce a formal a
reasoning backward from the desired goal: formal prosi
loyalto(Marcus, Caesar)
In order to prove the goal, we need to use the rules of inference to transform it into
another goal
possibly a set of goals) that can inturn be transformed, and so on, until there are no unsatisie: (or
remaining. This process may require the search of an AND-OR graph (as described in Sectiongoals 1
when there are alternative ways of satisfying individual goals. Here, for
simplicity, we show onlv.
single path. Figure 5.2 shows an attempt to produce a proof of the goal by reducing the set of necess
but as yet unattained goals to the empty set. The attempt fails, however, since there is no
way to satisi
the goal person (Murcus) with the statements we have available.
The problem is that, although we know that Marcus was a man, we do not have
any way to conclng
from that that Marcus was a person. We need to add the
representation of another fact to our system
namely:
loyalto(Marcus, Caesan
(7, substitution)
person(Marcus)
ruler Caesar)A
tryassassinate(Marcus, Caesar)
(4)
person(Marcus)
tryassassinate{Marcus, Caesa)
1 (8)
person(Marcus)
Fig. 5.2 An Attempt to Prove
-loyalto(Marcus,Caesar)
9. All men are
people
man(x) > person(x)
Now satisfy the last goal and produce a proof that Marcus was not loyal to Caesar.
we can
.Many English sentences are ambiguous (for example, 5, 6, and 7 above). Choosing the core
interpretation may be difficult.
.There is often a choice of how to
represent the knowledge (as discussed in connection with 1, amu
above). Simple representations are desirable, but they
may preclude certain kinds of reasoning. 1
expedient representation for a particular set of sentences depends on the use to which the
contained in the sentences will be put. knowieu
Using Predicate Logic 103
Even 1n very simple situations, a of sentences is unlikely to contain all the information
set
to reason about the
topic at hand. In order to be able to use a set of necessat y
statements effectively, t
usually necessary to have access to another set of
statements that represent facts that people costuc
too obvious to mention. We discuss
this issue further
in Section 10.3.
An additional problem arises in
situations where we do not know in advance which statements to
In the example just presented, the object was to answer the question "Was Marcus loyal to Caesardecauce
How
would a program decide whether it should try to prove
lovalto(Marcus; Caesar)
-lovalto(Marcus, Caesa)
There are several things it could do. It could abandon the strategy we have outlined of reasoning backward
from a proposed truth to the axioms and instead try to reason forward and see which answer it gets to. The
problem with this approach is that, in general, the branching factor going forward from the axioms is so great
that it would probably not get to either answer in any reasonable amount of time. A second thing it could do
is use some sort of heuristic rules for deciding which answer is more likely and then try to prove that one first
If it fails to find a proof after some reasonable amount of effort, it can try the other answer. This notion of
limited effort is important, since any proof procedure we use may not halt if given a nontheorem. Another
thing it could do is simply try to prove both answers simultaneously and stop when one effort is successiui.
Even here, however, if there is not enough information available to answer the question with certainty, the
program may never halt. Yet a fourth is to try both to prove one answer and to disprove it. and to use
strategy
information gained in one of the processes to guide the other.
man(Marcus)
2. Pompeian(Marcus)
VA: Pompeian(x) Ronanx)
3
ruler(Caesar)
: Roman(x) > loyalto(x, Caesar) V hate(x, Caesar)
1 instance( Marcus, man)
2. instance(Marcus, Pompeian)
instance(x, Roman)
3 Vx: instancelx, Pompeian)
4 instance(Caesar, ruler)
5. Vx: instance(x, Roman) loyalto(x, Caesan V hate(x, Caesan
1. instance(Marcus, man)
2 instance(Marcus, Pompeian)
3. isa(Pompeian, Roman)
instance(Caesar, rulen
5. Vx: instance(x, Roman) loyalto(x, Caesa) V hate(x, Caesan
6. Vx: y: Vz: instance(x, y) N isa(y, 2) > instancelx, )
Fig. 5.3 Three Ways of Representing Class Membership
These examples illustrate two points. The first is fairly specific. It is that, although class and superc
memberships are important facts that need to be represented, those memberships need not be represented with
predicates labeled instance and isa. In fact, in a logical framework it is usually
unwieldy to do that, ani
instead unary predicates
corresponding to the classes are often used. The second point is more general. The
are
usually several different ways of representing a given fact within a particular representational
be it logic or anything else. The choice framewo
depends partly on which deductions need to be supported mos
efficiently and partly on taste. The only important thing is that within a particular knowledge base
of representation is critical. Since consistency
any particular inference rule is designed to work on one
representation. it is necessary that all the knowledge to which that rule is intended to particular fom of
the rule demands. apply be in the form tha
Many errors in the reasoning performed by knowledge-based
inconsistent representation decisions. The moral is programs are the result of
There is one additional
simply to be careful.
point that needs to be made here on the subject of the use of isa hierarchies in
based systems. The reason that these logie
hierarchies are so important is not that
superclass membership. It is that by permitting the inference of they permit the inference o
of other properties associated with superclass membership,
they permit the inferent
membership
base it is important to be able to conclude that
in that
superclass. So, for example, our sample knoweug
in
Marcus is a Roman because
have some relevant we
about Romans, namely that
they either hate Caesar or are loyal knowic
him. But recall that in the bascball exampe
to
of Chapter 4, we were able associate knowledge with
to
specific knowledge associated superclasses that could then be overridden by nu
either with individual instances or
with subclasses. In other words, we
default values that could be accessed whenever
necessary. For example, there was a
recotu th
adult males and a different height associated with
baseball players. Our height associaleu
hierarchy guaranteed hal we always found the correct (i.e., most procedure for manipulating tne
reproducing this result in logic is difficult. specific) value for any attribute. Untortuna
Suppose, for example, that, in addition to the facts we
already have, we add the following.
Pompeian(Paulus)
loyalto(Paulus, Caesar) V hate(Paulus, Caesar)
I
For convenience, we now return to our
original notation using
unary predicates to denote class relations.
Using Predicate Logic 105
In other words, supPpose we want to make Paulus an exception to the general rule about Romans and their
feelings toward Caesar. Unfortunately, we cannot simply add these facts to our existing knowledge base the
way we could just add new nodes into a semantic net. The difficulty is that if the old assertions are lett
unchanged, then the addition of the new assertions makes the knowledge base inconsistent. In order to restore
consistency t 1s necessary to modify the original assertion to which an exception is being made. So our
original sentence 5 must become:
In this framework, every exception to a general rule' must be stated twice, once in a particular statement
and once in an exception list that forms part of the general rule. This makes the use of general rules in this
framework less convenient and less efficient when there are exceptions than is the use of general rules in a
semantic net.
A further problem arises when infomation is incomplete and it is not possible to prove that no exceptions
apply in a particular instance. But we defer consideration of this problem until Chapter 7.
tryassassinate(Marcus, Caesar)
For one
the representation of each of these facts individually.
Clearly we do not want to have to write
out
number of them that can be
there are infinitely many of them.
But even if we only consider the finite
thing, inefficient to store explicitly
machine word per number, it would be extremely
represented, say, using a single one as we need it. Thus it
becomes
instead, so easily compute each
a large set of statements when we could,
Whatever proof procedure we use
our representation by these computable predicates.
useful to augment in the database or attempting
instead of searching for it explicitly
when it comes upon one of these predicates, which we will specify in addition to our
can simply invoke a procedure,
to deduce it by further reasoning, we
g(2+3,1)
of the plus function given the arguments 2 and 3, and then
first compute the value
To do so requires that we
man(Marcus)
Again we ignore the issue of tense.
2. Marcus was a Pompeian.
Pompeian(Marcus)
3. Marcus was born in 40 A.D.
born(Marcus, 40)
For simplicity, we will not represent A.D. explicitly, just as we normally omit it in everyday discussione
If we ever need to represent dates B.C., then we will have to decide on a way to do that, such as by usin
negative numbers. Notice that the representation of a sentence does not have to look like the sentence itself
as long as there is a way to convert back and forth between them. This allows us to choose a
representation, such as positive and negative numbers, that is easy for a program to work with.
4. All men are mortal.
now = l991
Here we will exploit the idea of equal quantities that can be substituted for each other.
Now suppose we want to answer the question "Is Marcus alive?" A quick glance through the statemeu
we can show that Mar
we have suggests that there may be two ways of deducing an answer. Either ould
is dead because he was killed by the volcano or we can show that he must be dead because he wo
w
otherwise be more than 150 years old, which we know is not possible. As soon as we attempt to rou
Using Predicate Logic 107
either of those paths rigorously, however, we discover, just as we did in the last example, that we need
some additional knowledge. For example, our statements talk about dying, but they say nothing that
relates to being alive, which is what the question is asking. So we add the following facts:
8. Alive means not dead.
available.
want to reduce all time statements to that level
of detail, which is unnecessary and often not
is given in Fig. 5.4. (The nunmbering is changed
A summary of all the facts we have now represented
two parts.) Now let's attempt to answer
the question "Is Marcus
sightly because sentence 5 has been split into
alive? by proving:
alive(Marcus, now)
aAb> c
borm(Marus, 1)
but then must also bind A to 40 in
using statement 3 by bindingA to 40, we
gnow-I, 150)
Since the two ' s were the sanme variable in statement 4, from which the two goals came. A good comDta
proof procedure has to include both a way of determining that a match exists and a way of guarante utational
uniform substitutions throughout a proof. Mechanisms for doing both those things are discussed belou eing
-alive(Marcus, now)
(9, substitution)
dead(Marcus, now)
T (10, substitution)
died(Marcus, t1) A gtnow, 1)
(5, substitution)
Pompeian( Marcus) A gt(now, 79)
(2)
gttnow, 79)
(8, substituté equals)
gt(1991,79)
(compute gt
nil
From looking at the proofs we have just shown, two things should be clear:
Even very simpleconclusions can require many steps to prove.
A variety of processes, such as matching, substitution, and application of modus ponens are involved
in the production of a proof. This is true even for the simple statements we are using. It would be wonse
if we had implications with more than a single term on the right or with complicated expresions
involving amis and ors on the left.
The first of these observations suggests that if we want to be able to do nontnvial reasoning. we are going
to need some statements that allow us to take bigger steps along the way. These should represent the facts thal
people gradually acquire as they become experts. How to get computers to acquire them is a hard problem tor
which no very good answer is known.
The second observation suggests that actually building a program to do what people do in producing
proofs such as these may not be easy. In the next section, we introduce a proof procedure called resoluion thau
reduces some of the complexity because it operates on statements that have first been converted to a single
canonical form.
5.4 RESOLUTION
As we suggest above, it would be useful froma computational point of view ff we had a proof procedurent
carried out in a single operation the variety of processes involved in reasoning with statements in predica
logic. Resolution is such a procedure, which gains its efficiency from the fact that it operates on statemen
that have been converted to a very convenient standard form, which is described below.
Using Predicate Logic 109
alive(Marcus, nowM
(9, substitution)
dead Marcus, now)
(7, substitution)
morta( Marcus)
born(Marcus, t,)
gtnow-, 150)
(4, substitution)
man(Marcus)
born(Marcus, t,) A
gtnow t, 150)
(1)
born(Marcus, t,)
gttnow t, 150)
(3)
gttnow-40,150)
(8)
gt(1991-40,150)
(compute minus)
gt(1951,150)
T (compute gt)
nil
form, we lose no
110
wff into
conjunctive
only
normal
on
wff's this
in thi form. generality
fact, for
ac
any set of cla
onverting
that
operates
Wit s to a auses
tor A. We where
Since there exists an algorith of
resoltion)
reduce a set
as to of the connect
ifwe employ a proofprocedure (suchstep one
further.
We need
part each such e
apa. but with no
instances
can do
resolution to work, we need
n c e d to
to go form
then breaking
together as i
normal
conjunctive form and
a clause is defined to be a wff in
conjoined
normal
to be
this first each wff into
conjunctive
will be
considered
nce of steps.
by nverting
All the conjuncts the
following
sequence
equivalent to
b is
using
>, the fact that a
* nate
wff given above yields
aA-b], and
the standard t r a n s t o r m a t i o n on the wfff.
untifiers
that-(ab) a V a b a n d - ( a yb)= -P(x)]. Performing this from
Vr:
-Pt) and -3x: Px)
=
r : P(x) =3x:
step 1 yields
would be converted to
3y: President(y)
can be transformed into the formula
President(S1)
Using Predicate Logic 111
where SI is a function with no
arguments that
If existential quantifiers occur within the
somehow produces value that satisfies President.
a
scope of universal quantifiers, then the value that satisfies the
predicate may depend on the values of the universally quantified variables. For example, in the formula
V:3y:father-of (y.x)
the value of y that satisfies
father-of depends on the particular value ofx. Thus we must
functions with the same number of generate
arguments as the number of universal quantifiers in whose
the expression occurs. So this scope
example would be transformed into
Vx:father-of$2(x),x)
These generated functions are called Skolem functions. Sometimes ones with no
arguments are called
Skolem constants.
6. Drop the
prefix. At this point, all remaining variables are universally
bedropped and any proof procedure we use can simply assume that any quantified, so the prefix can just
variable it sees is universally
quantified. Now the formula produced in step 4 appears as
Roman() V-know(x, Marcus)]v
hate(x, Caesar) V (-hate(y, 2) V thinkcrazylx, yM
7. Convert the matrix into
conjunction of disjuncts. In the case of our example, since there are no and's,
a
it is only necessary to
exploit the associative property of or [i.e., (aAb) vc (av c) A (bA c] and =
Thus since each clause is a separate conjunct and since all the variables are universally quantifi
there need be no relationship between the variables of two clauses, even if they were generated fr
the same wff. from
Performing this final step of standardization is important because during the resolution procedure it:
is
sometimes necessary to instantiate a universally quantified variable (i.e., substitute for it a particular value
e)
But, in general, we want to keep clauses in their most general form as long as possible. So when a variable i
instantiated, we want to know the minimum number of substitutions that must be made to preserve the tn
h
value of the system.
Afier applying this entire procedure to a set of wff's, we will have a set of clauses, each of which is a
disjunction of literals. These clauses can now be exploited by the resolution procedure to generate proofs.
winter V summer
winter V cold
Recall that this means that both clauses must be true (i.e., the clauses, although they look independent, are
really conjoined).
Now we observe that precisely one of winter and Twinter will be true at any point. If winter is true, then
cold must be true to guarantee the truth of the second clause. If winter is true, then summer must be true to
guarantee the truth of the first clause. Thus we see that from these two clauses we can deduce
SummerV cold
This is the deduction that the resolution procedure will make. Resolution operates by taking two clauses
that each contain the same literal, in this example, winter. The literal must occur in positive form in one clause
and in negative form in the other. The resolvent is obtained by combining all of the literals of the two parent
clauses except the ones that cancel
If the clause that is produced is the empty clause, then a contradiction has been found. For example, ne
two clauses
winter
Winter
will produce the empty clause. If a contradiction exists, then eventually it will be found. Of course it D
re
contradiction exists, it is possible that the procedure will never terminate, although as we will see, there
often ways of detecting that no contradiction exists.
So far, we have discussed only resolution in prepositional logic. In predicate logic, the situation 18
complicated since we must consider all possible ways of substituting values for the variables. The theorelu
tells
basis of the resolution procedure in predicate logic is Herbrand's theorem [Chang and Lee, 1973], which e
us the following:
Using Predicate Logic 113
.To show that a set of clauses S is unsatisfiable, it is necessary to consider only interpretations over a
particular set. called the Herbrand universe of S.
.A set of clauses S is
unsatistiable if and only if a finite subset of
ground instances (in which all bound
variables have had a value substituted for them) of S is unsatisfiable.
The second part of the theorem is important if there is to exist any
computational infinite set.
unsatisfiability. since in a finite amount of time no proccdure will be able to examine anprocedure
for proving
The first
nart suggests that one way to go about finding a conradiction is to try syslematically the possible substitutions
and see if each produces a contradiction. But that is highly inefficient. The resolution principle, first introduced
by Robinson |19651. provides a way,of finding contradictions by trying a minimum number of substitutions.
The idea is-to keep clauses in heir general form as long as possible and only introduce specific substitutions
when they are required. For more details on different kinds of resolution, see Stickel [ 19881.
Then we negate R, producing -R, which is already in clause form. Then we begin selecting pairs of clauses to
resolve together. Although any pair of clauses can be resolved, only those pairs that contain complementary
literals will produce a resolvent that is likely to lead to the goal of producing the empty clause (shown as a
DOX). We might, for example, generate the sequence of resolvents shown in Fig. 5.8. We begin by resolving
with the clause -R since that is one of the clauses that must be involved in the contradiction we are trying to
find.
Artificial Intelligence
114
that are
PV -QvR
ofclauses
takes a set
is that it il generates R
One way of viewing the resolution
process
by the others,
information provided
all assumed to be true and, based on of those original
clauses
Pv-Q
on the way each r e s t r i c t e d that
represent restrictions so
at clause
becomes
-TvQ
Can
can bbe made true.A contradiction occurs
when a
generation
of the empty
the
there is no way it can be true. This is indicated by In order for proposition
look again at the example.
how this works, let 's we are assuming
duse. 1o see or R. But
be true: --P -0, of
2 to be true for one
rue., one of three things
must is
De for proposition But Fig. 5.8 Resolution
true. Given that, the only way resolvent clause says.
is first
WO things to be true: P or -0. That is
shown in
Propositiona
Logic
POposition I says for -Q to be true (as
n e second resolvent clause). Proposition
for proposition 2 to be true,4 namely
can be true if either - T or Q 1s true. But since we now knovent).
y one way third resoluen
for -T to be true (the
4 to be true is
clauses to be true in a single interoret
for proposition
m u s t be true, the only way
Tis true. Thus there is no way for
all of these pretation
proposition 5 says that
This is indicated bythe clause (the last resolvent).
empty
tryassassinate(Marcus, Caesar)
hate(Marcus, Caesar)
Px,x)
Py)
a they
fine, Next and y, and decide that if we substitute y for
The two instances of P match
we compare x
y/.x
Using Predicate Logic 115
(We could, of course, have decided instead to substitute x for y, since they are both just dummy variable
names. The algorithm will simply pick one of these two substitutions.) But now, if we simply continue and
match x and z. we produce tne substitution / . But we cannot substitute bothy and z for x, so we have not
a consistent substitution.
produced
What we need to do after finding the first substitutiony/t is to make that substitution throughout the literals,
giving
P% y)
P%. 3)
Now we can attempt to unify arguments v and z, which succeeds with the substitution dy. The entire
unification process has now succeeded with a substitution that is the composition of the two substitutions
we
(7)(/r)
following standard notation for function composition. In general, the substitution (a/a2, ayd4, ...)6,/b2,
take the result and apply all the ones
b/ba.)..means to apply all the substitutions ofthe right- most list, then
of the next list, and so forth, until, all substitutions have been applied.
literals to
of the unification procedure is to discover at least one substitution that causes
two
The object
match. Usually, if there is one such substitution there are many. For example, the literals
hate(r, y)
hate(Marcus, z)
(Marcus/x,)
(Marcus/x,y/2)
Marcus/x, Caesar/y, Caesar/z)
Marcus/x,Polonius/y, Polonius/2)
If we accepted g(x) as a substitution for x, then we would have to substitute it for x in the remainder of the
expressions. But this leads to infinite recursion since it will never be possible to eliminate x.
Unification has deep mathematical roots and is a useful operation in many Al programs, for example.
theorem provers and natural language parsers. As a result, efficient data structures and algorithms for unification
have been developed. For an introduction to these techniques and applications, see Knight [19891.
hate(Marcus,Caesar)
118 Artificial Intelligence
(b)
Fig. 5.9 A Resolution Proof
Of course, many resolvents could have been generated than we have shown, but we used the
more
heurisacs
described above to guide the search. Notice that what we have done here essentially is to reason backwand
from the statement we want to show is contradiction
a
through a set of intermediate conclusions to the
nul
conclusion of inconsistency.
Suppose ouf actual goal in proving the assertion
hate(Marcus, Caesar)
was to answer the question "Did Marcus hate Caesar?" In that case, we might just as easily have attenmpted
prove the statement
hate(Marcus, Cuesar)