29
Unification Q(x)  P(y) FAIL  P(x)  P(y) x/y  P(Marcus)  P(y) Marcus/  y  P(Marcus)  P(Julius) FAIL  P(x,x)  P(y,y) (y/x)  P(y,z) (  z/y , y/x)

Resolution in AI

Embed Size (px)

Citation preview

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 1/29

Unification

Q(x) P(y) FAIL

P(x)

P(y) x/y P(Marcus) P(y) Marcus/ y

P(Marcus)

P(Julius) FAIL

P(x,x) P(y,y) (y/x) P(y,z) ( z/y , y/x)

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 2/29

F inding General Substitutions

Given: H ate(x,y) H ate(Marcus,z)

W e Co uld Pr oduc e:( Marcus/x, z/y)

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

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 3/29

A lgorithm: Unify(L1,L2)1.

If

L1

or L

2 is a var iable or constant, then:a) If L1 and L2 ar e identical, then

r etur n N IL .

b) Else i f L1 is a var iable, then i f L1 occurs in L2 then r etur nFAIL

, else r etur n {( L

2/ L1

)}.

c) Else if L2 is a var iable, then i f L2 occurs in L1 then r etur nFAIL , else r etur n {( L1 / L2)} .

d) Else r etur n FAIL .

2.

If the ini tial pr edicate symb ols in L1 and L2 ar e no t identical, then

r etur n FAIL .

3. If L1 and L2 have a diff er ent numb er of argum ents, then r etur nFAIL

4 .Set

SUBST to N

IL .

5. F or i 1 to numb er of argum ents in L1 :a) Call Uni f y with the ith argum ent

of L1 and the ith argum ent of L2, putt ing r esult in S.

b) If S = FAIL then r etur n FAIL .

c) If S is not equal to N IL then:i. A pp ly S to the r emainder of both

L1 and L2.

ii. SUBST := A PPEND( S , SUBST ).

6. Retur n SUBST.

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 4/29

A Predicate Logic Example

1. Marcus was a man. m an ( Marcus )2. Marcus was a Pom pei an. Po mp eian ( Marcus )3. A ll Pom pei ans wer e Ro mans. x: Po mp eian ( x)p R om an ( x)4 . Caesar was a ruler . ruler (Caesar )5. A ll Romans wer e ei ther loyal to C aesar or hat ed him .

x: R om an ( x) p loyalto ( x, Caesar ) V hate ( x,Caesar )6. Eve ryone i s loyal to someone . x: y: loyalto ( x,y)7. Peop le on ly try to assass inate rulers they ar en' t loyal to.

x: y: p erson ( x)0 ruler ( y) 0 tryassassinate ( x,y)p loyalto ( x,y)8. Marcus tr ied to assass inate Caesar .

tryassassinate ( Marcus, Caesar )9. A ll men ar e peop le. x: m an ( x) p p erson ( x)

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 5/29

A lgorithm: Convert to Clause F orm

1. Eliminate p , using: a p b= a v b.2. Reduc e the scope o f each to a single term, using:

( p ) = p deMorgan's laws: (a 0 b) = a V b

(a V b) = a 0 b

x P ( x) = x P ( x) x P ( x) = x P ( x)

3. Standard ize v ar iables.

4 . Move all quantif iers to the lef t of the f ormula without cha nging their r elat ive o rder .

5. Eliminate exi stential quantif iers by inserting Sko lem f unction s.

6. Dr op the pr ef ix .

7. Conve rt the exp r ession in to a conj unction o f dis juncts, using associativi ty and distr i butivi ty .

8. Cr eate a separat e claus e f or each conj unct .

9. Standard ize a part the var iables in the set of claus es gene rated in step 8,

usin

g th

e f act

that

: ( x

:P

( x)

0Q

( x))

= x

: P

( x)

0 x

:Q

( x)

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 6/29

Skolem F unctions in FO LO

bjectiveW ant all var iables unive rsally quantif ied No tat ional var iant of FOL w/o exi stentialsRetain im plicitly f ull FOL exp r essivene ss

Skolem¶s Theorem

Eve ry exi stentially quantif ied var iabl e can be r eplac ed by a uniqueSk ole m function whose argum ents ar e all the unive rsally quantif ied var iables on w hich the exi stential depen ds, without cha nging FOL .

Examples³ Eve rybody likes something´

(x) (y) [Pe rson(x ) & L ike s(x,y)](x) [Pe rson(x ) & L ikes(x, S1 (x))]W her e S 1 (x) = ³ that which x likes´

³ Eve ry philosopher wr ites at least one book ́(x) (y)[Philosopher (x) & Book( y)) => W r ite(x ,y)]

