Loading in 5 sec....

Describing State ChangePowerPoint Presentation

Describing State Change

- 100 Views
- Uploaded on
- Presentation posted in: General

Describing State Change

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

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.

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

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

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

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

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

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

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

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.

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

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”

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].

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))