ar: clausal logic the step to resolution. a deeper study: modus ponens ground horn logic unification...

40
AR: clausal logic AR: clausal logic The step to The step to Resolution Resolution

Upload: asia-coffield

Post on 22-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

AR: clausal logicAR: clausal logic

The step to The step to ResolutionResolution

Page 2: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

A deeper study:A deeper study:

Modus ponensModus ponensGround Horn LogicGround Horn Logic

UnificationUnificationHorn LogicHorn Logic

ResolutionResolution Clausal LogicClausal Logic

Page 3: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

3

Representation-powerRepresentation-powerof Horn clausesof Horn clauses

Most predicate logic formulae can easily be Most predicate logic formulae can easily be rewritten in Horn clauses.rewritten in Horn clauses.

Examples:Examples:

x cat(x) x cat(x) dog(x) dog(x) pet(x) pet(x)

x poodle(x) x poodle(x) dog(x) dog(x) small(x) small(x)

pet(x) cat(x)pet(x) dog(x)

dog(x) poodle(x)small(x) poodle(x)

BUTBUT::

x human(x) x human(x) male(x) male(x) female(x) female(x)

x dog(x) x dog(x) ~abnormal(x) ~abnormal(x) has_4_legs(x) has_4_legs(x)

????

????

Page 4: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

4

Clausal formClausal form

Generalized form of the formulae:Generalized form of the formulae:

x1 … xk A1 A2 … Am B1 B2 … Bn

Horn clauses are a special case with Horn clauses are a special case with m = 1m = 1

We assume that We assume that S = T S = T {~F} {~F} consists only of consists only of clausal formulae. clausal formulae.

GoalGoal:: prove that prove that SS is inconsistent. is inconsistent.

Page 5: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

5

Example: Moore’s problemExample: Moore’s problem

BlueBlue oror RedRed

Given 3 blocks:Given 3 blocks:

Prove that there is a Prove that there is a blueblue block next to a block next to a redred block!block!

Page 6: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

6

Moore’s problem (2):Moore’s problem (2):

This would require a case-analysis!This would require a case-analysis!

In clausal form:In clausal form:

blue(Block1)blue(Block1)red(Block3)red(Block3)blue(Block2) blue(Block2) red(Block2) red(Block2)

next_to(Block1,Block2)next_to(Block1,Block2)next_to(Block2,Block1)next_to(Block2,Block1)next_to(Block2,Block3)next_to(Block2,Block3)next_to(Block3,Block2)next_to(Block3,Block2)

ProveProve:: oror false false next_to(b1,b2) next_to(b1,b2) blue(b1) blue(b1) red(b2) red(b2)

is inconsistent.is inconsistent.

b1 b1 b2 next_to(b1,b2) b2 next_to(b1,b2) blue(b1) blue(b1) red(b2) red(b2)

PROBLEMPROBLEM:: Modus ponens is not suitable for Modus ponens is not suitable for blue(Block2) blue(Block2) red(Block2) red(Block2)

Page 7: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

7

high_qualified(x) high_qualified(x) phd(x) phd(x)earn_early(x) earn_early(x) ~phd(x) ~phd(x)rich(x) rich(x) high_qualified(x) high_qualified(x)rich(x) rich(x) earn_early(x) earn_early(x)

(1)(1)(2)(2)(3)(3)(4)(4)

Introducing negation in bodies is Introducing negation in bodies is equivalent:equivalent:

Example:Example:

Prove: Prove: rich(I)rich(I)

Why equivalent? Why equivalent? (2)(2) is equivalent to is equivalent to earn_early(x) earn_early(x) phd(x) phd(x) since since A A ~B ~B A A B B

Page 8: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

8

Disjunction versus negation Disjunction versus negation in general:in general:

x1 … xk A1 A2 … Am B1 B2 … Bn

is equivalent to:is equivalent to:

