% Blocks' world adopted from Ilkka Niemelä's representation % (c) Tomi Janhunen % % The predicate move(X,Y,Z,T) is represented implicitly using % three predicates target(X,T), source(Y,T), and destination(Z,T) % % usage: lparse -ck= bw-split.lp | smodels 0 %%% Points of time %%% time(0..k). hide time(T). %%% Initial situation %%% on(a,b,0). on(b,c,0). on(c,f,0). on(d,f,0). clear(a,0). clear(d,0). hide clear(X,T). hide on(X,Y,T). %%% Final situation (after at most k actions) %%% :- not on(b,a,k). %%% Domain/auxiliary predicates %%% block(a). block(b). block(c). block(d). object(X) :- block(X). % The floor which cannot be mover, is never clear, and holds several blocks object(f). % Define objects that can hold blocks can_hold(f,T) :- time(T). can_hold(Z,T) :- clear(Z,T), block(Z), time(T). % Pairs of objects that are potentially involved in move operations diff(X,Y) :- X!=Y, block(X), object(Y). hide block(X). hide object(X). hide can_hold(Z,T). hide diff(X,Y). %%% Operator MOVE(X,Y,Z,T) split using target/source/destination %%% target(X,T) :- clear(X,T), on(X,Y,T), not denied_target(X,T), diff(X,Y), time(T), T