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

Predicate Resolution RichKnight

The document discusses the limitations of propositional logic in representing real-world knowledge and introduces predicate logic as a more effective alternative. It highlights the importance of using predicates and quantifiers to capture relationships and properties of objects, as well as the challenges in converting English sentences into logical statements. Additionally, it addresses the complexities involved in reasoning with these logical representations, including ambiguity and the need for additional knowledge to draw conclusions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Predicate Resolution RichKnight

The document discusses the limitations of propositional logic in representing real-world knowledge and introduces predicate logic as a more effective alternative. It highlights the importance of using predicates and quantifiers to capture relationships and properties of objects, as well as the challenges in converting English sentences into logical statements. Additionally, it addresses the complexities involved in reasoning with these logical representations, including ambiguity and the need for additional knowledge to draw conclusions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Using Predicate Logic 99

5.1 REPRESENTING SIMPLE FACTS IN LOGIC


et's first explore the use of propositional logic as a way of representing the sort of world knowledge that an
Let
Al system might need. PropOsitional logic is appealing because it is simple to deal with and a decision procedure
for it exists. We can casily represent real-world facts as logical propositions written as well-formed formulas
(wff'3) in propositional logic, as shown in Fig. 5.1. Using these propositions, we could, for example, conclude
from the fact that it is raining the fact that it is not sunny. But very quickly we run up against the limitations of
propositional logic. Suppose we want to represent the obvious fact stated by the classical sentence
It is raining.
RAINING
It is sunny.
SUNNY
It is windy.
WINDY
If it israining, then it is not sunny.
RAINING SUNNY
Fig. 5.1 Some Simple Facts in Prepositional Logic
Socrates is a man.

We could write:

SOCRATESMAN

But if we also wanted to represent

Plato is a man.

we would have to write something such as:

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

All men are mortal.

We could represent this as:

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

have available a good way of reasoning


With that knowledge Day
epresenting knowledge. then we
although it may be com i
the validity of a proposition in propositional logic is straightforward,
So before we adopt predicate logic as a good medium
for representing knowledge, we naneed t nall
Kio
hard.
whether it also provides a good way of reasoning with the knowledge. At first glance, the answer:
ones. Unfortunately, however, unlike nron
provides a way of deducing new statements from old one. There do exist proceduree
does not possess a decision procedure, even an exponential
C.it
find a proof of a proposed theorem if indeed it is a theorem. But these proceduresare not guaranteed tohal
the proposed statement is not a theorem. In other words, although first-order predicate logic is not deicidable
it is semidecidable. A simple such procedure is to use the rules of inference to generate theorem's from t
axioms in some orderly fashion, testing each to see if it is the one for which a proof is sought. This method
hod is
not particularly efficient, however, and we will want to try to find a better one.
Although negative results, such as the fact that there can exist no decision procedure for predicate lopi
generally have litle direct effect on a science such as Al, which seeks positive methods for doing things,t
particular negative result is helpful since it tells us that in our search for an efficient proof procedure, s
should be content if we find one that will
prove theorems, even if it is not guaranteed to halt if given a
nontheorem. And the fact that there cannot exist a decision
procedure that halts on all possible inputs does na
mean that there cannot exist one that will halt on almost all the
inputs it would see in the process of tuying
solve real problems. So despite the theoretical
undecidability predicate logic, it can still serve as a usefu
of
way of representing and manipulating some of the kinds of knowledge that an Al system might need.
Let's now explore the use of
predicate logic as a way of representing knowledge by looking at a speciñic
example. Consider the following set of sentences:
1. Marcus was a man.
2. Marcus was a
Pompeian.
3. All Pompeians were Romans.
4. Caesar was a ruler.
5. All Romans either
were loyal to Caesar or hated him.
6. Everyone is loyal to someone.
7. People only try to assassinate rulers they
8. Marcus tried
are not loyal to.
to assassinate Caesar.
The facts described by these sentences be
1. Marcus was a man.
can
represented as a set of wff's in predicate logic as
follows
man(Marcus)

This representation captures the eritical fact of' Marcus


being a man. lt fails to capture some ot he
information in the English sentence, namely the notion of past tense.
Whether this omission is acceptabl
or not depends on the use to which we intend to
put the knowledge.
For this
all right. simple exanmple, it wil
Using Predicate Logic 101
2. Marcus was a Pompeian.

Pompeian( Marcus)
3. All Pompeians were Romans.

Vx: Pompeian(t) >


Roman(x)
4. Caesar was a ruler.

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.

Vr: Roman(r)> loyalto(x, Caesar) V hatelr. Caesar)