x1 … xk A1 B1 B2 … Bn ~A2 … ~Am

or to:or to:

x1 … xk Ai B1 B2 … Bn ~A1 .. .. ~Am

ProofProof: : A A ~B ~B A A B B and basic relations and basic relations between between , , and ~ and ~

A ~B A B

Page 9: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

9

The resolution principleThe resolution principle

A1 A1 A2 A2 … … Am Am B1 B1 … … BB … … Bn BnC1 C1 ... ... BB … … Ck Ck D1 D1 D2 D2 … … Dl Dl

A1 A1 A2 A2 … … Am Am C1 C1 .. .. .. .. Ck Ck B1 B1 .. .. .. .. Bn Bn D1 D1 D2 D2 … … Dl Dl

Propositional case:Propositional case:

CorrectnessCorrectness: clear due to:: clear due to: make from all other disjuncts negated body make from all other disjuncts negated body

atoms,atoms, apply generalized modus ponens,apply generalized modus ponens, move all these negated body atoms back as move all these negated body atoms back as

disjuncts in the head.disjuncts in the head.

Page 10: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

10

Resolution: predicate logicResolution: predicate logic

where where = = mgu(mgu(BB,,B’B’))..

Correctness: Correctness: with a help of the correctness result for the with a help of the correctness result for the

ground case, applied to all instances of this ruleground case, applied to all instances of this rule

A1 A1 A2 A2 … … Am Am B1 B1 … … BB … … Bn BnC1 C1 ... ... B’B’ … … Ck Ck D1 D1 D2 D2 … … Dl Dl

(A1 (A1 A2 A2 … … Am Am C1 C1 .. .. .. .. Ck) Ck) (B1 (B1 .. .. .. .. Bn Bn D1 D1 D2 D2 … … Dl) Dl)

Page 11: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

11

Also in other forms:Also in other forms: In In conjunctive normal formconjunctive normal form::

with with = = mgu(mgu(BB,,B’B’))..

A1 A1 A2 A2 … … Am Am ~B1 ~B1 … … ~~BB … … ~Bn ~BnC1 C1 ... ... B’B’ … … Ck Ck ~D1 ~D1 ~D2 ~D2 … … ~Dl ~Dl

(A1 (A1 A2 A2 … … Am Am C1 C1 .. .. .. .. Ck) Ck) (~B1 (~B1 .. .. .. .. ~Bn ~Bn ~D1 ~D1 ~D2 ~D2 … … ~Dl) ~Dl)

Page 12: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

12

Once again Moore’s exampleOnce again Moore’s example

blue(Block2)blue(Block2) red(Block2) red(Block2)

red(Block2) red(Block2) next_to( next_to(Block2Block2,b2) ,b2) red(b2)red(b2)

blue(Block1)blue(Block1)red(Block3)red(Block3)blue(Block2) blue(Block2) red(Block2) red(Block2)

next_to(Block1,Block2)next_to(Block1,Block2)next_to(Block2,Block1)next_to(Block2,Block1)next_to(Block2,Block3)next_to(Block2,Block3)next_to(Block3,Block2)next_to(Block3,Block2)

red(Block2) red(Block2) next_to(Block2,next_to(Block2,Block3Block3))

red(Block3)red(Block3)

red(Block2)red(Block2)

next_to(Block2,Block3)next_to(Block2,Block3)

false false next_to(b1, next_to(b1,Block2Block2) ) blue(b1)blue(b1)

false false next_to(b1,b2) next_to(b1,b2) blue(b1) blue(b1) red(b2)red(b2)

false false next_to(next_to(Block1Block1,Block2),Block2)

blue(Block1)blue(Block1)

false false

next_to(Block1,Block2)next_to(Block1,Block2)

false false next_to(b1,b2) next_to(b1,b2) blue(b1blue(b1)) red(b2) red(b2)

Page 13: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

13

Ph.D. examplePh.D. example

