patrick
/
plasp
Archived
1
0
Fork 0

Added sequential, incremental encoding for translated ASP output.

This commit is contained in:
Patrick Lühne 2016-05-22 22:50:20 +02:00
parent d8b87c7bfa
commit a61c1f45c4
1 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,30 @@
#include <incmode>.
#program base.
% Establish initial state
holds(F, 0) :- initialState(F).
#program step(t).
% Perform actions
1 {occurs(A, t) : action(A)} 1.
% Check preconditions
:- occurs(A, t), precondition(A, F, true), not holds(F, t - 1).
:- occurs(A, t), precondition(A, F, false), holds(F, t - 1).
% Apply effects
holds(F, t) :- occurs(A, t), postcondition(A, F, true), action(A).
deleted(F, t) :- occurs(A, t), postcondition(A, F, false), action(A).
holds(F, t) :- holds(F, t - 1), not deleted(F, t).
#program check(t).
% Verify that goal is met
:- query(t), goal(F, true), not holds(F, t).
:- query(t), goal(F, false), holds(F, t).
#show query/1.
#show holds/2.
#show occurs/2.