(x)[(Philosopher (x) & Book(S2(x ))) => W r ite(x ,S2(x ))]

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 7/29

Examples of Conversion to Clause F orm

Exam ple: x: [ R om an ( x) 0 k now( x, Marcus )] p [hate ( x,Caesar ) V ( y: z:hate ( y, z) p thin k crazy ( x, y))]

Eliminate p

x: [ R om an ( x) 0 k now( x, Marcus )] V [hate ( x,Caesar ) V ( y: z: hate ( y, z) V thin k crazy ( x, y))]

Reduc e scope o f .

x: [ R om an ( x) V k now( x, Marcus )] V [hate ( x,Caesar ) V ( y: z: hate ( y, z) V thin k crazy ( x, y))]

³ Standard ize ´ var iabl es: x: P (x) V x: Q( x) conve rts to x: P ( x) V y: Q( y)

Move q uantif iers . x: y: z: [ R om an ( x) V k now( x, Marcus )] V [hate ( x,Caesar ) V ( hate ( y, z) V thin k crazy ( x, y))]

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 8/29

Examples of Conversion to Clause F orm

Eliminate exi stential quantif iers .

y: President ( y) will be conve rted to President (S 1 ) x: y: father-of ( y, x) will be conve rted to x: father-of (S 2( x), x))

Dr op the pr ef ix

.

[ R om an ( x) k now( x, Marcus )] V [hate ( x, Caesar ) V (hate ( y, z) V thin k crazy ( x, y))]

Conve rt to a conjunction o f dis juncts .

R om an ( x) V k now( x, Marcus ) V hate ( x,Caesar ) V hate ( y, z) V thin k crazy ( x, y)

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 9/29

The Basis of Resolution andHerbrand's Theorem

Given:winter V summ er

winter V coldW e can conclud e:

summ er v cold

Herbra nd's Theor em:

To show that a set of claus es

S is unsat is

f iabl e, it is necessary to consider only inter pr etat ion s ove r a part icular

set, call ed the H erbrand universe of S . A set of claus es S is unsat isf iabl e if and only if a f ini te subs et of gr ound instances (in w hich all bound var iabl es have had a valu e

subst ituted f or them) of S is unsats if abl e.

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 10/29

A lgorithm: Propositional Resolution

1. Conve rt all the pr opo sition s of F to claus e f orm .2. Ne gat e P and conve rt the r esult to claus e f orm . A dd it to

the set of claus es o btaine d in step 1.

3. Repe at until either a contrad iction i s f ound or no p r ogr ess

can be mad e:a) Select two claus es. Call these the par ent claus es.

b) Resolve them together . The resolvent will be thedis junction o f all of the literals of both of the par ent claus es with the f ollowin g exception: If ther e ar e any pairs of literals L and L such that one o f the par ent claus es contains Land the o ther contains L , then select one such pair and eliminate both L and L f r om the r esolven t.

c) If the r esolven t is the em pty claus e, then a contrad iction has beenf ound. If it is not, then add it to the set of claus es availabl e to the

pr ocedur e.

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 11/29

A F ew F acts in Propositional Logic

Given A xioms Clause F orm P P (1 )

( P 0 Q) p R P V Q V R (2)

(S V T ) p Q S V Q (3 )

T V Q (4 )

T T (5 )

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 12/29

Resolution in Propositional Logic

P V Q V R R

P V Q

Q

P

T V Q

T T

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 13/29

A lgorithm: Resolution

1. Conve rt all the pr opo sition s of F to claus e f orm .2. Ne gate P and conve rt the r esult to claus e f orm . A dd it to the

set of claus es o btained in 1.

3. Repe at until either a contrad iction i s f ound, no p r ogr ess can bemad e, or a pr edetermined amount of eff ort has been expen ded.

a) Select two claus es. Call these the par ent claus es.

b) Resolve them together . The r esolven t will be the dis junction o f all the literals of both par ent claus es with a pp r opr iate subst itut ions

pe r f ormed and with the f ollowin g exception: If ther e is one p air of literals T 1 and T 2 such that one o f the par ent claus es contains T 1

and the other contains T 2 and if T 1 and T 2 ar e unif iable, thennei ther T 1 nor T 2 should a ppe ar in the r esolven t. If ther e is mor etha n one p air of com plementary literals, only one p air should beomitted f r om the r esolven t.

c) If the r esolven t is the em pty claus e, then a contrad iction has beenf ound. If it is not, then add it to the set of claus es availabl e to the

pr ocedur e.

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 14/29

A Resolution Proof

A xioms in claus e f orm:1. m an(Marcus)2. Po mp eian(Marcus)

3. Po mp eian ( x1 ) v Ro man( x1 )4 . R uler (Caesar )5. R om an ( x2) v loyalto ( x2 , Caesar ) v hate ( x2 , Caesar )6. loyalto ( x3, f 1 ( x3 ))7. m an ( x4 ) v ruler ( y1 ) v tryassassinate(x 4 , y1 ) v

loyalto ( x4 , y1 )8. tryassassinate ( Marcus, Caesar )

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 15/29

Resolution Proof cont.

Pr ove: hate(Marcus, Caesar) hate(Marcus, Caesar)

R om an(Marcus) V loyalto(Marcus,Caesar)

Marcus/x 2

5

3

2

7

1

4

8

Marcus/x 1

Po mp eian(Marcus) V loyalto(Marcus,Caesar)

loyalto(Marcus,Caesar)

Marcus/x 4 , Caesar / y1

m an(Marcus) V ruler(Caesar) V tryassassinate(Marcus, Caesar)

ruler(Caesar) V tryassassinate(Marcus, Caesar)

tryassassinate(Marcus, Caesar)

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 16/29

A n Unsuccessful A ttempt at Resolution

Pr ove: loyalto(Marcus, Caesar) loyalto(Marcus, Caesar)

R om an(Marcus) V hate(Marcus,Caesar)

Marcus/x 2

5

3

2 Marcus/x 1

Po mp eian(Marcus) V hate(Marcus,Caesar)

hate(Marcus,Caesar)

Marcus/x 6 , Caesar / y3

(a)

hate(Marcus,Caesar) 10

p ersecute(Caesar, Marcus)

hate(Marcus,Caesar)

9

Marcus/x 5 , Caesar / y2

( b)::

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 17/29

A ssociative /Semantic Ne two r k (Se mantic Ne t):

I t is f ormal ism f or r epr esenting in f ormat ion about o b jects, peop le, concepts and s pecif ic r elat ionship between them.

The syntax o f semantic net is sim ple. Ther e is nounive rsally acc epted syntax f or semantic net. I t is a networ k of labeled nodes and links . O b jects ar e deno ted by nodes in the ne twor k and r elat ions ar e deno ted by link s. Basically it is a dir ected gra ph with nodes corr es pon ding to

concepts, f acts, o b jects etc . and arcs showin g r elat ion o r association between two concepts .

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 18/29

Representation in semantic network

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 19/29

Semantic network of Sentence

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 20/29

Extended Semantic net

Par itione d Ne two r k

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 21/29

Example of Partitioned Network

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 22/29

F rames

Con sider the ex am ple:Personisa: Mammalcard inality: 6 ,000 ,000 ,000

* handed: Right

A dult-Mal eisa: Personcard inality: 2,000 ,000 ,000

* height; 5 -10

Cr icket-Player isa: A dult-Mal ecard inality: 6 24

* height : 6 -1

* bats : equal to handed* batt ing-averag e: .75

* team: BC I (India)* unif orm-c olor : Sk y-Blue

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 23/29

Classinstance : C lassisa : Class * card inanality :

Te am istance : C lassisa : Classcard inality :{ the numb er of teams that exist}

* team size : { e ach team has a size}Cr icket ± Te aminstance : C lassisa : Te amcard inality : 26 { the numb er of base ball teams that exist}* team-s ize : 11 {def ault 11 players on a team}* manager :

BC I(India)instance : C r icket ± Te amisa : Cr icket ± player team-s ize : 11

manager : Mah endra* unif oirm-c olor Blue

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 24/29

Conceptual Graph

Cat is on Mat

Every cat is on a mat.

A person is between a rock and a hard place.

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 25/29

J ohn is going to Boston by bus.

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 26/29

K nowledge reprsentation using rules

Pr ocedural Know ledgeDeclarat ive Know ledge

Exam pleMa n(sam eer) .

Ma n(sanjay) .

Person( am it).Vx:man(x )->pe rson(x ).

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 27/29

F orward and backward reasonings

L arg et set to small er set of stat esIn w hich dir ection i s the branch ing f actor

W ill the p r ogram be asked to just if y r easonin g pr ocessW hat kind of even t is going to tr igger the p r o blem

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 28/29

Batsma nisa: Cr icket-Player card inality: 36

* batt ing-average 75

Sach ininsance: Batsma nheight : 5 -10

bats : Right batt ing-average: 100

team: BC I(India)unif orm-c olor : Blue

8/8/2019 Resolution in AI

http://slidepdf.com/reader/full/resolution-in-ai 29/29

isa: Te amcard inality: 26

* team-s ize: 11

* manager : 01

BC I (India)instance: C r icke t-Te amteam-s ize: 11

manager : Mah endra players: (G angul i, Sacin , « )F igur e: A Sim plif ied F ram e System