rich(x)rich(x) false false rich(I)rich(I)

false false

factoringfactoring

earn_early(x) earn_early(x) highly_qualified(highly_qualified(xx)) rich(y) rich(y) highly_qualified(y)highly_qualified(y)

rich(rich(xx) ) rich(x) rich(x)

earn_early(x)earn_early(x) rich( rich(xx) ) rich(y) rich(y) earn_early(y)earn_early(y)

highly_qualified(y) highly_qualified(y) phd(y)phd(y)earn_early(x) earn_early(x) phd(x)phd(x)

highly_qualified(x) highly_qualified(x) phd(x) phd(x)earn_early(x) earn_early(x) phd(x) phd(x)rich(x) rich(x) highly_qualified(x) highly_qualified(x)rich(x) rich(x) earn_early(x) earn_early(x)

(1)(1)(2)(2)(3)(3)(4)(4)

false false rich(I) rich(I)

Page 14: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

14

Factoring: in generalFactoring: in general

Both:Both:

with: with: is is mgu(mgu(BB,,B’B’))

A1 A1 A2 A2 … … Am Am B1 B1 … … BB … … B’B’ … … Bn Bn

(A1 (A1 A2 A2 … … Am Am B1 B1 … … BB … … … … Bn) Bn)

as:as:

with: with: is is mgu(mgu(AA,,A’A’) ) . .

A1 A1 … … A A … … A’A’ … … Am Am B1 B1 … … BnBn

(A1 (A1 … … A A … … … … Am Am B1 B1 … … Bn) Bn)

Page 15: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

15

Why do we need factoring?Why do we need factoring?

p p q q p p q q false false p p q qq q p p

(p (p q) q) (p (p ~q) ~q) (~p (~p q) q) (~p (~p ~q) ~q)

Without factoring resolution is not complete !Without factoring resolution is not complete ! ExampleExample: : prove prove {(p {(p ~p) ~p) (q (q ~q)} ~q)} inconsistentinconsistent Normalization:Normalization:

Clausal form:Clausal form:

p p p p q q q q

p p q q q q p p

You can never getYou can never get false false !!!!!!!!

Page 16: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

16

Reason?Reason? The length of a formula = the number of atoms The length of a formula = the number of atoms

(false not included):(false not included):

A1 A1 A2 A2 … … Am Am B1 B1 … … BB … … Bn BnC1 C1 ... ... B’B’ … … Ck Ck D1 D1 D2 D2 … … Dl Dl

(A1 (A1 A2 A2 … … Am Am C1 C1 .. .. .. .. Ck) Ck) (B1 (B1 .. .. .. .. Bn Bn D1 D1 D2 D2 … … Dl) Dl)

LengthLength

NNMM

N + M - 2N + M - 2

In the previous example all formulas had In the previous example all formulas had length 2length 2

You can NEVER get You can NEVER get false false ( (length 0length 0) !) !

Page 17: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

17

The resolution procedureThe resolution procedureS:=:= initial theory (inconsistency to be shown);initial theory (inconsistency to be shown);ConsistentConsistent:= false;:= false;InconsistentInconsistent:= false;:= false;

WhileWhile not(not(ConsistentConsistent) and not() and not(InconsistentInconsistent) do) doIfIf false false SS ThenThen Inconsistent Inconsistent := true:= trueElseElse

IfIf SS contains no paircontains no pair ((FF,,GG)) resolvable and notresolvable and not yet resolvedyet resolved

ThenThen ConsistentConsistent:= true:= trueElseElse SELECT SELECT a pair (a pair (FF,,GG) from ) from SS, resolvable, resolvable

and not yet resolved;and not yet resolved; HH:= factor( resolvent (:= factor( resolvent (FF,,GG) );) ); S:= S S:= S HHEnd-whileEnd-while

Page 18: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

18

Behavior under Behavior under Horn Horn clauseclause resolution : resolution :

