Advertisement
logicmoo

FLUX PLAYER - SWI-Prolog

Feb 8th, 2016
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 49.22 KB | None | 0 0
  1.  
  2. % :- [flux_swi].
  3.  
  4. %%% has(1) = has(gold) ; has(2) = has(arrow)
  5.  
  6. %%%
  7. %%% Specify range of cave
  8. %%%
  9.  
  10. xdim(10).
  11. ydim(12).
  12.  
  13. %%%
  14. %%% Specify number of randomly generated pits
  15. %%%
  16.  
  17. no_of_random_pits(12).
  18.  
  19.  
  20. % :- [wumpus_simulator].
  21.  
  22. state_update(Z1,enter,Z2,[B,S,G]) :-
  23.   update(Z1,[at(1,1),facing(1)],[],Z2),
  24.   breeze_perception(1,1,B,Z2),
  25.   stench_perception(1,1,S,Z2),
  26.   glitter_perception(1,1,G,Z2).
  27.  
  28. state_update(Z1,exit,Z2,[]) :-
  29.   holds(facing(D),Z1),
  30.   update(Z1,[],[at(1,1),facing(D)],Z2).
  31.  
  32. state_update(Z1,turn,Z2,[]) :-
  33.   holds(facing(D),Z1),
  34.   (D#<4 #/\ D1#=D+1) #\/ (D#=4 #/\ D1#=1),
  35.   update(Z1,[facing(D1)],[facing(D)],Z2).
  36.  
  37. state_update(Z1,grab,Z2,[]) :-
  38.   holds(at(X,Y),Z1),
  39.   update(Z1,[has(1)],[gold(X,Y)],Z2).
  40.  
  41. state_update(Z1,shoot,Z2,[S]) :-
  42.   ( S=true, update(Z1,[dead],[has(2)],Z2)
  43.     ; S=false, update(Z1,[],[has(2)],Z2) ).
  44.  
  45. state_update(Z1,go,Z2,[B,S,G]) :-
  46.   holds(at(X,Y),Z1), holds(facing(D),Z1),
  47.   adjacent(X,Y,D,X1,Y1),
  48.   update(Z1,[at(X1,Y1)],[at(X,Y)],Z2),
  49.   breeze_perception(X1,Y1,B,Z2),
  50.   stench_perception(X1,Y1,S,Z2),
  51.   glitter_perception(X1,Y1,G,Z2).
  52.  
  53. stench_perception(X,Y,Percept,Z) :-
  54.   XE#=X+1, XW#=X-1, YN#=Y+1, YS#=Y-1,
  55.   ( Percept=false, not_holds(wumpus(XE,Y),Z),
  56.                    not_holds(wumpus(XW,Y),Z),
  57.                    not_holds(wumpus(X,YN),Z),
  58.                    not_holds(wumpus(X,YS),Z) ;
  59.     Percept=true,
  60.       or_holds([wumpus(XE,Y),wumpus(X,YN),
  61.                 wumpus(XW,Y),wumpus(X,YS)],Z) ).
  62.  
  63. breeze_perception(X,Y,Percept,Z) :-
  64.   XE#=X+1, XW#=X-1, YN#=Y+1, YS#=Y-1,
  65.   ( Percept=false, not_holds(pit(XE,Y),Z),
  66.                    not_holds(pit(XW,Y),Z),
  67.                    not_holds(pit(X,YN),Z),
  68.                    not_holds(pit(X,YS),Z) ;
  69.     Percept=true,
  70.       or_holds([pit(XE,Y),pit(X,YN),
  71.                 pit(XW,Y),pit(X,YS)],Z) ).
  72.  
  73. glitter_perception(X,Y,Percept,Z) :-
  74.   Percept=false, not_holds(gold(X,Y),Z) ;
  75.   Percept=true,  holds(gold(X,Y),Z).
  76.  
  77. adjacent(X,Y,D,X1,Y1) :-
  78.   xdim(XD), ydim(YD),
  79.   X in 1..XD, X1 in 1..XD, Y in 1..YD, Y1 in 1..YD, D in 1..4,
  80.       (D#=1) #/\ (X1#=X)   #/\ (Y1#=Y+1) % north
  81.   #\/ (D#=3) #/\ (X1#=X)   #/\ (Y1#=Y-1) % south
  82.   #\/ (D#=2) #/\ (X1#=X+1) #/\ (Y1#=Y)   % east
  83.   #\/ (D#=4) #/\ (X1#=X-1) #/\ (Y1#=Y).  % west
  84.  
  85. init(Z0) :- Z0 = [has(2),wumpus(WX,WY)|Z],
  86.             xdim(XD), ydim(YD), XD1 is XD+1, YD1 is YD+1,
  87.             WX in 1..XD, WY in 1..YD,
  88.             not_holds(wumpus(1,1),Z0),
  89.             not_holds_all(wumpus(_,_),Z),
  90.             not_holds(dead,Z),
  91.             not_holds(pit(1,1),Z),
  92.             not_holds_all(pit(_,0),Z), %boundary
  93.             not_holds_all(pit(_,YD1),Z),
  94.             not_holds_all(pit(0,_),Z),
  95.             not_holds_all(pit(XD1,_),Z),
  96.             not_holds_all(at(_,_),Z),
  97.             not_holds_all(facing(_),Z),
  98.             duplicate_free(Z0).
  99.  
  100. main :- init_simulator,
  101.         init(Z0), execute(enter,Z0,Z1),
  102.         Cpts=[1,1,[1,2]], Vis=[[1,1]], Btr=[],
  103.         main_loop(Cpts,Vis,Btr,Z1).
  104.  
  105. main_loop([X,Y,Choices|Cpts],Vis,Btr,Z) :-
  106.   Choices=[Dir|Dirs] ->
  107.     (explore(X,Y,Dir,Vis,Z,Z1) ->
  108.        knows_val([X1,Y1],at(X1,Y1),Z1),
  109.        hunt_wumpus(X1,Y1,Z1,Z2),
  110.        (knows(gold(X1,Y1),Z2) ->
  111.           execute(grab,Z2,Z3), go_home(Z3)
  112.         ; Cpts1=[X1,Y1,[1,2,3,4],X,Y,Dirs|Cpts],
  113.           Vis1=[[X1,Y1]|Vis], Btr1=[X,Y|Btr],
  114.           main_loop(Cpts1,Vis1,Btr1,Z2) )
  115.      ; main_loop([X,Y,Dirs|Cpts],Vis,Btr,Z) )
  116.   ; backtrack(Cpts,Vis,Btr,Z).
  117.  
  118. explore(X,Y,D,V,Z1,Z2) :-
  119.   adjacent(X,Y,D,X1,Y1), \+ member([X1,Y1],V),
  120.   knows_not(pit(X1,Y1),Z1),
  121.   (knows_not(wumpus(X1,Y1),Z1);knows(dead,Z1)),
  122.   turn_to(D,Z1,Z), execute(go,Z,Z2).
  123.  
  124. backtrack(_,_,[],Z) :- execute(exit,Z,_).
  125. backtrack(Cpts,Vis,[X,Y|Btr],Z) :-
  126.   go_back(X,Y,Z,Z1), main_loop(Cpts,Vis,Btr,Z1).
  127.  
  128. go_back(X,Y,Z1,Z2) :-
  129.   holds(at(X1,Y1),Z1), adjacent(X1,Y1,D,X,Y),
  130.   turn_to(D,Z1,Z), execute(go,Z,Z2).
  131.  
  132. turn_to(D,Z1,Z2) :-
  133.   knows(facing(D),Z1) -> Z2=Z1
  134.   ; execute(turn,Z1,Z), turn_to(D,Z,Z2).
  135.  
  136. hunt_wumpus(X,Y,Z1,Z2) :-
  137.   \+ knows(dead,Z1),
  138.   knows_val([WX,WY],wumpus(WX,WY),Z1),
  139.   in_direction(X,Y,D,WX,WY)
  140.   -> turn_to(D,Z1,Z), execute(shoot,Z,Z2)
  141.    ; Z2=Z1.
  142.  
  143. in_direction(X,Y,D,X1,Y1) :-
  144.   xdim(XD), ydim(YD),
  145.   X in 1..XD, X1 in 1..XD, Y in 1..YD, Y1 in 1..YD, D in 1..4,
  146.       (D#=1) #/\ (X1#=X) #/\ (Y1#>Y)  % north
  147.   #\/ (D#=3) #/\ (X1#=X) #/\ (Y1#<Y)  % south
  148.   #\/ (D#=2) #/\ (X1#>X) #/\ (Y1#=Y)  % east
  149.   #\/ (D#=4) #/\ (X1#<X) #/\ (Y1#=Y). % west
  150.  
  151. go_home(Z) :- write('Planning...'),
  152.               a_star_plan(Z,S), execute(S,Z,Z1), execute(exit,Z1,_).
  153.  
  154. %%
  155. %% a_star_plan(Z,S)
  156. %%
  157. %% use A* planning to find situation S representing the shortest path to (1,1)
  158. %%
  159.  
  160. :- dynamic visited/2.
  161.  
  162. a_star_plan(Z,S) :-
  163.    retractall(visited(_,_)),
  164.    knows_val([X,Y],at(X,Y),Z), assertz(visited(X,Y)),
  165.    a_star(Z,[[],0,100000],S).
  166.  
  167. a_star(Z,[Sit,Cost,_|L],S) :-
  168.    findall([A,H], a_star_do(Z,Sit,A,H), Actions),
  169.    ( member([Action,0], Actions) -> S=do(Action,Sit)
  170.      ;
  171.      insert_all(Actions, Sit, Cost, L, L1),
  172.      a_star(Z, L1, S) ).
  173.  
  174. insert_all([],_,_,L,L).
  175.  
  176. insert_all([[A,H]|As],S,C,L,L2) :-
  177.    insert_all(As,S,C,L,L1),
  178.    Cost is C+1, Heuristic is Cost+H,
  179.    ins(do(A,S),Cost,Heuristic,L1,L2).
  180.  
  181. ins(S1,C1,H1,[S2,C2,H2|L],L2) :-
  182.    ( H1>H2 -> ins(S1,C1,H1,L,L1), L2=[S2,C2,H2|L1]
  183.      ;
  184.      L2=[S1,C1,H1,S2,C2,H2|L] ).
  185.  
  186. ins(S,C,H,[],[S,C,H]).
  187.  
  188. a_star_do(Z,S,A,H) :-
  189.   ( S=do(go_to(X,Y),_) -> true ; knows_val([X,Y],at(X,Y),Z) ),
  190.   ( D=4 ; D=3 ; D=2 ; D=1 ),
  191.   adjacent(X,Y,D,X1,Y1), \+ visited(X1,Y1),
  192.   knows_not(pit(X1,Y1),Z),
  193.   ( \+ knows(dead,Z)->knows_not(wumpus(X1,Y1),Z)
  194.     ; true ),
  195.   A = go_to(X1,Y1),
  196.   assertz(visited(X1,Y1)),
  197.   H is X1+Y1-2.
  198.  
  199. complex_action(do(A,S),Z1,Z2) :-
  200.   execute(S,Z1,Z), execute(A,Z,Z2).
  201.  
  202. complex_action(go_to(X,Y),Z1,Z2) :-
  203.   holds(at(X1,Y1),Z1), adjacent(X1,Y1,D,X,Y),
  204.   turn_to(D,Z1,Z), execute(go,Z,Z2).
  205.  
  206.  
  207.  
  208.  
  209. :- use_module(library(terms)).
  210. :- use_module(library(varnumbers)).
  211.  
  212. :- use_module( library(random)).
  213.  
  214. :- dynamic current_state/1.
  215.  
  216. init_simulator :- init_scenario,
  217.                   retractall(current_state(_)), assertz(current_state([])).
  218.  
  219. :- dynamic wumpus/2,pit/2,gold/2.
  220.  
  221. init_scenario :-
  222.  
  223.    retractall(wumpus(_,_)), retractall(pit(_,_)), retractall(gold(_,_)),
  224.  
  225.    xdim(XD), ydim(YD),
  226.  
  227.    random(0,4294967296,N1), random(0,4294967296,N2), XW is N1 mod XD + 1, YW is N2 mod YD + 1,
  228.    ( XW=1, YW=1 -> true ; assertz(wumpus(XW,YW)), write(wumpus(XW,YW)) ),
  229.  
  230.    random(0,4294967296,N3), random(0,4294967296,N4), XG is N3 mod XD + 1, YG is N4 mod YD + 1,
  231.    assertz(gold(XG,YG)), write(gold(XG,YG)),
  232.  
  233.    no_of_random_pits(P), create_pits(P).
  234.  
  235. create_pits(0) :- !.
  236. create_pits(M) :-
  237.    xdim(XD), ydim(YD),
  238.    random(0,4294967296,N1), random(0,4294967296,N2), XP is N1 mod XD + 1, YP is N2 mod YD + 1,
  239.    ( XP+YP < 4 -> create_pits(M) ; assertz(pit(XP,YP)), write(pit(XP,YP)) ),
  240.    M1 is M-1, create_pits(M1).
  241.  
  242.  
  243. perform(turn, []) :-
  244.         write('turn'), nl,
  245.         current_state([at(X,Y),facing(D)]),
  246.         retract(current_state([at(X,Y),facing(D)])),
  247.         ( D < 4 -> D1 is D+1 ; D1 is 1 ),
  248.         assertz(current_state([at(X,Y),facing(D1)])).
  249.  
  250. perform(enter, [Breeze,Stench,Glitter]) :-
  251.         write('enter'), nl,
  252.         current_state(Z),
  253.         retract(current_state(Z)),
  254.         assertz(current_state([at(1,1),facing(1)])),
  255.         ( gold(1,1) -> Glitter = true ; Glitter = false ),
  256.         ( (wumpus(1,2) ; wumpus(2,1)) -> Stench = true ;
  257.             Stench = false ),
  258.         ( (pit(2,1) ; pit(1,2)) -> Breeze = true ;
  259.             Breeze = false ).
  260.  
  261. perform(exit, []) :-
  262.         write('exit'), nl,
  263.         current_state([at(X,Y),facing(D)]),
  264.         retract(current_state([at(X,Y),facing(D)])),
  265.         assertz(current_state([])).
  266.  
  267. perform(grab, []) :-
  268.         write('grab'), nl.
  269.  
  270. perform(shoot, [Scream]) :-
  271.         write('shoot'), nl,
  272.         current_state([at(X,Y),facing(D)]),
  273.         wumpus(WX, WY),
  274.         ( in_direction(X, Y, D, WX, WY), Scream = true ; Scream = false ).
  275.  
  276. perform(go, [Breeze,Stench,Glitter]) :-
  277.         write('go'), nl,
  278.         current_state([at(X,Y),facing(D)]),
  279.         retract(current_state([at(X,Y),facing(D)])),
  280.         ( D = 1 -> X1 is X, Y1 is Y+1 ;
  281.           D = 3 -> X1 is X, Y1 is Y-1 ;
  282.           D = 2 -> X1 is X+1, Y1 is Y ;
  283.           D = 4 -> X1 is X-1, Y1 is Y ),
  284.         assertz(current_state([at(X1,Y1),facing(D)])),
  285.         ( gold(X1,Y1) -> Glitter = true ; Glitter = false ),
  286.         X_east is X1+1, X_west is X1-1, Y_north is Y1+1, Y_south is Y1-1,
  287.         ( (wumpus(X_east,Y1) ; wumpus(X1,Y_north) ;
  288.            wumpus(X_west,Y1) ; wumpus(X1,Y_south)) -> Stench = true ;
  289.             Stench = false ),
  290.         ( (pit(X_east,Y1) ; pit(X1,Y_north) ;
  291.            pit(X_west,Y1) ; pit(X1,Y_south)) -> Breeze = true ;
  292.             Breeze = false ).
  293.  
  294.  
  295.  
  296.  
  297. %% fluent.chr - CHR for SWI-Prolog
  298.  
  299. %% $Id: fluent.chr, v 2.0 NOW $
  300. %%
  301. %% FLUX: a Prolog library for high-level programming of cognitive agents
  302. %% Copyright 2003, 2004  Michael Thielscher
  303. %% This file belongs to the flux kernel package distributed at
  304. %%   http://www.fluxagent.org
  305. %%
  306. %% This library is free software; you can redistribute it and/or modify it
  307. %% under the terms of the GNU Library General Public License as published by
  308. %% the Free Software Foundation; either version 2 of the License, or (at your
  309. %% option) any later version.
  310. %%
  311. %% This library is distributed in the hope that it will be useful, but WITHOUT
  312. %% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  313. %% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
  314. %% License for more details.
  315. %%
  316. %% You should have received a copy of the GNU Library General Public License
  317. %% along with this library; if not, write to the Free Software Foundation,
  318. %% Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  319. %%
  320. %% Consult the file COPYING for license details.
  321.  
  322. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  323. %%
  324. %% Preamble
  325. %%
  326. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  327.  
  328.  
  329. % handler fluent.
  330.  
  331. :- chr_constraint not_holds/2, not_holds_all/2, duplicate_free/1,
  332.             or_holds/2, or_holds/3, cancel/2, cancelled/2.
  333.  
  334. :- chr_option(check_guard_bindings,off).
  335.  
  336. :- make,check,autoload.
  337. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  338. %%
  339. %% Constraint Handling Rules for state constraints
  340. %%
  341. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  342.  
  343.  
  344. not_holds(F, [F1|Z]) <=> neq(F, F1), not_holds(F, Z).
  345. not_holds(_, [])     <=> true.
  346.  
  347. not_holds_all(F, [F1|Z]) <=> neq_all(F, F1), not_holds_all(F, Z).
  348. not_holds_all(_, [])     <=> true.
  349.  
  350. not_holds_all(F, Z) \ not_holds(G, Z)     <=> inst(G, F) | true.
  351. not_holds_all(F, Z) \ not_holds_all(G, Z) <=> inst(G, F) | true.
  352.  
  353. duplicate_free([F|Z]) <=> not_holds(F,Z), duplicate_free(Z).
  354. duplicate_free([])    <=> true.
  355.  
  356. or_holds([F],Z) <=> F\=eq(_,_) | holds(F,Z).
  357.  
  358. or_holds(V,_Z) <=> \+ ( member(F,V),F\=eq(_,_) ) | or_and_eq(V,D), call(D).
  359.  
  360. or_holds(V,[]) <=> member(F, V, W), F\=eq(_,_) | or_holds(W,[]).
  361.  
  362. or_holds(V,_Z) <=> member(eq(X,Y),V), or_neq(exists,X,Y,D), \+ call(D) | true.
  363. or_holds(V,Z) <=> member(eq(X,Y),V,W), \+ (and_eq(X,Y,D), call(D)) | or_holds(W,Z).
  364.  
  365. not_holds(F, Z) \ or_holds(V, Z) <=> member(G, V, W), F==G | or_holds(W, Z).
  366.  
  367. not_holds_all(F, Z) \ or_holds(V, Z) <=> member(G, V, W), inst(G, F)
  368.                                          | or_holds(W, Z).
  369.  
  370. or_holds(V, [F|Z]) <=> or_holds(V, [], [F|Z]).
  371.  
  372. or_holds([G|V],W,[F|Z]) <=> true | ( G==F -> true ;
  373.                             G\=F -> or_holds(V,[G|W],[F|Z]) ;
  374.                             G=..[_|ArgX], F=..[_|ArgY],
  375.                             or_holds(V,[eq(ArgX,ArgY),G|W],[F|Z])).
  376.  
  377. or_holds([],W,[_|Z]) <=> or_holds(W,Z).
  378.  
  379.  
  380. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  381. %%
  382. %% Constraint Handling Rules for cancellation of constraints on a fluent
  383. %%
  384. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  385.  
  386. cancel(F,Z) \ not_holds(G,Z)     <=> \+ F\=G | true.
  387.  
  388. cancel(F,Z) \ not_holds_all(G,Z) <=> \+ F\=G | true.
  389.  
  390. cancel(F,Z) \ or_holds(V,Z)      <=> member(G,V), \+ F\=G | true.
  391.  
  392. cancel(F,Z), cancelled(F,Z) <=> true.
  393.  
  394.  
  395. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  396. %%
  397. %% Auxiliary clauses
  398. %%
  399. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  400.  
  401. neq(F, F1)     :- or_neq(exists, F, F1).
  402. neq_all(F, F1) :- or_neq(forall, F, F1).
  403.  
  404. or_neq(Q, Fx, Fy) :-
  405.   functor(Fx, F, M), functor(Fy, G, N),
  406.   ( F=G, M=N -> Fx =.. [_|ArgX], Fy =.. [_|ArgY], or_neq(Q, ArgX, ArgY, D), call(D)
  407.               ; true ).
  408.  
  409. or_neq(_, [], [], (0#\=0)).
  410. or_neq(Q, [X|X1], [Y|Y1], D) :-
  411.   or_neq(Q, X1, Y1, D1),
  412.   ( Q=forall, var(X), \+ is_domain(X) -> ( binding(X,X1,Y1,YE) ->
  413.  
  414.                                          D=((Y#\=YE)#\/D1) ; D=D1 )
  415.                                          ; D=((X#\=Y)#\/D1) ).
  416.                                          
  417. binding(X,[X1|ArgX],[Y1|ArgY],Y) :-
  418.    X==X1 -> Y=Y1 ; binding(X,ArgX,ArgY,Y).
  419.  
  420. and_eq([], [], (0#=0)).
  421. and_eq([X|X1], [Y|Y1], D) :-
  422.    and_eq(X1, Y1, D1),
  423.    D = ((X#=Y)#/\D1).
  424.  
  425. or_and_eq([], (0#\=0)).
  426. or_and_eq([eq(X,Y)|Eq], (D1#\/D2)) :-
  427.    and_eq(X,Y,D1),
  428.    or_and_eq(Eq,D2).
  429.  
  430. %% inst checks whether G is an instance of F and if so whether there is no
  431. %% domain variable which is bound to some value in this instance
  432.  
  433. inst(G,F) :- subsumes_chk(F,G), var_chk(G,F).
  434.  
  435. var_chk(X,Y) :- var(Y), X==Y.
  436. var_chk(_,Y) :- var(Y), \+ fd_var(Y).
  437. var_chk(X,Y) :- is_list(Y), var_chk_list(X,Y).
  438. var_chk(X,Y) :- compound(Y), \+ is_list(Y), X=..[_|Xs], Y=..[_|Ys], var_chk_list(Xs,Ys).
  439.  
  440. var_chk_list([],[]).
  441. var_chk_list([X|Xs],[Y|Ys]) :- var_chk(X,Y), var_chk_list(Xs,Ys).
  442.  
  443. member(X, [X|T], T).
  444. member(X, [H|T], [H|T1]) :- member(X, T, T1).
  445.  
  446. is_domain(X) :- fd_var(X), \+ ( fd_max(X,sup), fd_min(X,inf)).
  447. fd_min(X,D):-M #=< X,fd_dom(M,D).
  448. fd_max(X,D):-M #>= X,fd_dom(M,D).
  449.  
  450. %% $Id: flux.pl, v 2.0 2004/01/22 00:58:00 $
  451. %%
  452. %% FLUX: a Prolog library for high-level programming of cognitive agents
  453. %% Copyright 2003, 2004  Michael Thielscher
  454. %% This file belongs to the flux kernel package distributed at
  455. %%   http://www.fluxagent.org
  456. %%
  457. %% This library is free software; you can redistribute it and/or modify it
  458. %% under the terms of the GNU Library General Public License as published by
  459. %% the Free Software Foundation; either version 2 of the License, or (at your
  460. %% option) any later version.
  461. %%
  462. %% This library is distributed in the hope that it will be useful, but WITHOUT
  463. %% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  464. %% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
  465. %% License for more details.
  466. %%
  467. %% You should have received a copy of the GNU Library General Public License
  468. %% along with this library; if not, write to the Free Software Foundation,
  469. %% Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  470. %%
  471. %% Consult the file COPYING for license details.
  472.  
  473. :- use_module( library(clpfd)).
  474.  
  475. :- autoload.
  476.  
  477. :- expects_dialect(sicstus).
  478.  
  479. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  480. %%
  481. %% Libraries
  482. %%
  483. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  484.  
  485. %%
  486. %% term utilities (Sicstus library)
  487. %%
  488.  
  489. :- use_module(library(varnumbers)).
  490. :- use_module( library(terms)).
  491.  
  492. %%
  493. %%  List operations (Sicstus library)
  494. %%
  495.  
  496. :- use_module( library(lists)).
  497.  
  498. %%
  499. %% finite domain constraint solver (Sicstus library)
  500. %%
  501.  
  502. %%
  503. %% constraint handling rules (Sicstus library)
  504. %%
  505.  
  506. :- use_module( library(chr)).
  507.  
  508. %%
  509. %% FLUX constraint handling rules
  510. %%
  511.  
  512. :- autoload.
  513.  
  514. % :- ['fluent.chr'].
  515.  
  516. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  517. %%
  518. %% State Specifications and Update
  519. %%
  520. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  521.  
  522. %%
  523. %% holds(F,Z)
  524. %%
  525. %% asserts that fluent F holds in state Z
  526. %%
  527. holds(F, [F|_]).
  528. holds(F, Z) :- nonvar(Z), Z=[F1|Z1], F\==F1, holds(F, Z1).
  529.  
  530. %%
  531. %% holds(F,Z,Zp)
  532. %%
  533. %% asserts that fluent F holds in state Z
  534. %%
  535. %% state Zp is Z without F.
  536. %%
  537. holds(F, [F|Z], Z).
  538. holds(F, Z, [F1|Zp]) :- nonvar(Z), Z=[F1|Z1], F\==F1, holds(F, Z1, Zp).
  539.  
  540. %%
  541. %% cancel(F,Z1,Z2)
  542. %%
  543. %% state Z2 is state Z1 with all (positive, negative, disjunctive)
  544. %% knowledge of fluent F canceled
  545. %%
  546. cancel(F,Z1,Z2) :-
  547.    var(Z1)    -> cancel(F,Z1), cancelled(F,Z1), Z2=Z1 ;
  548.    Z1 = [G|Z] -> ( F\=G -> cancel(F,Z,Z3), Z2=[G|Z3]
  549.                          ; cancel(F,Z,Z2) ) ;
  550.    Z1 = []    -> Z2 = [].
  551.  
  552. %%
  553. %% minus(Z1,ThetaN,Z2)
  554. %%
  555. %% state Z2 is state Z1 minus the fluents in list ThetaN
  556. %%
  557. minus_(Z, [], Z).
  558. minus_(Z, [F|Fs], Zp) :-
  559.    ( \+ not_holds(F, Z) -> holds(F, Z, Z1) ;
  560.      \+ holds(F, Z)     -> Z1 = Z
  561.                          ; cancel(F, Z, Z1), not_holds(F, Z1) ),
  562.    minus_(Z1, Fs, Zp).
  563.  
  564. %%
  565. %% plus(Z1,ThetaP,Z2)
  566. %%
  567. %% state Z2 is state Z1 plus the fluents in list ThetaP
  568. %%
  569. plus_(Z, [], Z).
  570. plus_(Z, [F|Fs], Zp) :-
  571.    ( \+ holds(F, Z)     -> Z1=[F|Z] ;
  572.      \+ not_holds(F, Z) -> Z1=Z
  573.                          ; cancel(F, Z, Z2), not_holds(F, Z2), Z1=[F|Z2] ),
  574.    plus_(Z1, Fs, Zp).
  575.  
  576. %%
  577. %% update(Z1,ThetaP,ThetaN,Z2)
  578. %%
  579. %% state Z2 is state Z1 minus the fluents in list ThetaN
  580. %% plus the fluents in list ThetaP
  581. %%
  582. update(Z1, ThetaP, ThetaN, Z2) :-
  583.    minus_(Z1, ThetaN, Z), plus_(Z, ThetaP, Z2).
  584.  
  585.  
  586. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  587. %%
  588. %% State Knowledge
  589. %%
  590. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  591.  
  592. %%
  593. %% knows(F,Z)
  594. %%
  595. %% ground fluent F is known to hold in state Z
  596. %%
  597. knows(F, Z) :- \+ not_holds(F, Z).
  598.  
  599. %%
  600. %% knows_not(F,Z)
  601. %%
  602. %% ground fluent F is known not to hold in state Z
  603. %%
  604. knows_not(F, Z) :- \+ holds(F, Z).
  605.  
  606. %%
  607. %% knows_val(X,F,Z)
  608. %%
  609. %% there is an of the variables in X for which
  610. %% non-ground fluent F is known to hold in state Z
  611. %%
  612. %% Example:
  613. %%
  614. %% ?- knows_val([X], f(X,Y), [f(1,3),f(2,U),f(V,2)|_])
  615. %%
  616. %% X=1 More?
  617. %% X=2 More?
  618. %% No
  619. %%
  620. knows_val(X, F, Z) :- k_holds(F, Z), knows_val(X).
  621.  
  622. k_holds(F, Z) :- nonvar(Z), Z=[F1|Z1],
  623.                  ( instance1(F1, F), F=F1 ; k_holds(F, Z1) ).
  624.  
  625. :- dynamic known_val/1.
  626.  
  627. knows_val(X) :- dom(X), \+ nonground(X), ambiguous(X) -> false.
  628. knows_val(X) :- retract(known_val(X)).
  629.  
  630. dom([]).
  631. dom([X|Xs]) :- dom(Xs), ( is_domain(X) -> indomain(X)
  632.                                         ; true ).
  633.  
  634. ambiguous(X) :- retract(known_val(_)) -> true
  635.                 ;
  636.                 assertz(known_val(X)), false.
  637.  
  638.  
  639. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  640. %%
  641. %% Execution
  642. %%
  643. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  644.  
  645. %%
  646. %% execute(A,Z1,Z2)
  647. %%
  648. %% perform A and update current state Z1 to state Z2
  649. %%
  650. %% It assumes the definition of a predicate perform(A,Y) or perform(A,Y,E),
  651. %% which actually performs primitive action A and returns a list Y of
  652. %% sensing results and, in the ternary variant, a set of exogenous actions E.
  653. %%
  654. %% It also assumes the definition of a predicate state_update(Z1,A,Z2,Y),
  655. %% which specifies the effect of an action A with sensing result Y as
  656. %% update of state Z1 to state Z2. The effects of exogenous actions are assumed
  657. %% to be specified by a predicate state_update(Z1,A,Z2) without sensing result.
  658. %%
  659. %% The clauses for state_update must NOT allow for backtracking for fixed sensor result.
  660. %%
  661. %% For troubleshooting (qualification problem), it is assumed that accidental effects
  662. %% of non-exogenous actions are described by a predicate ab_state_update(Z1,A,Z2,Y).
  663. %% The initial state is assumed to be specified by init(Z0).
  664. %%
  665. %% The clauses for ab_state_update may allow for backtracking.
  666. %%
  667. %% The execution of non-primitive actions A is defined as the predicate
  668. %% complex_action(A,Z1,Z2) such that the final result of doing A in state Z1 is
  669. %% state Z2.
  670. %%
  671. %% A can be a primitive action, a list, a conditional of the form if(F,A1,A2)
  672. %% where F fluent, or the name of a complex action. The clause should be used
  673. %% for non-primitive A only if its executability is guaranteed also in case
  674. %% of possible accidents.
  675. %%
  676. execute(A,Z1,Z2) :-
  677.    current_predicate(perform/2),
  678.    perform(A,Y)    -> ( current_predicate(ab_state_update/4)
  679.                         ->
  680.                            ( Z1=[sit(S)|Z], ! ; S=[], Z=Z1 ),
  681.                            ( state_update(Z,A,Z3,Y)
  682.                              ; ab_res([[A,Y]|S],Z3) ),
  683.                            !, Z2=[sit([[A,Y]|S])|Z3]
  684.                         ;
  685.                         state_update(Z1,A,Z2,Y) ) ;
  686.  
  687.    current_predicate(perform/3),
  688.    perform(A,Y,E)  -> ( current_predicate(ab_state_update/4)
  689.                         ->
  690.                            ( Z1=[sit(S)|Z], ! ; S=[], Z=Z1 ),
  691.                            ( state_update(Z,A,Z3,Y), state_updates(Z3,E,Z4)
  692.                              ; ab_res([[A,Y,E]|S],Z4) ),
  693.                            !, Z2=[sit([[A,Y,E]|S])|Z4]
  694.                         ;
  695.                         state_update(Z1,A,Z,Y), state_updates(Z,E,Z2) ) ;
  696.  
  697.    A = [A1|A2]     ->
  698.                       execute(A1,Z1,Z), execute(A2,Z,Z2) ;
  699.  
  700.    A = if(F,A1,A2) ->
  701.                       (holds(F,Z1) -> execute(A1,Z1,Z2)
  702.                                     ; execute(A2,Z1,Z2)) ;
  703.  
  704.    A = []          ->
  705.                       Z1=Z2 ;
  706.  
  707.    complex_action(A,Z1,Z2).
  708.  
  709. ab_res([],Z) :- init(Z).
  710. ab_res([S1|S],Z) :-
  711.    ab_res(S,Z1),
  712.    ( S1=[A,Y] -> ( state_update(Z1,A,Z,Y) ; ab_state_update(Z1,A,Z,Y) )
  713.      ;
  714.      S1=[A,Y,E], ( state_update(Z1,A,Z2,Y) ; ab_state_update(Z1,A,Z2,Y) ),
  715.                  state_updates(Z2, E, Z) ).
  716.  
  717. state_updates(Z, [], Z).
  718. state_updates(Z1, [A|S], Z2) :-
  719.    state_update(Z1, A, Z), state_updates(Z, S, Z2).
  720.  
  721. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  722. %%
  723. %% Planning
  724. %%
  725. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  726.  
  727. %%
  728. %% plan(PlanningProblemName,Z,P)
  729. %%
  730. %% P is an optimal plan for PlanningProblemName with starting state Z
  731. %%
  732. %% It assumes the definition of a predicate PlanningProblemName(Z0,P,Z)
  733. %% describing the search space such that plan P executed in starting
  734. %% state Z0 results in state Z which satisfies the planning goal,
  735. %% and the definition of plan_cost(PlanningProblemName,P,Z,C) such that
  736. %% C is the cost of plan P resulting in state Z; or
  737. %%
  738. %% the definition of a predicate is PlanningProblemName(Z0,P)
  739. %% describing the search space such that conditional plan P executed in
  740. %% starting state Z0 necessarily results in a state in which the planning
  741. %% goal is satisfied, and the definition of plan_cost(PlanningProblemName,P,C)
  742. %% such that C is the cost of plan P.
  743. %%
  744. %% For the definition of the search space, the predicates for knowledge
  745. %% described below can be used.
  746. %%
  747. :- dynamic plan_search_best/2.
  748.  
  749. plan(Problem, Z, P) :-
  750.    assertz(plan_search_best(_,-1)),
  751.    plan_search(Problem, Z),
  752.    retract(plan_search_best(P,C)),
  753.    C =\= -1.
  754.  
  755. plan_search(Problem, Z) :-
  756.    current_predicate(Problem/2) ->
  757.       ( PlanningProblem =.. [Problem,Z,P],
  758.         call(PlanningProblem),
  759.         plan_cost(Problem, P, C),
  760.         plan_search_best(_,C1),
  761.         ( C1 =< C, C1 =\= -1 -> fail
  762.                               ; retract(plan_search_best(_,C1)),
  763.                                 assertz(plan_search_best(P,C)), fail )
  764.         ;
  765.         true ) ;
  766.    PlanningProblem =.. [Problem,Z,P,Zn],
  767.    call(PlanningProblem),
  768.    plan_cost(Problem, P, Zn, C),
  769.    plan_search_best(_,C1),
  770.    ( C1 =< C, C1 =\= -1 -> fail
  771.                          ; retract(plan_search_best(_,C1)),
  772.                            assertz(plan_search_best(P,C)), fail )
  773.    ;
  774.    true.
  775.  
  776. %%
  777. %% knows(F,S,Z0)
  778. %%
  779. %% ground fluent F is known to hold after doing S in state Z0
  780. %%
  781. %% S ::= [] | do(A,S)
  782. %% A ::= primitive action | if_true(F)| if_false(F)
  783. %% F ::= fluent
  784. %%
  785. knows(F, S, Z0) :- \+ ( res(S, Z0, Z), not_holds(F, Z) ).
  786.  
  787. %%
  788. %% knows_not(F,S,Z0)
  789. %%
  790. %% ground fluent F is known not to hold after doing S in state Z0
  791. %%
  792. knows_not(F, S, Z0) :- \+ ( res(S, Z0, Z), holds(F, Z) ).
  793.  
  794. %%
  795. %% knows_val(X,F,S,Z0)
  796. %%
  797. %% there is an instance of the variables in X for which
  798. %% non-ground fluent F is known to hold after doing S in state Z0
  799. %%
  800. knows_val(X, F, S, Z0) :-
  801.    res(S, Z0, Z) -> findall(X, knows_val(X,F,Z), T),
  802.                     assertz(known_val(T)),
  803.                     false.
  804. knows_val(X, F, S, Z0) :-
  805.    known_val(T), retract(known_val(T)), member(X, T),
  806.    \+ ( res(S, Z0, Z), not_holds_all(F, Z) ).
  807.  
  808. res([], Z0, Z0).
  809. res(do(A,S), Z0, Z) :-
  810.    A = if_true(F)  -> res(S, Z0, Z), holds(F, Z) ;
  811.    A = if_false(F) -> res(S, Z0, Z), not_holds(F, Z) ;
  812.    res(S, Z0, Z1), state_update(Z1, A, Z, _).
  813.  
  814.  
  815. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  816. %%
  817. %% Ramification Problem
  818. %%
  819. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  820.                  
  821. %%
  822. %% causes(Z1,P,N,Z2)
  823. %%
  824. %% state Z2 is the result of applying causal relationships to
  825. %% state Z1 wrt. positive effects P and negative effects N
  826. %%
  827. %% It is assumed that the causal relationships of a domain are specified
  828. %% by clauses for the predicate causes(Z1,P1,N1,Z2,P2,N2) such that an
  829. %% indirect effect causes an automatic state transition from
  830. %% state Z1 with positive effects P1 and negative effects N1 to
  831. %% state Z2 with positive effects P2 and negative effects N2
  832. %%
  833. causes(Z,P,N,Z2) :-
  834.    causes(Z,P,N,Z1,P1,N1) -> causes(Z1,P1,N1,Z2)
  835.                            ; Z2=Z.
  836.  
  837. %%
  838. %% ramify(Z1,ThetaP,ThetaN,Z2)
  839. %%
  840. %% state Z2 is the result of applying causal relationships after
  841. %% removing the negative direct effects ThetaN and adding the
  842. %% positive direct effects ThetaP to state Z2
  843. %%
  844. ramify(Z1,ThetaP,ThetaN,Z2) :-
  845.    update(Z1,ThetaP,ThetaN,Z), causes(Z,ThetaP,ThetaN,Z2).
  846.    
  847.    
  848. %% additional predicates necessary for Sicstus
  849.  
  850. nonground(X):- \+ ground(X).
  851.  
  852. instance1(X,Y):- subsumes_chk(Y,X).
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860. ?-w_dt(((_G1917=2;true),(_G1928=_G1928;true),(_G1917=2;true)))
  861. % autoloading user:autoload/0 from /usr/local/lib/swipl-7.3.16/library/prolog_autoload
  862. % autoloading prolog_codewalk:must_be/2 from /usr/local/lib/swipl-7.3.16/library/error
  863. % autoloading record:member/2 from /usr/local/lib/swipl-7.3.16/library/lists
  864. % autoloading user:maplist/2 from /usr/local/lib/swipl-7.3.16/library/apply
  865. % autoloading oset:reverse/2 from /usr/local/lib/swipl-7.3.16/library/lists
  866. % autoloading prolog_codewalk:portray_clause/1 from /usr/local/lib/swipl-7.3.16/library/listing
  867. % autoloading prolog_codewalk:clause_info/4 from /usr/local/lib/swipl-7.3.16/library/prolog_clause
  868. % autoloading prolog_codewalk:initialization_layout/4 from /usr/local/lib/swipl-7.3.16/library/prolog_clause
  869. % autoloading prolog_codewalk:gtrace/0 from /usr/local/lib/swipl-7.3.16/xpce/prolog/lib/gui_tracer
  870. % autoloading pce_principal:load_foreign_library/1 from /usr/local/lib/swipl-7.3.16/library/shlib
  871. % autoloading pce_principal:unlock_predicate/1 from /usr/local/lib/swipl-7.3.16/library/system
  872. % autoloading pce_expansion:push_operators/1 from /usr/local/lib/swipl-7.3.16/library/operators
  873. % autoloading pce_expansion:pop_operators/0 from /usr/local/lib/swipl-7.3.16/library/operators
  874. % autoloading pce_realise:last/2 from /usr/local/lib/swipl-7.3.16/library/lists
  875. % autoloading prolog_debug:backtrace/1 from /usr/local/lib/swipl-7.3.16/library/prolog_stack
  876. % autoloading error:assertion/1 from /usr/local/lib/swipl-7.3.16/library/debug
  877. % autoloading pce_host:send/2 from /usr/local/lib/swipl-7.3.16/xpce/prolog/lib/pce
  878. % autoloading pce_portray:portray_clause/1 from /usr/local/lib/swipl-7.3.16/library/listing
  879. % autoloading prolog_codewalk:clause_name/2 from /usr/local/lib/swipl-7.3.16/library/prolog_clause
  880. % Autoloader: iteration 1 resolved 28 predicates and loaded 18 files in 0.188 seconds.  Restarting ...
  881. % autoloading pce_goal_expansion:pce_error/1 from /usr/local/lib/swipl-7.3.16/xpce/prolog/lib/swi_compatibility
  882. % autoloading pce_goal_expansion:append/3 from /usr/local/lib/swipl-7.3.16/library/lists
  883. % autoloading pce_expansion:pce_error/1 from /usr/local/lib/swipl-7.3.16/xpce/prolog/lib/swi_compatibility
  884. % autoloading pce_expansion:append/3 from /usr/local/lib/swipl-7.3.16/library/lists
  885. % autoloading pce_expansion:pce_info/1 from /usr/local/lib/swipl-7.3.16/xpce/prolog/lib/swi_compatibility
  886. % autoloading pce_expansion:reverse/2 from /usr/local/lib/swipl-7.3.16/library/lists
  887. % autoloading pce_expansion:maplist/3 from /usr/local/lib/swipl-7.3.16/library/apply
  888. % autoloading pce_expansion:flatten/2 from /usr/local/lib/swipl-7.3.16/library/lists
  889. % autoloading pce_realise:pce_error/1 from /usr/local/lib/swipl-7.3.16/xpce/prolog/lib/swi_compatibility
  890. % autoloading pce_host:get/3 from /usr/local/lib/swipl-7.3.16/xpce/prolog/lib/pce
  891. % autoloading gui_tracer:debug/0 from /usr/local/lib/swipl-7.3.16/library/edinburgh
  892. % autoloading pce_global:append/3 from /usr/local/lib/swipl-7.3.16/library/lists
  893. % autoloading pce_global:gensym/2 from /usr/local/lib/swipl-7.3.16/library/gensym
  894. % autoloading quintus:date_time_value/3 from /usr/local/lib/swipl-7.3.16/library/date
  895. % autoloading pce_principal:pce_info/1 from /usr/local/lib/swipl-7.3.16/xpce/prolog/lib/swi_compatibility
  896. % autoloading pce_messages:get/3 from /usr/local/lib/swipl-7.3.16/xpce/prolog/lib/pce
  897. % Autoloader: iteration 2 resolved 3 predicates and loaded 16 files in 0.136 seconds.  Restarting ...
  898. % Autoloader: loaded 31 files in 3 iterations in 0.447 seconds
  899. % autoloading user:expects_dialect/1 from /usr/local/lib/swipl-7.3.16/library/dialect
  900. % autoloading chr:expects_dialect/1 from /usr/local/lib/swipl-7.3.16/library/dialect
  901. % autoloading chr_translate:portray_clause/1 from /usr/local/lib/swipl-7.3.16/library/listing
  902. % autoloading chr_translate:flatten/2 from /usr/local/lib/swipl-7.3.16/library/lists
  903. % autoloading chr_translate:selectchk/3 from /usr/local/lib/swipl-7.3.16/library/lists
  904. % autoloading chr_translate:nth1/3 from /usr/local/lib/swipl-7.3.16/library/lists
  905. % autoloading chr_translate:is_set/1 from /usr/local/lib/swipl-7.3.16/library/lists
  906. % autoloading chr_translate:append/2 from /usr/local/lib/swipl-7.3.16/library/lists
  907. % autoloading chr_translate:select/3 from /usr/local/lib/swipl-7.3.16/library/lists
  908. % autoloading chr_translate:nth1/4 from /usr/local/lib/swipl-7.3.16/library/lists
  909. % autoloading chr_translate:predsort/3 from /usr/local/lib/swipl-7.3.16/library/sort
  910. % autoloading chr_translate:numlist/3 from /usr/local/lib/swipl-7.3.16/library/lists
  911. % autoloading sort:must_be/2 from /usr/local/lib/swipl-7.3.16/library/error
  912. % autoloading guard_entailment:member/2 from /usr/local/lib/swipl-7.3.16/library/lists
  913. % autoloading guard_entailment:append/3 from /usr/local/lib/swipl-7.3.16/library/lists
  914. % autoloading sicstus:read_line_to_codes/2 from /usr/local/lib/swipl-7.3.16/library/readutil
  915. % autoloading chr_runtime:permission_error/3 from /usr/local/lib/swipl-7.3.16/library/error
  916. % autoloading builtins:append/3 from /usr/local/lib/swipl-7.3.16/library/lists
  917. % autoloading block_directive:permission_error/3 from /usr/local/lib/swipl-7.3.16/library/error
  918. % autoloading block_directive:instantiation_error/1 from /usr/local/lib/swipl-7.3.16/library/error
  919. % autoloading block_directive:domain_error/2 from /usr/local/lib/swipl-7.3.16/library/error
  920. % Autoloader: iteration 1 resolved 2 predicates and loaded 18 files in 0.413 seconds.  Restarting ...
  921. % Autoloader: loaded 2 files in 2 iterations in 0.807 seconds
  922. % autoloading user:make/0 from /usr/local/lib/swipl-7.3.16/library/make
  923. % autoloading user:check/0 from /usr/local/lib/swipl-7.3.16/library/check
  924. % Checking undefined predicates ...
  925. % Checking trivial failures ...
  926. % Checking redefined system and global predicates ...
  927. % autoloading check:predicate_name/2 from /usr/local/lib/swipl-7.3.16/library/prolog_clause
  928. % substitute/4                 Redefined global predicate
  929. % prolog_flag/2                Redefined global predicate
  930. % sublist/2                    Redefined global predicate
  931. % Checking predicates with declarations but without clauses ...
  932. % Checking predicates that need autoloading ...
  933. % autoloading check:clause_info/4 from /usr/local/lib/swipl-7.3.16/library/prolog_clause
  934. % autoloading check:clause_name/2 from /usr/local/lib/swipl-7.3.16/library/prolog_clause
  935. % Autoloader: loaded 0 files in 1 iterations in 0.412 seconds
  936.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement