Download presentation

Presentation is loading. Please wait.

Published byOwen Larson Modified over 4 years ago

1
After the Practical on Clausal Form and Resolution Question 5 Proving the query of Question 4

2
Background We started out from these two formulas: opp(off,on) opp(on,off) X Y(opp(X,Y) (next(s(X,off,Y),s(X,on,off) next(s(X,on,off),s(Y,off,X)))) trying to prove the query of Q4: ABCDVS (next(s(A,B,V),S) next(S,s(C,D,V)))

3
What the second formula means X Y(opp(X,Y) (next(s(X,off,Y),s(X,on,off) next(s(X,on,off),s(Y,off,X)))) There are only two kinds of transitions, namely next(s(X,off,Y),s(X,on,off) and next(s(X,on,off),s(Y,off,X)

4
What needs to be done (intuitive view) From opp(off,on) opp(on,off) X Y(opp(X,Y) (next(s(X,off,Y),s(X,on,off) next(s(X,on,off),s(Y,off,X)))) Prove: ABCDVS (next(s(A,B,V),S) next(S,s(C,D,V)))

5
What needs to be done (using resolution) Given opp(off,on) opp(on,off) X Y(opp(X,Y) (next(s(X,off,Y),s(X,on,off) next(s(X,on,off),s(Y,off,X)))) Refute: ABCDVS (next(s(A,B,V),S) next(S,s(C,D,V)))

6
What needs to be done To use resolution write everything in clausal form use :- The results are as follows:

7
Proving 5 from 1-4 1.opp(off,on) :- 2.opp(on,off) :- 3.next(s(X,off,Y),s(X,on,off)) :- opp(X,Y) 4.next(s(X,on,off),s(Y,off,X)) :- opp(X,Y) 5.:- next(s(A,B,V),S), next(S,s(C,D,V)) Lets proceed as human calculators first

8
From 1-4, using Modus Ponens 1.opp(off,on) :- 2.opp(on,off) :- 3.next(s(X,off,Y),s(X,on,off)) :- opp(X,Y) 4.next(s(X,on,off),s(Y,off,X)) :- opp(X,Y) next(s(off,off,on),s(off,on,off)) (1,3) X=off,Y=on next(s(on,off,off),s(on,on,off)) (2,3) X=on,Y=off next(s(off,on,off),s(on,off,off)) (1,4) X=off,Y=on next(s(on,on,off),s(off,off,on)) (2,4) X=on,Y=off

9
Informally: suppose s(a,b,c)=s(red,amber,green). Then next s(off,off,on) [go] s(off,on,off) [almost stop] next s(on,off,off) [stop] s(on,on,off) [almost go] next s(off,on,off) [almost stop] s(on,off,off) [stop] next(s(on,on,off) [almost go] s(off,off,on) [go]

10
Proving (5) from what we know 1. next (s(off,off,on), s(off,on,off)) 2. next (s(on,off,off), s(on,on,off)) 3. next (s(off,on,off), s(on,off,off)) 4. next (s(on,on,off), s(off,off,on)) (5) asks: Can you go from a state (..,..,V) to another state S, from which you can go to another state (..,..,V) ? 5. :- next(s(A,B,V),S), next(S,s(C,D,V))

11
1. next (s(off,off,on), s(off,on,off)) 2. next (s(on,off,off), s(on,on,off)) 3. next (s(off,on,off), s(on,off,off)) 4. next (s(on,on,off), s(off,off,on)) The following transitions are possible: 1,3 goes from (.,.,on) via (.,.,off) to (.,.,off) 2,4 goes from (.,.,off) via (.,.,off) to (.,.,on) 3,2 goes from (.,.,off) via (.,.,off) to (.,.,off) ! 4,1 goes from (.,.,off) via (.,.,on) to (.,.,off) !

12
3,2 goes from (.,.,off) via (.,.,off) to (.,.,off) ! 4,1 goes from (.,.,off) via (.,.,on) to (.,.,off) ! These are the ones that allow us to prove 5. :- next(s(A,B,V),S), next(S,s(C,D,V)) The unifications enabling us to prove this: 1. next (s(off,off,on), s(off,on,off)) 2. next (s(on,off,off), s(on,on,off)) 3. next (s(off,on,off), s(on,off,off)) 4. next (s(on,on,off), s(off,off,on)) (3,2): A=off,B=on,V=off,S=(on,off,off),C=on,D=on (4,1): A=on,B=on,V=off,S=(off,off,on),C=off,D=on

13
What would SLD resolution do? Modus Ponens is not a rule (as such) All we have is resolution Recall: a goal p can be proven either because its a fact, or because theres a rule p :- q1,..,qn, where each of q1,..,qn can be proven.

14
Proving 5 from 1-4 1.opp(off,on) :- 2.opp(on,off) :- 3.next(s(X,off,Y),s(X,on,off)) :- opp(X,Y) 4.next(s(X,on,off),s(Y,off,X)) :- opp(X,Y) 5.:- next(s(A,B,V),S), next(S,s(C,D,V)) Now with resolution (selecting leftmost literal first). Choose matching clauses smartly, based on our thinking so far.

15
Proving 5 from 1-4 5 :- next(s(A,B,V),S), next(S,s(C,D,V)) First step: match next(s(A,B,V),S) with clause 4: 4. next(s(X,on,off),s(Y,off,X)) :- opp(X,Y) After replacement, our new goal is :- opp(X,Y), next(S,s(C,D,V)) We have made these unifications: A=X,B=on,V=off,S=(Y,off,X). Second step: we might for example choose unifications X=on, Y=off, to prove opp(X,Y)

16
Proving 5 from 1-4 We had :- opp(X,Y), next(S,s(C,D,V)) After proving opp(X,Y) using a fact in the KB, we only have to prove :- next(S,(s(C,D,V)) (The story so far: Lets try the transition next(s(X,on,off),s(Y,off,X)) where X=on,Y=off. This is: next(s(on,on,off),s(off,off,on)).)

17
Proving 5 from 1-4 Recall that the subgoal we now need to prove is :- next(S,s(C,D,V)) Third step: prove this goal, using the clause 3. next(s(X,off,Y),s(X,on,off)) :- opp(X,Y) This means we have to use these unifications: S=(X,off,Y), C=X,D=on, (V=off) But wait: these X and Y dont necessarily have the same value as the ones we used for clause 4! So, lets call the new ones X and Y:

18
Using X and Y for clause 3 Recall that the goal we now need to prove is :- next(S,s(C,D,V)) Third step: prove this goal, using 3. next(s(X,off,Y),s(X,on,off)) :- opp(X,Y) This means we have to use these unifications: S=(X,off,Y), C=X,D=on,(V=off),X=Y,Y=X We can now replace next(S,s(C,D,V)) by :- opp(X,Y)

19
Proving 5 from 1-4 Fourth step: prove :- opp(X,Y) But we have already decided to unify X= on, Y=off, X=Y and Y=X. So, we prove this goal with X=off, Y=on, using clause 1: opp(off,on) :- We now replace opp(X,Y) by the empty clause, so there is nothing left to prove: :-

20
Proving 5 from 1-4 A table summarising this resolution process can be found in the answer to Question 5. Please note: This shows a sequence of choices that happen to prove the query quickly An automated procedure would almost certainly take longer There is one other solution. Can you spot it?

Similar presentations

OK

Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.

Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on genetically modified crops Download ppt on resources and development Ppt on area of parallelogram and triangles in real life Ppt on australian continental divide Ppt on quality of higher education in india Download ppt on natural resources for class 10 Ppt on natural resources class 8 Ppt on challenges of democracy in india Download ppt on 4 p's of marketing Ppt on tcp/ip protocol suite solutions