false false ... ... … … ... ...

false false

false false ... ... … … ... ...

false false ... ... … … ... ...

......

Linear resolution !Linear resolution !

Page 19: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

19

Behavior underBehavior under GeneralGeneral resolution : resolution :

General resolution !General resolution !

… … ... ... … … ... ...

… … ... ...

… … ... ... … … ... ...

… … ... ... … … ... ...

… … ... ...

false false

Page 20: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

20

Linear resolution:Linear resolution: The most important differences with Horn clauses:The most important differences with Horn clauses:

With With Horn clausesHorn clauses the proofs are always the proofs are always LINEAR !LINEAR ! we start with the “goal”we start with the “goal” we apply a Horn clause to compute a new goal we apply a Horn clause to compute a new goal

etc.etc. Clausal resolution is NOT linearClausal resolution is NOT linear Also: Also: factoringfactoring is sometimes needed is sometimes needed

Linear resolution Linear resolution (a proof is a linear sequence (a proof is a linear sequence of resolution steps starting with a goal)of resolution steps starting with a goal) is one of is one of the most important strategies to make the the most important strategies to make the resolution process efficient.resolution process efficient.

Page 21: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

21

Non-determinism in the Non-determinism in the resolution procedureresolution procedure

SELECT SELECT a paira pair ((FF,,GG)) : makes it a : makes it a VERYVERY non- non-deterministic procedure.deterministic procedure.

The control problem for resolution is extremely The control problem for resolution is extremely difficult.difficult.A proof is no longer 1 (linear) branch in a tree, A proof is no longer 1 (linear) branch in a tree,

but a subgraph of all possible resolutions.but a subgraph of all possible resolutions.

Is it correct? Is it complete? ?Is it correct? Is it complete? ?

Is there a complete strategy ??? Is there a complete strategy ???

Page 22: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

22

Correctness / Completeness ?Correctness / Completeness ?

Completeness:Completeness: There exists a complete strategy There exists a complete strategy (standard example: the Herbrand theorem prover). (standard example: the Herbrand theorem prover).

Correctness:Correctness:If the procedure returns If the procedure returns InconsistentInconsistent::

Then Then false false is added is added Then Then false false is logically entailed by is logically entailed by SS

(since (since the resolution step is correct).the resolution step is correct). Thus, in all models of Thus, in all models of SS false false is also trueis also true Thus, Thus, SS has no models has no models

Page 23: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

23

… … ...... … … ......… … ......

… … ......… … ......

Correctness/Completeness 2 ?Correctness/Completeness 2 ?If the procedure returns If the procedure returns ConsistentConsistent::

Then ALL POSSIBLE resolution steps were done Then ALL POSSIBLE resolution steps were done without discovering without discovering false false . .

Now assume that the set was inconsistent.Now assume that the set was inconsistent. There exists a There exists a COMPLETE strategyCOMPLETE strategy: that after some time derives : that after some time derives false false

But it performs (a part of) the same resolution But it performs (a part of) the same resolution steps !!steps !! Our strategy also produced Our strategy also produced false

… … ...... … … ......… … ......

… … ......

… … ...... … … ......

… … … … false false

Page 24: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

AR for full predicate logicAR for full predicate logic

Normalization to clausal formNormalization to clausal form

Page 25: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

25

What else is needed for full What else is needed for full predicate logic?predicate logic?

NOTHING!NOTHING!

Clausal logic is Clausal logic is equivalentequivalent to full predicate to full predicate logic:logic: every theory every theory TT in FOL (first order predicate in FOL (first order predicate

logic) can automatically be converted in a logic) can automatically be converted in a clausal theory clausal theory T’T’, such that:, such that:

T is inconsistent iff T’ is inconsistent

Page 26: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

26

Propositional: via Propositional: via conjunctive normal form:conjunctive normal form:

