% % the Yale shooting problem -- no 'dead' fluent % % to see what happens, % uncomment one of the line starting with %%% % and use the command % lparse -c n=1 yale-occ.lp | smodels % or % lparse -c n=2 yale-occ.lp | smodels % define fluents and actions fluent(alive). fluent(loaded). action(shoot). action(load). % define time line time(0..n). % initial state h(alive, 0). h(neg(loaded), 0). % action effects % shooting causes neg(alive) h(neg(alive), T+1):- time(T), o(shoot, T), h(loaded, T). h(neg(loaded), T+1):- time(T), o(shoot, T), h(loaded, T). % loading causes loaded h(loaded, T+1):- time(T), o(load, T). % action occurrences %%%o(shoot, 0). %%%o(load, 0). o(shoot, 1). %%% o(load, 0). o(load, 1). %%% :- not h(neg(alive),n). % what was missing is the rule that say "thing do not % change by themselve" % F was true at T and is not false at T+1 then % F must continue to be true at T h(F, T+1):- time(T), T