1 / 14

Describing State Change

Describing State Change. Predicate logic is stateless: if p(a) can once be deduced from a set of axioms then it can always be deduced from those axioms. Modelling the real world, however, requires us to talk about state change.

bin
Download Presentation

Describing State Change

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Describing State Change Predicate logic is stateless: if p(a) can once be deduced from a set of axioms then it can always be deduced from those axioms. Modelling the real world, however, requires us to talk about state change. We look at one simple (but common) way to model state in a stateless logic.

  2. Blocks World Example Op1 Opn trans(Block, From, To) …….. a c b a b c t1 t2 t3 t1 t2 t3

  3. State Change as Recursion poss(s0). poss(do(Op, S)) :- poss(S), pact(do(Op, S)). do(Op2 , do(Op1, s0 ) ) do( Op1, s0 ) s0 c a b t1 t2 t3

  4. Possible Actions pact(do(trans(X, Y, Z), S)) :- holds(clr(Z), S), holds(clr(X), S), holds(on(X, Y), S), \+(X = Z), \+(Z = Y), \+(X = Y). trans(c, a, t3) clr(t3) clr(c) c on(c,a) c a b a b t1 t2 t3 t1 t2 t3

  5. Initial Conditions holds(on(c,a), s0). holds(on(a,t1), s0). holds(on(b,t2), s0). holds(clr(c), s0). holds(clr(b), s0). holds(clr(t3), s0). c a b t1 t2 t3

  6. Transition Effects on State holds(clr(Y), do(trans(_, Y, _), _)). holds(on(X, Z), do(trans(X, _, Z), _)). trans(c, a, t3) clr(a) c c a b a b on(c,t3) t1 t2 t3 t1 t2 t3

  7. Frame Axiom holds(C, do(trans(X, Y, Z), S)) :- holds(C, S), \+(C = clr(Z)), \+(C = on(X, Y)). clr(t3) trans(c, a, t3) on(c,a) on(a,t1) on(a,t1) on(b,t2) on(b,t2) c clr(c) clr(c) c a b a b t1 t2 t3 clr(b) clr(b) t1 t2 t3

  8. Goal State goal :- poss(S), holds(on(a,b), S), holds(clr(a), S), holds(on(b,c), S), holds(on(c,t3), S), holds(clr(t1), S), holds(clr(t2), S). a b c t1 t2 t3

  9. Plan poss(do(trans(a,t1,b), do(trans(b,t2,c), do(trans(c,a,t3), s0)))) trans(c, a, t3) trans(b, t2, c) trans(a, t1, b) a b c b c a b c a a b c t1 t2 t3 t1 t2 t3 t1 t2 t3 t1 t2 t3

  10. Subsumption Based Systems • Subsumption based inference is used in programming systems that employ types, classes, description logics and the like. • We look at how to infer subsumption in two ways: • Through term structure; • Through translation to FOPC • There are other ways (e.g. by writing a type unification system) but we don’t cover those.

  11. Term Encoding For Subsumption animal vehicle mammal reptile car bus dog Type described as a structured term e.g. animal(mammal(dog(X))) | ?- animal(X) = animal(mammal(Y)). X = mammal(Y) | ?- animal(X) = vehicle(Y). no | ?- animal(mammal(dog(rover))) = vehicle(car(rover)). no

  12. Vocabulary Describing Classes “Mammals are animals” “Mammals are warm blooded and lactating” subclass(mammal, animal) subclass(intersection(warm_blooded, lactating), mammal) domain(biomass,animal) range(biomass,number) etc… “Biomass is a function over animals” “Biomass is a function returning a number”

  13. Translator to FOPC th(A, X, T) :- atom(A), T =.. [A,X]. th(intersection(C,D), X, (T1,T2)) :- th(C, X, T1), th(D, X, T2). th(all(R,C), X, (T1 :- T2)) :- th(C, Y, T1), T2 =.. [R,X,Y]. tb(A, X, T) :- atom(A), T =.. [A,X]. tb(intersection(C,D), X, (T1,T2)) :- tb(C, X, T1), tb(D, X, T2). tb(union(C,D), X, (T1 ; T2)) :- tb(C, X, T1), tb(D, X, T2). tb(some(R,C), X, (T1,T2)) :- tb(C, Y, T2), T1 =.. [R,X,Y]. t(subclass(C,D), (T1 :- T2)) :- th(D, Y, T1), tb(C, Y, T2). t(equivalent(C,D), (T1,T2)) :- t(subclass(C,D), T1), t(subclass(D,C), T2). t(range(R,D), (T1 :- T2)) :- th(D, Y, T1), T2 =.. [R,_,Y]. t(domain(R,D), (T1 :- T2)) :- th(D, X, T1), T2 =.. [R,X,_]. t(X : A, T) :- th(A, X, T). t((X1,X2):R, T) :- atom(R), T =.. [R,X1,X2].

  14. Applying FOPC Translator | ?- t(subclass(mammal, animal), S). S = (animal(X) :- mammal(X)) | ?- t(subclass(intersection(warm_blooded, lactating), mammal), R). R = (mammal(X) :- warm_blooded(X), lactating(X)) | ?- t(domain(biomass,animal), D). D = (animal(X) :- biomass(X,_)) | ?- t(range(biomass,number), R). R = (number(X) :- biomass(_,X))

More Related