#const n=6. %%%%%%%%%%%%%%%%%%%% SCENARIO 2 %%%%%%%%%%%%%%%%%% % % % John took the plane from Paris to Baghdad. % % On the way the plane stopped in Rome. % % Is John in Baghdad? % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % THE TRANSLATION % Statement 1 and the query as before. % Statement 2 is new. % John took the plane from Paris to Baghdad. h(at(john,paris),0). o(go_on(john,j(paris,baghdad)),0). % On the way the plane stopped in Rome. o(stop(j(paris,baghdad),rome),2). % The query: answer_true(q) :- h(at(john,baghdad),n). answer_false(q) :- -h(at(john,baghdad),n). type_query(q,boolean). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % The difficulty with the translation of % statement 2 is in figuring out that "stopping % in Rome" happened between departure from Paris % and arrival in Baghdad. But even if this is done % we need to determine the exact "step" when % it occurs (in our case, 2). % One possible way to find this value is to % translate the first sentence and run % the program with n=1,2,... as before. % With n=4 you'll obtain: % do(embark(john,j(paris,baghdad)),0) % do(depart(j(paris,baghdad)),1) % do(stop(j(paris,baghdad),baghdad),2) % do(disembark(john,j(paris,baghdad)),3) % This information can be useful in determining % that stopping in Rome happened at step 2. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % As before we'll run the program together with % the rules and directives below. 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).