Every formula is equivalent to a formula of the Every formula is equivalent to a formula of the form:form:(A1 (A1 ... ... An) An) (B1 (B1 … … Bm) Bm) … … (C1 (C1 … … Ck) Ck)

where all where all AiAi, , BiBi, …, , …, CiCi are either are either atomicatomic or or ~atomic~atomic..

Idea:Idea:

p p q q p p q q push all ~ as deep as possiblepush all ~ as deep as possibleapply distributivity of apply distributivity of and and

p p q q q q p pq q ~p ~p

Finally:Finally:

p1 p1 … … pn pn ~q1 ~q1 … ~qm … ~qm p1 p1 … … pn pn q1 q1 … … qm qm

Page 27: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

27

Predicate case: main stepsPredicate case: main steps

Sometimes requires new variable names. Sometimes requires new variable names. Ex.:Ex.: x p(x) x p(x) x q(x) x q(x) x x z p(x) z p(x) q(z)q(z) Note:Note: x cloudy(x) x cloudy(x) x sunny(x)x sunny(x) is is not equivalentnot equivalent

toto x cloudy(x) x cloudy(x) sunny(x) sunny(x)

Prenix normal formPrenix normal form

(Q1 x) (Q2 y) …(Qn z) F(Q1 x) (Q2 y) …(Qn z) F

or or has no quantifiers !

Conjunctive normal form:Conjunctive normal form:

(Q1 x) (Q2 y) …(Qn z) ( .. (Q1 x) (Q2 y) …(Qn z) ( .. .. ) .. ) ( .. ( .. .. ) .. ) .. .. ( .. ( .. .. ) .. )

These 2 steps are interleaved.These 2 steps are interleaved.

Page 28: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

28

Predicate case: continuedPredicate case: continued

Skolem functionsSkolem functions: as many arguments as enclosing : as many arguments as enclosing -variables-variables

Skolem normal form:Skolem normal form: transform to: transform to:

(( x) ( x) ( y) …( y) …( z) ( .. z) ( .. .. ) .. ) ( .. ( .. .. ) .. ) .. .. ( .. ( .. .. ) .. )

x rich(x)x rich(x) is replaced by is replaced by rich(rich(SkSk)) , with , with SkSk being a new constant (‘skolem constant’) that being a new constant (‘skolem constant’) that does not appear in the alphabet.does not appear in the alphabet.

More complexMore complex: if : if appears nested inside appears nested inside :: ‘‘Everyone has a heart’Everyone has a heart’

x person(x) x person(x) y heart(y) y heart(y) has(x,y) has(x,y)

Not correct:Not correct: x person(x) x person(x) heart( heart(HH) ) has(x, has(x,HH)) Correct:Correct: x person(x) x person(x) heart( heart(H(x)H(x)) ) has(x, has(x,H(x)H(x)))

Page 29: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

29

Predicate case: continuedPredicate case: continued

Clausal form:Clausal form:

x x y y z z (p(x) (p(x) ~q(y) ~q(y) ~r(y)) ~r(y)) (r(A) (r(A) q(z)) q(z)) ~s(x,y) ~s(x,y)

S = {S = {x x y (p(x) y (p(x) ~q(y) ~q(y) ~r(y)) ~r(y)) , , z (r(A) z (r(A) q(z)) q(z)) , , x x y ~s(x,y) y ~s(x,y) } }

S = {S = {p(x) p(x) q(y) q(y) r(y) r(y) , , r(A) r(A) q(z)) q(z)) , , false false s(x,y) s(x,y) } }

Disjunctions:Disjunctions:

Page 30: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

30

Explicit Procedure:Explicit Procedure:1.1. Eliminate Eliminate en en . .

2.2. Move the negations inside: Move the negations inside:~(~p) ~(~p) p p,, ~(p ~(p q) q) ~p ~p ~q ~q,, (analogously for(analogously for ))~~x x x ~ x ~ ,, ~ ~x x x ~x ~

