0 ratings0% found this document useful (0 votes) 215 views27 pagesLesson 10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
Lesson X Artificial Intelligence 1
Prof. S. Lucci CSc 10500
Predicate.
Unification
In propositional logic, it is easy to determine that two literals cannot both be
true at the same time
Simply look for L and L
In the predicate logic, this matching process is more complicated since the
arguments of the predicates must be considered as well
Example: man(John) and —man(John)
isa contradictic
whereas man(John) and ~man(Spot)
is not!
Why not?
In order to determine contradictions, we need a matching procedure that compares
two literals and discovers whether there exists a set of substitutions that makes
them identical.Lesson X Artificial Intelligence.
Prof. S. Lucci CSc 10500
The unification algorithm is a recursive procedure
To attempt to unify two literals, we check if their initial predicate symbols
are the same,
If so, 0. k.
Else they cannot be unified, regardless of
their arguments
example
try_assassinate(Marcus, Caesar)
hate(Marcus, Caesar)
cannot be unified
If the predicate symbols match, then we check the arguments one pair at a time.
If the first matches, we continue with the second
and so on.
To test each argument pair, one calls the
unification procedure recursively.Lesson X. Artificial Intelligence 3
Prof. S. Lucci CSc 10500
Matching Rules:
* Different constants or predicates cannot match.
only identical ones can
* A variable can match another variable, any constant, or a predicate
expression with the restriction that the predicate expression must not
contain any instances of the variable being matched
However
We must find a single, consistent substitution for the entire literal, not
Separate ones for each piece of it. To do this, we must take each substitution that
we find and apply it to the remainder of the literal before we continue trying to
unify them.
Example:
P(x, x)
Ply, z) .«predicates match
Next, compare x and y. Suppose we decide to substitute y for x written as ybx
(note, we could have chosen xly instead ... the algorithm will simply choose one of
these).
Ply, x)
So far, we have: ae note ylx
z)
If we continue, and attempt to match x and z, we produce the substitution zlx.Lesson X Artificial Intelligence
Prof. 8, Lucci CSc 10500
But we cannot substitute both y and z for x. We have not produced a consistent
substitution.
Instead, after finding the first substitution ylx one is to make this substitution
throughout the literals, yielding:
Ply, y)
Py, 2)
Next, we would attempt to unify the arguments y and z; this succeeds with the
substitution zly yielding:
Ply, z)
PCy, 2) ..they’re identical
The entire substitution process has succeeded with a substitution that is the
composition of two substitutions:
(zly)(ylx) _...as with functions,
start at the right end and go left
<<
4Lesson X Artificial Intelligence
Prof. 8, Lucci CSc 10500
Usually, if there is one substitution, then there are many
Exam
hate(x, y)
hate(Marcus, z)
can be unified with any of the following:
1. (Marcuslx, zly)
2. (Marcuslx, ylz)
Note | and 2 are equivalent
3. (Marcustx, Caesarly, Caesarlz)
4, (Marcusix, Poloniusly, Poloniustz)
Note that substitutions 3 and 4 are more restrictive that is necessary
We want the most general unifier (mgu) possible.
Either substitution 1 or 2 would qualifyLesson X. Artificial Intelligence
Prof. 8. Lucci CSc 10500
Unification — examples
1. P(x, y) and Pa, z)
{alx, ylz} note a is a constant
2. P(x, x) and P(a, b)
alx, blx is not legal!
We cannot substitute two distinct values for x. Hence unification is
not possible
3. ancestor(x, y) and ancestor(bill, father(bill))
{billlx, father(bill)ly}
Note: father() is a function mapping, here bill to his father.
6Lesson X Artificial Intelligence 7
Prof. 8. Lucci CSc 10500
Resolution Principle ~ describes a way of finding
contradictions in a database of clauses with
minimum use of substitution
Resolution Refutation proves a theorem by negating the statement to be proved
and adding this negated goal to the set of axioms that are known (have been
assumed) to be true.
Resolution refutation proofs involve the following steps:
1) Put the premises or axioms into clause form
2) Add the negation of what is to be proved, in clause form, to the set of
axioms.
3) Resolve these clauses together, producing new clauses that logically follow
from them
4) Produce a contradiction by generating the empty clause
5) The substitutions used to produce the empty clause are those under which
the opposite of the negated goal is trueLesson X Artificial Intelligence 8
Prof. 8, Lucci CSc 10500
Resolution is refutation complete; that is, the empty or null clause can always be
generated whenever a contradiction in the set of clauses exists.
Resolution refutation proofs require that the axioms and the negation of the goal be
placed in a normal form called clause form.
Clause form represents the logical database as a set of disjunctions of literals.
Resolution produces a proof similar to one produced already with modus ponens.
However, the inference rules are not equivalent— resolution is more general.
Example*: We wish to prove “Fido will die”
from the statements:
“Fido is a dog”
“All dogs are animals”
“All animals will die”
‘© This example and the following procedure for converting to clause
form are from Artificial Intelligence by George F. Luger, Addison-
Wesley, 5" Ed. 2005Lesson X Attificial Intelligence
Prof. 8. Lucci C Se 10500
Changing these three premises to predicates and applying modus ponens gives:
1) All dogs are animals:
V(X)(dog( X) animal( X))
2) Fido is a dog:
dog{ fido)
3) Modus Ponens and {fidolx} gives:
animal ( fido)
4) All animals will die:
(CY Y)(animal( Y)— die Y))
5) Modus Ponens and {fidoly) gives:
diel fido)
Equivalent reasoning by resolution converts these predicates to clause form:
Predicate Form Clause Form
1) V(X)(dog)(X)= animal( X) © | dog X\vanimal( x) |
I 2) dog fido) dog fido)
13) ¥(¥)(animal(¥)— diel ¥)) | animal Y\v diel Y)
Negate the conclusion that Fido will die
: “del fido)Lesson X Artificial Intelligence 10
Prof. 8, Lucci CSc 10500
Resolve clauses having opposite literals, producing new clauses by resolution. This
process is often called clashing.
TN
dog fido) ~ dog Y)V diel Y)
\
fido,
Y
die fido) ~die( fido)Lesson X Artificial Intelligence 11
Prof. 8. Lucci CSc 10500
Resolution — A Second Example
Heads I win; tails you lose. Use resolution to show that I win.
The following axioms describe the situation:
. If the coin comes up heads, then I win.
If it comes up tails, then you lose.
. If it does not come up heads, then it comes up tails.
Roepe
. if you lose, then I win.
Which may be represented as:
. H— Wome) 10H: heads , W: win
T > L(you) IT: tails, L: lose
“HOT
. L(you) > Wine)
RwpesLesson X. Artificial Intelligence 12
Prof. S. Lucci CSc 10500
Next, our argument is converted to clause form
1. =H v W(me)
2. aT v L(you)
3. HvT
4, -L(you) v Wome)
‘Then, add the negation of the conclusion
5. =W(me) /falso in clause form
Finally, we attempt to obtain a contradiction
24 =TvW(me) 6
13 Tv Wome) 7
67 W(me) 8
58 a Heontradiction!
Hence W(me) iM win!Lesson X Attificial Intelligence 13
Prof. S. Lucci CSc 10500
Converting to Clause Form
‘* The following algorithm which consists of a sequence of transformations,
may be used to reduce any set of predicate logic statements to clause form
«The clause form that results will not be strictly equivalent to the original set
of predicate calculus expressions, in that certain interpretations may be lost.
* This occurs because skolemization restricts the possible substitutions for
existentially quantified variables
+ However, these transformations may be used to reduce any set of predicate
calculus expressions to a set of clauses that are inconsistent iff the original
set of expressions is inconsistent.
Notation: uppercase letters indicate variables:
W,X,Y,Z
- Lowercase letters in the middle of
the alphabet denote constants or bound
variables 1, m,n
- early alphabetic lowercase letters a,
b, ¢, d, e predicate namesLesson X Artificial Intelligence 14
Prof. S. Lucci CSc 10500
In this example X, Y, Z are variables and | a constant.
(PX) ((alX) AL(X)) > (c(X, A( BY (AZ ¥, Z)) > A(XY))) v WX HX)
Step 1: Eliminate implication. Recall that P>9="PVq
We obtain:
BL (WX)(alX)AB(X))¥(o( X, NAB YNZ) YZ) aX, Y)VOV XA X))
Step 2: Reduce the scope of negation
a) >(ra)=a
b) -(X)a(X)
co) WY X)b(X)S(E X) 5X)
a) “(aab)=navab
e) ~(avb}s7annbLesson X Artificial Intelligence 15
Prof. S. Lucci CSc 10500
Using d) i. Above becomes
Hi, (YX Y(a(X) v B(X)) v (CAK,1) A BY BZ eLY, Z)) v dX,Y))) v OWXHe(X))
Step 3: Standardize variable names. Rename all variables so that variables
bound by different quantifiers have unique names.
Example (V X)a{ X)v(W X)b( X)= V(X) al X)vW{Y)b(Y)
Hence we obtain:
fh, (YXM(malX) v D(X) v (0X, 1) A ( BYN BZN(eLY, Z)) v aX, ¥)) v (WHO W))
We have renamed
this second occurrence of X
Step 4: Move all quantifiers to the left without changing their order.
iv. (VX AYN BZN VWH(a(X) v (XY) VOLK) A (ef ¥,Z)) ACK Y))) ¥ (OW)?
This is referred to as prenex normal form.Lesson X Artificial Intelligence 16
Prof. S. Lucci CSc 10500
Step 5: Remove all existential quantifiers using skolemization; a process
wherein a name is given to an assignment that must exist.
Examples: (3x)(dod X)) may be replaced by dod fido)
//fido is a skolem constant.
« . (WX)(BY)(mother(X,¥)) replaced by (WV X)mother(X,m(X)) — //mQ isa
skolem function. In general, the argument(s) of a skolem function will be all
universally quantified variables preceding the existentially quantified
variable being replaced.
eo (WX YNS2Z)(V W)( foo X,Y, Z, W) is skolemized to:
OW XIV YICW W( fool X,Y, F(X, ¥),)
After skolemizing v. we obtain:
Ve COX VWYralX) v (BOD) v (CCD) (eC, BCD) OX, ADDY) v CW)
Y was replaced with f(x) and Z with g(x)Lesson X Artificial Intelligence 17
Prof. S. Lucci CSc 10500
Step 6: Drop all u1
ersal quantifiers.
Vi, (a(X) v ABIX) v (e(X I) a (eC G1X), B(X)) v aX, IX) v e(W))
Step 7: Convert to Conjunctive Normal Form(CNF)
ie, every expression is a conjunction of disjunction terms. Here we
employ the associative and distributive properties:
Vv (bv c)=(avb)ve
aA(bAc}=(anb)nc Hassociative laws
av(bAc)=(avb)v( anc) /distributive laws
aa(bvc) Halready in clause form!
(raf X) Vv AB(X) v e(X,Dv ef WY) 0
WE aX BODY WlfO), A) dK, KI) CW)Lesson X Artificial Intelligence 18
Prof. S. Lucci CSc 10500
Step 8: Call each conjunct a separate clause
viii.
a) 7a(X)v ab(X) v fv e( W)
b) ral X)vb( Xv F(X), X) VAX, F(X) )Ve(W)
Step 9: Standardize the variables apart again
We know:
(VX) a(X)) v bX) = (WX)aX) v (WYIB(Y)
Finally, we obtain our original predicate logic expression in clause
form:
ix
a) 7a(X)V=b(Xvel X,Nve(W)
b) 7a U)v=b( U)v-0f F(U),g(U))va(U, F(U))ve(V)
Note in x. b)
X is rename by U
and W by V.Lesson X Artificial Intelligence 19
Prof. S. Lucci CSc 10500
Resolution ~ an example
Prove that the following argument is vali
1) All philosophers are Greek
2) All Greeks are happy
3) Either Zachos or Cox is a philosopher
4
5
Cox is not a philosopher
Therefore, Zachos is happy.
We employ the following predicates:
P(X): X is a philosopher
G(X): X is Greek
H(X): X is happy
We may then represent this argument as:
1) (WX)P(X}>G(X)
2) (WX)G(X)- H(X)
3) P( Zachos) P( Cox)
4) P(Cox)
5) OH (Zachos)Lesson X. Artificial Intelligence 20
Prof. S. Lucci CSc 10500
Next, we convert the premises to clause form.
1) PAUXV G(X) J! P>q="PVq,, all variables universally quantified
2) GYVH(Y) /remove implication as above
standardize variable name
3) P( Zachos)v P( Cox}
4) ~P(Cox)
Finally, we negate the conclusion, convert it to clause form and add it to our
clause base.
5) 7H{( Zachos)
We attempt to obtain a contradiction
34 P(Zachos) 6
16 G(Zachos) 7 ZachosIX
2,7 H(Zachos) 8 ZachoslY
58 0
Hence our argument is validLesson X Artificial Intelligence 21
Prof. $. Lucci CSc 10500
Suppose 1) is replaced by
“Some philosophers are Greeks”:
(3X)(P(X)A G(X)
‘Then we have:
0) P{ Tom) J/skolem constant Tom enables us
1) G{Tom) Jo remove existential quantifiers
2) 7G YV H(Y)
3) P( Zachos)v P( Cox)
4) >P( Cox)
5) 7H{( Zachos)
We are unable to obtain a contradiction,
Hence, this argument is invalid.Artificial Intelligence 22
Lesson X
CSc 10500
Prof. S. Lucci
Resolution - another example
Premises: The custom officials searched everyone
who entered this country who was not a
VIP. Some drug pushers entered this
country and they were only searched by
drug pushers. No drug pusher was a
VPP.
Conclusion: Some of the custom officials were drug pushers
Use resolution to prove that this argument is valid.
Let E(X)represent “X entered this country”
v(x) “X was a VIP”
S(%Y) “X was searched by Y”
cx) “X was a custom official”
P(X) “X was a drug pusher”
Premises:Lesson X Artificial Intelligence 23
Prof. 8. Lucci CSc 10500
1) (YXEIX) AVX) > (BYMS(XY) ACT
2) (AXYP(X) a E(X) A W¥NS(X,¥) > PCY))]
3) (VXI PIX) 99 UX)]
Conclusion:
4) (AXILP(X)AC(X)]
We transform our premises into clause form.
D) (XIE) A>V(X)) > (BYASIXY) ACY]
Remove implication
(V XIE AVX) V(EN(SX, Y)AC(Y))]
Reduce the scope of negation
CVX) [E(X) v VOX) v (AYMS(XY) 0 COD)]
Remove existential quantifiers via skolemization
(CVX)[AE(X) v VIX) v (S(X, 8) 0 CURD)Lesson X Artificial Intelligence 24
Prof. S. Lucci CSc 10500
Drop all universal quantifiers
AEX) v VX) v (S(X, (0). 6 CX)
Convert to CNF
(EX) v VOX) v SIX, FO) 0 (BOO) v VOX) v CO)
Call each conjunct a separate clause
TEX) VIX) v SUX, f())
AEX) v VOX) v CCAD)
Standardize variable names apart
1. 7BIX) VIX) v SUX, 100)
2. ABIX) VIX) v CUI)Lesson X Artificial Intelligence 25
Prof. S. Lucci CSc 10500
Working on Premise 2
(AXILPLX)AE(X)A(Y YV(MX, Y)> PY)
In the same manner will yield
3. Pla) /skolem constant
4, Ea) Haitto
5. S(aW)v P(W)
And finally, transforming Pret
(W X)[P(X)39V(X)] yields:
6. =P(X)VAVIX)
Next, we negate the conclusion_(3X)[P(X) a C(X)) and convert it to clause form as
well
7, -PU)v CU)Lesson X Artificial Intelligence 26
Prof. S. Lucci CSc 10500
Then we search for a contradiction
3,6 =V(a) 8) alX
24 Vea) v C(l@)) 9) alZ
89 c(f(a)) 10)
14 V(a) v Sta, fla) 11) alX
8,11 S(a, fa) 12)
512 P(f(a)) 13) Faw
713 >C(fla)) 14) f(aylU
10,14 9 15) Hempty clause
Therefore, the original argument is valid.Lesson X Artificial Intelligence 27
Prof. S. Lucci CSc 10500
Resolution ~ Practice Problems
1. Consider the following argument:
1) Whoever can read is literate
2) Dolphins are not literate
3) Some dolphins are intelligent
Conclusion: Some who are intelligent cannot read.
A. Express the argument in the predicate logic
B. Convert it to clausal form
C. Prove that this argument is valid using resolution
Il. A. Symbolize the following argument using the predicate names
provided
B. Use resolution to prove that this argument is valid
1. All mayor are Republican(M,R)
2. All Republicans are wealthy(W)
3, Either Green or Bloomberg is mayor(G,B)
4. Green is not mayor
Conclusion: Bloomberg is wealthy.
C. Analyze what happens to this argument if sentence 1. is replaced by
1, Some mayors are republican