In Engish, the word "or" sometimes means the logical inclusive-or and sometimes means the logical
exclusive-or (XOR). Here we have used the inclusive interpretation. Some people will argue. however.
that this English sentence is really stating an,exclusive-or. To express that, we would have to write:

Vx: Romman(r) > [(loyal to(x, Caesar) V hatelr, Caesar)) A


-loyalto(x, Caesar) A hatelx, Caesar)

6. Everyone is loyal to someone.

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.

Vx: Vy:person(x) ruler(y) tryassassinatelx,y) => loyalto(,y)

that the only rulers that people try to assass1nate are


This sentence, too, is ambiguous, Does it mean
used here), or does it nmean that the only thing
those to whom they are not loyal (the interpretation
rulers to whom they are not loyal?
people try to do is to assassinate have chosen to write "try to assassinate" as a single
In representingthis sentence the way we did, we
with which we can reason about trying to assassinate.
predicate. This gives a fairly simple representationbetween
this representation, the connections trying to assassinate and trying to do other
But using could not be made easily. If such
and between trying to assassinate and actually assassinating
things different representation.
we would need to choose a
connections were necessary,
8. Marcus tried to assassinate Caesar.

tryassassinate (Marcus, Caesar)


102 Artificial Intelligence

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

Was Marcus loyal to Caesar?

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

From this simple example, we see that three


important issues must be addressed in the process
converting English sentences into logical statements and then using those statements to deduce nevo
ones:

.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.

5.2 REPRESENTING INSTANCE AND 1SA RELATIONSHIPS


In Chapter 4, we discussed the specific attributes instance and isa and described the important role they play
in a particularly useful form of reasoning, property inheritance. But if we look back at the way we just
have used these attributes at all. We
knowledge about Marcus and Caesar, we do not appear
to
represented our
answer is that although we have not used
cerlainly have not used predicates with those names. Why not? The
the predicates instance and isa explicitly, we have captured the relationships they are used to express, namely
class membership and class inclusion.
ditferent ways. The
last section represented in logic in three
Figure 5.3 shows the first five sentences of the
1Irst part of the figure contains the representations we
have already discussed. In these representations, class
to a class.
(such as Roman), each of which corresponds
nembership is represented with unary predicates that r is an instance (or element) ofP The second part of
SSerting that P(x) is true is equivalent asserting
to
ne Tigure contains representations that use the instancee predicate
explicitly. The predicate instance is a binary
second argument is a class to which
the object belongs. But
Whose first argument is an object and whose
c, isa predicate. Instead,
subclass relationships, such as that between
Ese representations do not use an explicit
these The implication rule there states that if an
are described as
shown in sentence 3.
Ompeians and Romans, the superclass Roman. Note that this
Pompeian then it is an instance ot
obje
ect is an instance of the subclass
of the subclass-superclass relationship. The third
nart

IS equivalent to the standard


set-theoretic definition
C both the instance and isa predicales
explicitly. The use of the isa predicate
Onains representations that use
that one additional axiom (shown here as number 6)
of sentence 3, but it requires
pifies the representation instance relation and an isa relation can be combined to
additional axiom describes how an
provided. This is Eeneral, thougn, and
does not need to be provided
additional axiom
derivea a new instance relation. This one

parately for additional isa relations.


Artificial hntelligence
104

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:

Vx: Roman(x) Aneg(x, Paulus) > loyalto(x. Caesar) y hate(.Caesar)

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.

5.3 COMPUTABLE FUNCTIONS AND PREDICATES


individual
In the example we explored in the last section, all the simple facts were expressed as.combinations of
predicates, such as:

tryassassinate(Marcus, Caesar)

themselves are sufficiently unstructured


This is fine if the number of facts is not very large or if the facts
such as the following greater-than
that there is little alternative. But suppose we want to express simple facts,
and less-than relationships:
gt(1,0) It(0,1)
gt(2,1) It(1,2)
gt(3.2) It(2,3)

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

it and return true or false.


regular rules, that will evaluate Thus we might want
have computable functions as well as computable predicates.
It is often also useful to

to be able to evaluate the truth of

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

Send the arguments 5 and 1 to gt. also


functions and predicates can be useful. It
shows how these ideas of computable whenever it
The next example to be substituted for each other
notion of equality and allows equal objects
makes use of the
aPpears helpful to do so during a proof.
106 Artificial Intelligence

Consider the following set of facts, again involving Marcus:


1. Marcus was a man.

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.

Vx: man(x) mortal(x)

5. All Pompeians died when the volcano erupted in 79 A.D.

erupted volcano, 79) A Vx: [Pompeian(t)> died(x, 79)


This sentence clearly asserts the two facts represented above. It may also assert another that we hare
not shown, namely that the eruption of the volcano caused the death of the Pompeians. People often
assume causality between concurrent events if such causality seems plausible
Another problem that arises in interpreting this sentence is that of determining the referent of the
s
phrase "the volcano." There is more than one volcano in the world. Clearly the one refemed to here
Vesuvius, which is near Pompeii and erupted in 79 A.D. In general, resolving references such as thess
can require both a lot of reasoning and a lot of additional knowledge.
6. No mortal lives longer than 150 years.

Vx: Vt: V, : mornal) Aborntr, t,) et-1,150)> dead,tz