3.3. Standardize variable names (make them different). Standardize variable names (make them different).

PRENEX NORMAL FORMPRENEX NORMAL FORM44.. Move quantifiers to front. Move quantifiers to front.

INTRODUCE SKOLEMSINTRODUCE SKOLEMS5.5. Eliminate Eliminate . .

CONJUNCTIVE FORMCONJUNCTIVE FORM6.6. Disjunctions inside. Disjunctions inside.

DISJUNC. SETDISJUNC. SET77.. Drop Drop ..8.8. Drop Drop ..

CLAUSAL FORMCLAUSAL FORM9.9. ~atoms to the other side. ~atoms to the other side.

Page 31: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

31

Marcus example:Marcus example:

xxyy ~(~(man(x)man(x) ruler(y)ruler(y) try_assassinate(x,y)try_assassinate(x,y))) ~loyal_to(x,y)~loyal_to(x,y)xxyy ~~man(x)man(x) ~~ruler(y)ruler(y) ~~try_assassinate(x,y)try_assassinate(x,y) ~loyal_to(x,y)~loyal_to(x,y)false false man(x)man(x) ruler(y)ruler(y) try_assassinate(x,y)try_assassinate(x,y) loyal_to(x,y)loyal_to(x,y)

x loyal_to(x,f(x))x loyal_to(x,f(x))loyal_to(x,f(x))loyal_to(x,f(x))

Facts Facts 1.1. , , 2.2. , , 4.4. and and 8.8. were already o.k.: were already o.k.: ex.:ex.: ruler(Caesar)ruler(Caesar)

3.3. x Pompeian(x)x Pompeian(x) Roman(x) : o.k. ! Roman(x) : o.k. ! 6.6. xx yy loyal_to(x,y)loyal_to(x,y)

7.7. xxy man(x)y man(x) ruler(y)ruler(y) try_assassinate(x,y)try_assassinate(x,y) ~loyal_to(x,y)~loyal_to(x,y)

Page 32: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

32

Axioms in Normal form:Axioms in Normal form: 1.1. man(Marcus) man(Marcus) 2.2. Pompeian(Marcus) Pompeian(Marcus) 3.3. Roman(x) Roman(x) Pompeian(x) Pompeian(x) 4.4. ruler(Caesar) ruler(Caesar) 5.5. loyal_to(x,Caesar) loyal_to(x,Caesar) hates(x,Caesar)hates(x,Caesar)

Roman(x)Roman(x) 6.6. loyal_to(x,f(x)) loyal_to(x,f(x)) 7.7. false false man(x) man(x) ruler(y)ruler(y) try_assassinate(x,y)try_assassinate(x,y)

loyal_to(x,y)loyal_to(x,y) 8.8. try_assassinate(Marcus,Caesar) try_assassinate(Marcus,Caesar)

To show: To show: hates(Marcus,Caesar)hates(Marcus,Caesar)Negation: Negation: ~hates(Marcus,Caesar)~hates(Marcus,Caesar)Normal Form: Normal Form: false false hates(Marcus,Caesar)hates(Marcus,Caesar)

Page 33: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

33

Resolution proof (1):Resolution proof (1):false false hates(Marcus,Caesar)hates(Marcus,Caesar)

loyal_to(x,Caesar) loyal_to(x,Caesar) hates(x,Caesar)hates(x,Caesar) Roman(x) Roman(x)

loyal_to(loyal_to(MarcusMarcus,Caesar) ,Caesar) Roman(Roman(MarcusMarcus))

{x/Marcus}{x/Marcus}

5.5.

Roman(x)Roman(x) Pompeian(x) Pompeian(x)

loyal_to(Marcus,Caesar) loyal_to(Marcus,Caesar) Pompeian(Pompeian(MarcusMarcus))

{x/Marcus}{x/Marcus}

3.3.

Pompeian(Marcus)Pompeian(Marcus)

