% This is a simple scenario - a short story,
% followed by a question.

%%%%%%%%%%%%%%%%%%%%   SCENARIO 0 %%%%%%%%%%%%%%%%%

%     John took the plane from Paris to Baghdad.  %
%     Is John in Baghdad?                         %

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

#const n=4.

% The story should be tranlated into a collection
% of atoms and a definition of constant n (number
% of steps of the domain) which will be used in 
% conjunction with the travel  module. 

% WE DO TRANSLATION BY HAND. THE PROBLEM IS TO DO
% IT AUTOMATICALLY.

%           THE TRANSLATION

% Recall that h(F,S) says that fluent F is true at step S,
% and o(A,S) says that action A occur at S.

%   John took the plane from Paris to Baghdad. 

            h(at(john,paris),0).
            o(go_on(john,j(paris,baghdad)),0).

%  The query is translated as:

% the answer to the query is "true" if...
answer_true(q) :-
	h(at(john,baghdad),n).	% John is in Baghdad at the current step

% the answer to the query is "false" if...
answer_false(q) :-
	-h(at(john,baghdad),n).	% John is not in Baghdad at the current step

% the answer to the query is yes, no, or maybe.
type_query(q,boolean).   

% To answer the query we will use the rules:

       yes :- 
           type_query(Q,boolean),
           answer_true(Q).

       no :- 
           type_query(Q,boolean),
           answer_false(Q).

       maybe :- 
           type_query(Q,boolean),
           not yes, 
           not no.

% together with Smodels display directives

hide.
show yes, no, maybe.

% Note that the value of "n" is not given in advance. 
% The right number is 4. Using larger values will
% not change the answer to a query which will persist
% by inertia.
% How "n" will be computed by the corresponding natural language
% translator (NLT) is an open question.
% One possibility is to run the program with n = 1,2,...
% and display the actions. Stop when the last action 
% occurs at n-1.

% To see how it works uncomment the "show" statement below
% and run the program with i = 1..4.

% show do(A,B). 
 

%lparse --true-negation scenario0 travel | smodels 0 | mkatoms