There are several ways that the content of this sentence could be example, we coulu
expressed. For
introduce a function age and assert that its value is never greater than 150. The representation shoN
above is simpler, though, and it will suffice for this example,
7. It is now 1991.

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.

V: Vr: [alive(x, 1) dead(x.t)] A-dead(x, 1) -> alive(x, t)


This is not strictly correct, since dead implies alive only for animate objects. (Chairs can be neither
dead nor alive.) Again, we will ignore, this for now. This is an example of the fact that rarely do two
expressions have truly identical meanings in all circumstances.
9. If someone dies, then he is dead at all later times.

Vx: V: V1: diedx, 1) A grt, 1)> dead(x, t)


This representation says that one is dead in all years after the one in which one died. It ignores the
question of whether one is dead in the year in which one died.
1. man(Marcus)
Pompeian(Marcus)
3. born(Marcus, 40)
4. Vx: man(x) >
mortalx)
5. V: Pompeian(x) > diedx, 79)
eruptedlyolcano, 79)
7. V: Vt: Vh: mortal) born(x, t)A gt(-4, 150) deadix. t)
8. now= 1991
9. Vx: Vt [alive(x, )>-dead(x, ] A-deadx, ) > alive(x, ]
10. Vx: V: Vh: diedx, t) A gt(t2. 1)>dead(x, t)
Fig. 5.4 ASet ofFacts about Marcus
than years. If we do that, we can then add
To answer that requires breaking time up into smaller units
month 1) if one died during (year 1, month 1)
rules that say such things as "One is dead at time (year 1,
as necessary. But we do not
and month 2 precedes month 1]. We can extend this to days, hours, etc.,
"

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)

at the end of each


that the list
proof indicates
Two such proofs are shown in Fig. 5.5 and 5.6. The term nil succeeded. Notice in those proofs that
has
ofconditions remaining to be proved is empty and so the proof
whenever a statement of the form:

aAb> c

they are, but in another sense they are


not
independent subgoals. In one
sense
and b set up as
was used, a were
consistent substitutions must be made in each
of
I
they share the bound variables, since, in that case,
same
the goal
em. For example, in Fig. 5.6 look at the step justified
by statement 3. We can satisfy
108 Artificial ntelligence

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