loyal_to(Marcus,Caesar)loyal_to(Marcus,Caesar)

{}{}2.2.

Page 34: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

34

Resolution proof (2)Resolution proof (2)loyal_to(Marcus,Caesar)loyal_to(Marcus,Caesar)

false false man(x) man(x) ruler(y)ruler(y) try_assassinate(x,y)try_assassinate(x,y) loyal_to(x,y)loyal_to(x,y)

false false man(man(MarcusMarcus)) ruler(ruler(CaesarCaesar)) try_assassinate(try_assassinate(MarcusMarcus,,CaesarCaesar))

7.7.

{x/Marcus,y/Caesar}{x/Marcus,y/Caesar}

man(Marcus)man(Marcus)

false false ruler(Caesar)ruler(Caesar) try_assassinate(Marcus,Caesar)try_assassinate(Marcus,Caesar)

1.1.{}{}

ruler(Caesar)ruler(Caesar)

false false try_assassinate(Marcus,Caesar)try_assassinate(Marcus,Caesar)

4.4.

{}{}

try_assassinate(Marcus,Caesar)try_assassinate(Marcus,Caesar)

false false

8.8.

{}{}

Page 35: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

35

Example from Group Theory: Example from Group Theory:

Let Let be a group operation. be a group operation. Prefix notation: Prefix notation: p(x,y,z)p(x,y,z) xx y = zy = z Definition of a Definition of a monoid, with left-neutral and left inverse elementmonoid, with left-neutral and left inverse element::

is defined for all elements of the set:is defined for all elements of the set:

xxyyz p(x,y,z)z p(x,y,z)

is associative:is associative: (x (x y) y) z = x z = x (y (y z) z)

uu vvxxyyzzuuvvww(p(x,y,(p(x,y,uu) ) p(y,z, p(y,z,vv)) )) (p( (p(uu,z,,z,ww) ) p(x, p(x,vv,,ww))))

(1)(1)

(2)(2)

Page 36: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

36

Example from Example from Group Theory (2):Group Theory (2):

has a has a left neutralleft neutral and a and a left inverseleft inverse element element::

