%%%%%%  THIS IS A MODIFICATION of scenario0 
%%%%%%  in which we have a more detailed
%%%%%%  information about the trip itinerary.
%%%%%%  New thing in the theory of travel are 
%%%%%%  marked by the word itinerary

#const n=8.

%%%%%%%%%%%%%%%%%%%%  SCENARIO 1 %%%%%%%%%%%%%%%%%%
%                                                 %
%     John took the plane from Paris to Baghdad.  %
%     The plane has sceduled intermediate stops   %
%     in Berlin and Rome. Is John in Baghdad?     %
%                                                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%           THE TRANSLATION

%  The first statement and the query are translated
%  as in scenario0. 
%  To tranalsate the second statement we need
%  to recall that leg_of(J,C1,C2) says that 
%  "C2 is the  next stop of J after C1".
%  Overall we have:

%     John took the plane from Paris to Baghdad. 

            h(at(john,paris),0).
            o(go_on(john,j(paris,baghdad)),0).

%     The plane has sceduled intermediate stops   
%     in Berlin and Rome. 

            leg_of(j(paris,baghdad),paris,berlin).
            leg_of(j(paris,baghdad),berlin,rome).
            leg_of(j(paris,baghdad),rome,baghdad).

%  The query:

answer_true(q) :-
	h(at(john,baghdad),n).
answer_false(q) :-
	-h(at(john,baghdad),n).
type_query(q,boolean).   


% As before we'll run the program together with
% the rules and directives below.
% Note that this time n=8.

       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.

hide.

show yes,no,maybe,do(A,B).