Fig. 5.5 One Way of Proving That Marcus Is Dead

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

Fig. 5.6 Another Way of Proving That Marcus is Dead

a statement (i.e., show that it is valid).


Resolution produces proofs by refutation. In other words, to prove
statement produces a contradiction with
the known
resolution attempts to show that the negation of the been using to
statements (i.e., that it is unsatisfiable).
This approach contrasts with the technique that we have
axioms. Further discussion of
backward from the theorem to be proved to the
generate proofs by chaining have discussed the standard form in
more straightforward after we
how resolution operates will be much
defer it until then.
which statements will be represented, so we

5.4.1 Conversion to Clause Form


either hate Caesar or think that anyone who hates
Suppose we knowthat all Romans who know Marcus
that in the followin wff:
anyone is crazy. We could represent

Vx: [Roman(x) A knowr, Marcus)] >

z)> thinkcrazy(x, y))


hatelx, Cuesar) V (7y: 3z: hate(, of it,
matching process. Then, having matched one piece
To use this formula in a proof requires complexa
the pieces in
to do the right thing with the rest of the formula including
Such as thinkcrazy(x.y), it is necessary were in a simpler form, this
those in which it is not. If the formula
which the matched part is embedded and
to work with it
proc;ess would be much easier.
The formula would be easier
components.
It flatter, i.e., there was less embedding of formula so that they did
were not need to be considered.
from the rest of the
T h e quantifiers were separated For example, the formula
and Putnam, 1960| has both of these properties.
Conjunctive normal form [Davis un conjunctive normal form as
of Romans who know Marcus would be represented
given above for the feelings
Roman(x)Aknowlx, Marcus) V
thinkcrazyr, z)
hatelx, Caesar) V ~hate(y, z) V
Artificial Intelligence

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

1Or cach conjunet. perform


form,
into clause
procedure operates. To convert a

Algorithm: Convert to Clause Form a yb.


Performing nation on the
this transformatio.

equivalent to
b is
using
>, the fact that a

* nate
wff given above yields

VA:-IRoman(x) A know< x, Marcus)| V z)) thinkcrazy(x.y)


Caesar) (Vy:-(3z: hatey.
V V
hate(x.
the fact that P ) =P, eMorgan
S laws [which.
toa single term,
using correspondences between
qtany
K e d u c e the scope of each
-

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

Vx:-Roman(x) V -know(r, Marcus)] V y))


hate(x, Caesar) V (Vy : Vz: hate(y, z) V thinkcrazy(x,
variable. Since variables are just dummy
. Standardize variables that each quantifier binds a unique
so
the formula
names, this process cannot affect the truth value
of the wff. For example,

Vr: P(x) V Vx: Q)

would be converted to

Vx: P(x) V Vy: Q0)

This step is in preparation for the next.


4. Move all quantifiers to the left of the formula without changing their relative order. This is possible since
there is no conflict among variable ames. Performing this operation on the formula of'step 2, we get

Vx: Vy: Vz: [-Roman(r) V -knowx Marcus)] V


hatelx, Caesar) V (-hately, 2) V thinkcrazy(x.y)]
At thispoint, the formula is in what is known as prenex normal form. It consists of a prefir of quantifiers
followed by a matrix, which is quantifier-free.
5. Eliminate existential quantifiers. A formula that contains
an
that there is a value that can be substituted for the variable that
existentially quantified variable asserts
makes the formula true. We can elim1nate
the quantifier by substituting for the variable a
reference to a function that produces the desired value.
Since we do not necessarily know how to
produce the value, we must create a new function name ror
every such replacement. We make no assertions about these
for example, the formula functions except that they must exist. S0,

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 =

simply remove the parentheses, giving


Romanx) V mknow(x, Marcus) V
hatelx, Caesar) V -hate(y. z) V thinkcrazy(x, )

However, it is also frequently necessary to exploit


