\begin{verbatim}
%%
%% block2-2-1.sm
%%
%% This program tests if the encoding for appx planning is
%% correct or not.
const length=2.
time(1..length).
initially(neg(f)).
fluent(f).
fluent(p).
action(a).
action(b).
executable(A,T) :-
action(A),
time(T).
causes(a, f, s5).
in(p, s5).
causes(b, p, s6).
set(s5).
set(s6).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
goal(T) :-
time(T),
not holds(f,T),
not holds(neg(f), T).
% We are looking for a plan that makes f unknown.
exists_plan :-
goal(length).
:- not exists_plan.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
literal(G) :-
fluent(G).
literal(neg(G)) :-
fluent(G).
contrary(F, neg(F)) :-
fluent(F).
contrary(neg(F), F) :-
fluent(F).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
not_holds_set(S, T) :-
set(S),
time(T),
literal(L),
in(L,S),
not holds(L,T).
holds_set(S, T) :-
set(S),
time(T),
not not_holds_set(S,T).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
m_not_holds_set(S, T) :-
set(S),
time(T),
literal(L),
literal(LL),
in(L,S),
contrary(L,LL),
holds(LL,T).
m_holds_set(S, T) :-
set(S),
time(T),
not m_not_holds_set(S,T).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
holds(F, 1) :-
literal(F),
initially(F).
holds(F, T+1) :-
literal(F),
time(T),
set(S),
T < length,
action(A),
executable(A,T),
occurs(A,T),
causes(A,F,S),
holds_set(S,T).
ab(F, T+1) :-
literal(F),
time(T),
set(S),
T < length,
action(A),
executable(A,T),
occurs(A,T),
causes(A,F,S),
m_holds_set(S,T).
holds(F, T+1) :-
literal(F),
literal(G),
contrary(F,G),
time(T),
T < length,
holds(F,T),
not ab(G, T+1).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
possible(A,T) :-
action(A),
time(T),
executable(A,T),
not goal(T).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
occurs(A,T) :-
action(A),
time(T),
possible(A,T),
not not_occurs(A,T).
not_occurs(A,T) :-
action(A),
action(AA),
neq(A,AA),
time(T),
occurs(AA,T).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
hide time(T).
hide action(A).
hide causes(A,F,S).
hide initially(F).
hide contrary(F,G).
hide fluent(F).
hide literal(L).
hide executable(A,T).
hide holds(F,T).
hide not_occurs(A,T).
hide possible(A,T).
% hide possible1(A,T).
% hide possible2(A,T).
% hide block(X).
hide exists_plan.
hide finally(X).
hide goal(T).
% hide not_goal(T).
hide set(S).
hide in(X,Y).
hide holds_set(X,Y).
hide not_holds_set(X,Y).
% hide exec(A,S).
% hide not_executable(A,T).
hide ab(F,T).
hide m_not_holds_set(S, T).
hide m_holds_set(S, T).
\end{verbatim}