Changed SAS translator output format once more to make it even closer to the SAS format.
This commit is contained in:
@@ -3,33 +3,27 @@
|
||||
#program base.
|
||||
|
||||
% Establish initial state
|
||||
holds(F, 0) :- initialState(F).
|
||||
holds(Var, Val, 0) :- initialState(Var, Val).
|
||||
|
||||
#program step(t).
|
||||
|
||||
% Perform actions
|
||||
1 {occurs(A, t) : action(A)} 1.
|
||||
1 {occurs(action(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).
|
||||
:- occurs(A, t), precondition(A, Var, Val), not holds(Var, Val, 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).
|
||||
caused(Var, Val, t) :- occurs(A, t), postcondition(A, Var, Val).
|
||||
modified(Var, t) :- caused(Var, Val, t).
|
||||
|
||||
% Enforce mutexes
|
||||
deleted(F2, t) :- mutex(F1, true, F2, true), holds(F1, t).
|
||||
holds(F2, t) :- mutex(F1, true, F2, false), holds(F1, t).
|
||||
deleted(F2, t) :- mutex(F1, false, F2, true), not holds(F1, t).
|
||||
holds(F2, t) :- mutex(F1, false, F2, false), not holds(F1, t).
|
||||
holds(Var, Val, t) :- caused(Var, Val, t).
|
||||
holds(Var, Val, t) :- holds(Var, Val, t - 1), not modified(Var, 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).
|
||||
:- query(t), goal(Var, Val), not holds(Var, Val, t).
|
||||
|
||||
#show query/1.
|
||||
#show occurs/2.
|
||||
|
Reference in New Issue
Block a user