the distributive property [i.e.. (a A b) vc= (avc)
bv ]. For example, the formula
(winter wearingboots) y (summer A wearingsandals)
becomes, after one application of the rule
winter V (summer N wearingsandals)]
A
wearingboots y (summer A wearingsandals)]
and then, after second
a
application, required since there are still conjuncts joined byOR's,
(winter V summer) A
(winter V wearingsandals) N
wearingboots V summer) N
(wearingboots V wearingsandals)
8. Create a separate clause corresponding to each conjunct. ln order for a wff to be true, all the
that from it
clauses
are generated must be true. If we are going to be working with several wff's, all the
clauses
generated by each of them can now be combined to represent the same set of facts as were
by the original wff's. represented
9. Standardize
apart the variables in the set of clauses generated in step 8. By this we mean rename
the
variables so that no two clauses make reference to the same variable. In
rely on the fact that
making this transformation, we
112 Artificial Intelligence

( r : Pl) A Q ) = V: P(x) A Vx: Q)

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.

5.4.2 The Basis of Resolution


The resolution procedure is a simple iterative process: at each step, two clauses, called the parent clauses, are
compared (resohved), yielding a new clause that has been inferred from them. The new clause represents ways
that the two parent clauses interact with each other. Suppose that there are two clauses in the system:

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.

5.4.3 Resolution in Propositional Logic


In order to make it clear how resolution works, we first present the resolution procedure for propositional
logic. We then expand it to include predicate logic.
Inpropositional logic, the procedure for producing a proof by resolution of proposition P with respect to a
set of axionms F is the following.

Algorithm: Propositional Resolution


1. Convert all the propositions of F to clause form.
2. Negate P and convert the result to clause form. Add it to the set of clauses obtained in step
3. Repeat until either a contradiction is found or no progress can be made:
1
(a) Select two clauses. Call these the parent clauses.
(b) Resolve them together. The resulting clause, called the resolvent, will be the disjunction of all of
the literals of both of the parent clauses with the following exception: If there are any pairs of
literals L and -L such that one of the parent clauses contains L and the other contains L then
select one such pair and eliminate both L and L from the resolvent.
(c) If the resolvent is the empty clause, then a contradiction has been found. If it is not, then add it to
the set of clauses available to the procedure.
Let's look at a simple example. Suppose we are given the axioms shown in the first column of Fig. 5.7 and
we want to prove R. First we convért the axioms to clause form, as shown in the second column of the figure.

Given Axioms Converted to Clause Form


P (1)
(PA)R PV-QVA (2)
(SV)Q SVa (3)
TVQ (4)
(5)
Fig. 5.7 A Few Facts in Propositional Logic

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

that P is true, which


m e
what
a n s
the
that-P cannot
be true, which
leaves

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

5.4.4 The Unification Algorithm true at the same úme, Simel.


that two literals
cannot both be
In propositionallogic, it is easy to determine since the arguments ofth
process is more complicated
look for L and -L In predicate logic, this matching contradiction, while manJom
man(John) and -man(John) is a
predicates must be considered. For example, ned matching procedure that conmpars
artd
determine contradictions,
man(Spor) is not Thus, in order to
we a
that makes them identical. There is a
two literals and discovers whether there
exists a set of substitutions
that does just this.
the unification algorithm,
straightforward recursive procedure, called we first check if their ininal
The basic idea of unification is very simple. To attempt to unify two literals,
is no way they can be unified
the same. If so, we can proceed. Otherwise, there
predicate symbols are
the two literals
regardless of their arguments. For example,

tryassassinate(Marcus, Caesar)
hate(Marcus, Caesar)

we must check the arguments, one pair


at a time. lfthe
cannot be unified. If the predicate symbols match, then callte
so on. To test each argument pair, we can simply
first matches, we can continue with the second, and
Different constants or predicates cannat
unification procedure recursively. The matching rules are simple.
match another variable, any constant, or a predicate expressou
match; identical ones can. A variable can
with the restriction that the predicate expression must not contain any
instances of the variable being matcneu
The only complication in this procedure is that we must find a single, consistent substitution for the enit
we must take each substitution that we find
and app"
literal, not separate ones for each piece of it. To do this,
it to the remainder of the literals before we continue trying to unify them. For example, suppose we wu