xx ((y p(y p(xx,y,y) ,y,y) yyzz p( p(zz,y,,y,xx))

TheoremTheorem: there exists also a : there exists also a right inverseright inverse ! !

(3)(3)

xx ((y p(y p(xx,y,y) ,y,y) yyzz p(y, p(y,zz,,xx)) (4)(4)

To be proved automatically by resolution.To be proved automatically by resolution.

Page 37: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

37

Normalization:Normalization:

(1) (1) xxyyz p(x,y,z)z p(x,y,z)

StepsSteps: 1,2,3,4: o.k.: 1,2,3,4: o.k. Step 5Step 5: skolemization:: skolemization:

xxy p(x,y,m(x,y))y p(x,y,m(x,y))

StepsSteps: 6,7: o.k.: 6,7: o.k. Step 8Step 8: clausal form:: clausal form:

p(x,y,m(x,y))p(x,y,m(x,y))

Page 38: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

38

Normalization (continued):Normalization (continued):

(2)(2) xxyyzzuuvvw w (p(x,y,u) (p(x,y,u) p(y,z,v)) p(y,z,v)) (p(u,z,w) (p(u,z,w) p(x,v,w)) p(x,v,w))

Step 1Step 1: eliminate : eliminate andand ::

xxyyzzuuvvw w (p(x,y,u) (p(x,y,u) p(y,z,v)) p(y,z,v)) ((((p(u,z,w) p(u,z,w) p(x,v,w) p(x,v,w)) ) ((p(x,v,w) p(x,v,w) p(u,z,w)p(u,z,w)))))

xxyyzzuuvvw w (p(x,y,u) (p(x,y,u) p(y,z,v)) p(y,z,v)) ((((~~p(u,z,w) p(u,z,w) p(x,v,w)) p(x,v,w)) ((~~p(x,v,w) p(x,v,w) p(u,z,w)))p(u,z,w)))xxyyzzuuvvw w ~~(p(x,y,u) (p(x,y,u) p(y,z,v)) p(y,z,v)) ((~p(u,z,w) ((~p(u,z,w) p(x,v,w)) p(x,v,w)) (~p(x,v,w) (~p(x,v,w) p(u,z,w)))p(u,z,w)))

Page 39: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

39

Normalization (continued):Normalization (continued):xxyyzzuuvvw w ~(p(x,y,u) ~(p(x,y,u) p(y,z,v)) p(y,z,v)) ((~p(u,z,w) ((~p(u,z,w) p(x,v,w)) p(x,v,w)) (~p(x,v,w) (~p(x,v,w) p(u,z,w)))p(u,z,w)))

xxyyzzuuvvw w ( (~~p(x,y,u) p(x,y,u) ~~p(y,z,v)) p(y,z,v)) ((~p(u,z,w) ((~p(u,z,w) p(x,v,w)) p(x,v,w)) (~p(x,v,w) (~p(x,v,w) p(u,z,w)))p(u,z,w)))

Step 2Step 2: move negation inside: move negation inside::

StepsSteps:: 3,4,5 o.k.3,4,5 o.k. Step 6Step 6: move disjunctions inside:: move disjunctions inside:

xxyyzzuuvvw w (((~p(x,y,u) (~p(x,y,u) ~p(y,z,v)) ~p(y,z,v)) (~p(u,z,w) (~p(u,z,w) p(x,v,w)) p(x,v,w))) ) (((~p(x,y,u) (~p(x,y,u) ~p(y,z,v)) ~p(y,z,v)) (~p(x,v,w) (~p(x,v,w) p(u,z,w)) p(u,z,w))))

A A

(B (B C) C)

A A (B (B C) = (A C) = (A B) B) (A (A C) C)

A A BB

A A CC

Page 40: AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

40

Normalization (continued):Normalization (continued):

xxyyzzuuvvw w ((~p(x,y,u) ((~p(x,y,u) ~p(y,z,v)) ~p(y,z,v)) (~p(u,z,w) (~p(u,z,w) p(x,v,w))) p(x,v,w))) ((~p(x,y,u) ((~p(x,y,u) ~p(y,z,v)) ~p(y,z,v)) (~p(x,v,w) (~p(x,v,w) p(u,z,w))) p(u,z,w)))

xxyyzzuuvvw w ((((~p(x,y,u) ~p(x,y,u) ~p(y,z,v) ~p(y,z,v))) ((~p(u,z,w) ~p(u,z,w) p(x,v,w) p(x,v,w)))) ) ((((~p(x,y,u) ~p(x,y,u) ~p(y,z,v) ~p(y,z,v))) ((~p(x,v,w) ~p(x,v,w) p(u,z,w) p(u,z,w))))) ++ remove redundant parentheses:remove redundant parentheses: ( )( )

xxyyzzuuvvw w (~p(x,y,u) (~p(x,y,u) ~p(y,z,v) ~p(y,z,v) ~p(u,z,w) ~p(u,z,w) p(x,v,w)) p(x,v,w)) (~p(x,y,u) (~p(x,y,u) ~p(y,z,v) ~p(y,z,v) ~p(x,v,w) ~p(x,v,w) p(u,z,w)) p(u,z,w))

Steps 7,8Steps 7,8: eliminate : eliminate en en ::

~p(x,y,u) ~p(x,y,u) ~p(y,z,v) ~p(y,z,v) ~p(x,v,w) ~p(x,v,w) p(u,z,w)p(u,z,w)

~p(x,y,u) ~p(x,y,u) ~p(y,z,v) ~p(y,z,v) ~p(u,z,w) ~p(u,z,w) p(x,v,w) p(x,v,w)