unify the expressions

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

write that substitution as


could match. We will

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

found. We write the composition as

(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)

could be unified with any of the following substitutions:

(Marcus/x,)
(Marcus/x,y/2)
Marcus/x, Caesar/y, Caesar/z)
Marcus/x,Polonius/y, Polonius/2)

But the second two, although they produce


The first two of these are equivalent except for lexical variation. Because
necessary for the match.
substitutión that is more restrictive than absolutely
a match, also produce a
is usetul
will be used by the resolution procedure, it
the final substitution produced by the unification process
shown below will do that.
to generate the most general unifier possible. The algorithm
We describe
unification algorithm, we can now state it concisely.
Having explained the operation of the of the substitutions that
value a list representing the composition
procedure Unify(LI, L2), which returns as its was tpund without any
were performed during the match. The empty
list, NIL, indicates that a match
failed.
the value FAIL indicates that the unitication procedure
single
Substitutions. The list consisting of

Algorithm: Unify(LL, L2)


then:
.IfLl or L2 are both variables or constants,
then return NIL.
(a) If Ll and L2 are identical, return {FAIL}, else return (L2/L1).
Else if Ll is variable, then if Ll occurs in L2 then
(b) a
else return (L1/L2).
L2 occurs in LI then return {FAIL},
c)Else if L2 is a variable then if
(d) Else return {FAL).
116 Artificial ntelligence

not identical, then return |FAIL).


2.11the initial predicate symbols in LI and L2 are

T LI and L2 have a different number arguments,


of tFAILJ.
then relurn
4.Set SUBST to N1L. (At the cnd of this procedure, SUBST will contain all the substitutions se
hstitutions used to unit
LI and L2.)
5. For i e-1 to number of argments in L1:
(a) Call Unify with the /th argument of LI and the ith argument of L2, putting result in s

(b) If S contains FAL then return {FAIL).


(c) If S is not equal to NIL then:
(1) Apply S to the remainder of both LI and L2.
ii) SUBST: =APPEND(S, SUBST).
6. Return SUBST
The only part of this algorithm that we have not yet discussed is the check in steps 1(6) and I(c to
Sure that an expression involving a given variable is not unified with that varíable. Suppose we were atte m
to unify the expressions
mpting
fa.x)
fg).g(a))

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.

5.4.5 Resolution in Predicate Logic


We now have an easy way of determining that two literals are contradictory they are if one of them can be
unified with the negation of the other. So, for example, man(x) and -man(Spot) are contradictory, since
man(x) and man(Spot) can be unified. This corresponds to the intuition that says that man(x) cannot be true
for all x if there is known to be some x, say Spot, for which manlx) is false. Thus in order to use resolution for
expressions in the predicate logic, we use the unification algorithm to locate pairs of literals that cancel ou.
We also need to use the unifier produced by the unification algorithm to generate the resolvent clause. For
example, suppose we want to resolve two clauses:
1. man(Marcus)
2. man(x1) V mortalx)
The literal manfMarcus) can be unified with the literal man/t\) with the substitution Marcus/t. tellng us
that for x = Marcus, mantMarcus) is false. But we cannot simply cancel out the two man literals as we
in propositional logic and generate the resolvent mortal(x). Clause 2 says that for a given.x, either man
or mortalx). So for it to be urue, we can now conclude only that mortal(Marcus) must be true. It s
necessary that mortal(x,) be true for all x, since for some values of x, mantx) might be true, Mas
mortallx) irrelevant to the truth of the complete clause. So the resolvent generated by clauses I and 2 msi
tion
moral(Marcus), which we get by applying the result of the unification process to.the resolvent. The resor
ther
process can then proceed from there to discover whether mortal(Marcus) leads to a contradiction witn a
available clauses.
This example illustrates the importance of standardizing variables apart duuring the process of convet
the
expressions to clause form. Given that that slandardization has bee'n done, it is easy to detemine how
Using Predicate Logic 117
ifier
uniti must be used to pertorm substitutions to
create the resolvent. If two
Occur, then they must be given identical instances of the same variable
substitutions,
We can now state the resolution algorithm for predicate logic as follows,
F and a statement to be proved P: assuming a set of given statements
Algorithm: Resolution
1. Convert all the statements of F to
clause form.
2. Negate P and convert the result to clause
form. Add it to the set
3. Repeat until either a contradiction is of clauses obttfHied in 1.
found, no progress can be made, or a
effort has been expended. prede- termined amount of
(a) Select two clauses. Call these the
parent clauses.
(b) Resolve them together. The resolvent will be the
disjunction of all the literals of both clauses
with appropriate substitutions
performed and with the following exception: If there parent
is one pair of
literals Tl and -72 such that one of the
parent clauses contains 72 and the other contains TI and
if Tl and T2 are unifiable, then neither T1
nor T2 should
appear in the resolvent. We call TI and T2
Complementary literals. Use the substitution produced by the unification to create the resolvent. If
there is more than one pair of
resolvent.
complementary literals, only one pair should be omitted from the
(c) If the resolvent is the empty clause, then a contradiction has been found. If it is not, then add it to
the set of clauses available to the
procedure.
If the choice of clauses to resolve
together each step is made in certain systematic ways, then the resolution
at
procedure will find a contradiction if one exists. However, it may take
a very long time. There exist strategies
for making the choice that can speed up the
process considerably:
Only resolve pairs of clauses that contain complementary literals, since only such resolutions produce
new clauses that are harder to satisfy than their To facilitate
parents. this, index clauses by the predicates
they contain, combined with an indication of whether the predicate is negated. Then, given a
clause, possible resolvents that contain a
particular
complementary occurrence of one of its predi- cates can be
located directly.
Eliminate certain clauses as soon as they are generated so that they cannot partic- ipate in later resolutions.
Two kinds of clauses should be eliminated:
tautologies (which can never be unsatisfied) and clauses that
are subsumed by other clauses (i.e., they are easier ;o satisfy. For example, P vQ is subsumed by P)
Whenever possible, resolve either with one of the clauses that is part of the statement we are trying to
refute or with a clause generated by a resolution with such a clause. This is called the
ser-of-support
strategy and corresponds to the intuition that the contradiction we are looking for must involve the
statement we are trying to prove. Any other contradiction would say that the previously believed
statements were inconsistent.
Whenever possible, resolve with clauses that have a single literal. Such resolutions generate new clauses
with fewer literals than the larger of their parent clauses and thus are probably coser tothe goal of a
resolvent with zero terms. This method is called the unit-preference strategy.
Let's now return to our discussion of Marcus and show how resolution can be used to prove new things
about him. Let's first consider the set of statements introduced in Section 5.1. To use them in resolution
proofs, we must convert them to clause form as described in Section 5.4.1. Figure 5.9(a) shows the results of
nat conversion. Figure 5.9(b) shows a resolution proof of the statement

hate(Marcus,Caesar)
118 Artificial Intelligence

Axioms in clause form:


1. man(Marcus)
2 Pompeian( Marcus)
3.-Pompeian(x,) \V Roman(x,)
rulerCaesa
5. -Roman(xe) \V loyalto(x, Caesa) V hate(x, Caesa)
6. loyalto(xg,flxs)
7.-man(xa) V -rulery)V-tryassassinate(Xa.Y1) V loyalto(x,y1)
8. tryassassinate(Marcus, Caesar
(a)

Prove: hate (Marcus, Caesar) -hate (Marcus, Caesar) 5


Marcuslx2
-Roman (Marcus) y loyalto (Marcus, Caesar)
Marcus/x1
-Pompeian (Marcus) V loyalto (Marcus, Caesar)

loyalto (Marcus, Caesar)


Macus/x4, Caesarly
man (Marcus) V-ruler (Caesar) V-tryassassinate (Marcus, Caesar)

-ruler( Caesar) V-tryassassinate (Marcus, Caesar) 4

-tryassassinate (Marocus, Caesar 8

(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)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy