1:-include(library('ec_planner/ec_test_incl')).    2:-expects_dialect(pfc).    3 %  loading(always,'ecnet/GSpace.e').
    4%;
    5%; Copyright (c) 2005 IBM Corporation and others.
    6%; All rights reserved. This program and the accompanying materials
    7%; are made available under the terms of the Common Public License v1.0
    8%; which accompanies this distribution, and is available at
    9%; http://www.eclipse.org/legal/cpl-v10.html
   10%;
   11%; Contributors:
   12%; IBM - Initial implementation
   13%;
   14%; GSpace: grid space
   15%;
   16%; @book{Mueller:1998,
   17%;   author = "Erik T. Mueller",
   18%;   year = "1998",
   19%;   title = "Natural Language Processing with \uppercase{T}hought\uppercase{T}reasure",
   20%;   address = "New York",
   21%;   publisher = "Signiform",
   22%; }
   23%;
   24
   25% sort coord: integer
   26==> subsort(coord,integer).
   27
   28% sort grid
   29==> sort(grid).
   30%; object is at (coord1, coord2) in grid.
   31
   32% fluent GridAt(grid,object,coord,coord)
   33 %  fluent(gridAt(grid,object,coord,coord)).
   34==> mpred_prop(gridAt(grid,object,coord,coord),fluent).
   35==> meta_argtypes(gridAt(grid,object,coord,coord)).
   36
   37
   38% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/GSpace.e:27
   39%; agent walks from (coord1, coord2)
   40%; to (coord3, coord4) in grid.
   41
   42% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/GSpace.e:29
   43% event GridWalk(grid,agent,coord,coord,coord,coord)
   44 %  event(gridWalk(grid,agent,coord,coord,coord,coord)).
   45% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/GSpace.e:30
   46==> mpred_prop(gridWalk(grid,agent,coord,coord,coord,coord),event).
   47==> meta_argtypes(gridWalk(grid,agent,coord,coord,coord,coord)).
   48
   49
   50% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/GSpace.e:31
   51%; A state constraint says that for a given grid an
   52%; object is at one cell in that grid at a time:
   53% [grid,object,coord1,coord2,coord3,coord4,time]
   54% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/GSpace.e:34
   55% HoldsAt(GridAt(grid,object,coord1,coord2),time) &
   56% HoldsAt(GridAt(grid,object,coord3,coord4),time) ->
   57% coord1=coord3 & coord2=coord4.
   58
   59 /*   if((holds_at(gridAt(Grid, Object, Coord1, Coord2), Time), holds_at(gridAt(Grid, Object, Coord3, Coord4), Time)),
   60          (Coord1=Coord3, Coord2=Coord4)).
   61 */
   62
   63 /*  not(holds_at(gridAt(GridAt_Param, A, Equals_Param, Equals_Param10), Time7)) :-
   64       holds_at(gridAt(GridAt_Param,
   65                       A,
   66                       Equals_Ret,
   67                       GridAt_Ret),
   68                Time7),
   69       (   not(equals(Equals_Param, Equals_Ret))
   70       ;   not(equals(Equals_Param10, GridAt_Ret))
   71       ).
   72 */
   73% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/GSpace.e:36
   74axiom(not(holds_at(gridAt(GridAt_Param, A, Equals_Param, Equals_Param10), Time7)),
   75   
   76    [ not(equals(Equals_Param, Equals_Ret)),
   77      holds_at(gridAt(GridAt_Param,
   78                      A,
   79                      Equals_Ret,
   80                      GridAt_Ret),
   81               Time7)
   82    ]).
   83axiom(not(holds_at(gridAt(GridAt_Param, A, Equals_Param, Equals_Param10), Time7)),
   84   
   85    [ not(equals(Equals_Param10, GridAt_Ret)),
   86      holds_at(gridAt(GridAt_Param,
   87                      A,
   88                      Equals_Ret,
   89                      GridAt_Ret),
   90               Time7)
   91    ]).
   92
   93 /*  not(holds_at(gridAt(GridAt_Param14, A, Equals_Ret18, GridAt_Ret17), Time13)) :-
   94       holds_at(gridAt(GridAt_Param14,
   95                       A,
   96                       Equals_Param15,
   97                       Equals_Param16),
   98                Time13),
   99       (   not(equals(Equals_Param15, Equals_Ret18))
  100       ;   not(equals(Equals_Param16, GridAt_Ret17))
  101       ).
  102 */
  103axiom(not(holds_at(gridAt(GridAt_Param14, A, Equals_Ret18, GridAt_Ret17), Time13)),
  104   
  105    [ not(equals(Equals_Param15, Equals_Ret18)),
  106      holds_at(gridAt(GridAt_Param14,
  107                      A,
  108                      Equals_Param15,
  109                      Equals_Param16),
  110               Time13)
  111    ]).
  112axiom(not(holds_at(gridAt(GridAt_Param14, A, Equals_Ret18, GridAt_Ret17), Time13)),
  113   
  114    [ not(equals(Equals_Param16, GridAt_Ret17)),
  115      holds_at(gridAt(GridAt_Param14,
  116                      A,
  117                      Equals_Param15,
  118                      Equals_Param16),
  119               Time13)
  120    ]).
  121
  122 /*  equals(Equals_Param20, Equals_Ret22) :-
  123       holds_at(gridAt(GridAt_Param21,
  124                       A,
  125                       Equals_Param20,
  126                       GridAt_Ret23),
  127                Time19),
  128       holds_at(gridAt(GridAt_Param21,
  129                       A,
  130                       Equals_Ret22,
  131                       GridAt_Ret24),
  132                Time19).
  133 */
  134axiom(equals(Equals_Param20, Equals_Ret22),
  135   
  136    [ holds_at(gridAt(GridAt_Param21,
  137                      A,
  138                      Equals_Param20,
  139                      GridAt_Ret23),
  140               Time19),
  141      holds_at(gridAt(GridAt_Param21,
  142                      A,
  143                      Equals_Ret22,
  144                      GridAt_Ret24),
  145               Time19)
  146    ]).
  147
  148 /*  equals(Equals_Param26, Equals_Ret28) :-
  149       holds_at(gridAt(GridAt_Param27, A, _, Equals_Param26),
  150                Time25),
  151       holds_at(gridAt(GridAt_Param27, A, _, Equals_Ret28),
  152                Time25).
  153 */
  154axiom(equals(Equals_Param26, Equals_Ret28),
  155   
  156    [ holds_at(gridAt(GridAt_Param27,
  157                      A,
  158                      _,
  159                      Equals_Param26),
  160               Time25),
  161      holds_at(gridAt(GridAt_Param27, A, _, Equals_Ret28),
  162               Time25)
  163    ]).
  164
  165
  166% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/GSpace.e:38
  167%; An effect axiom states that
  168%; if an agent walks from one cell in a grid to another cell,
  169%; the agent will be at second cell:
  170% [grid,agent,coord1,coord2,coord3,coord4,time]
  171% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/GSpace.e:42
  172% Initiates(GridWalk(grid,agent,coord1,coord2,coord3,coord4),
  173%           GridAt(grid,agent,coord3,coord4),
  174%           time).
  175% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/GSpace.e:44
  176axiom(initiates(gridWalk(Grid, Agent, Coord1, Coord2, Coord3, Coord4), gridAt(Grid, Agent, Coord3, Coord4), Time),
  177    []).
  178
  179
  180% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/GSpace.e:46
  181%; An effect axiom states that
  182%; if an agent walks from one cell in a grid to another cell,
  183%; the agent will no longer be at the first cell:
  184% [grid,agent,coord1,coord2,coord3,coord4,time]
  185% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/GSpace.e:50
  186% Terminates(GridWalk(grid,agent,coord1,coord2,coord3,coord4),
  187%            GridAt(grid,agent,coord1,coord2),
  188%            time).
  189% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/GSpace.e:52
  190axiom(terminates(gridWalk(Grid, Agent, Coord1, Coord2, Coord3, Coord4), gridAt(Grid, Agent, Coord1, Coord2), Time),
  191    []).
  192
  193
  194% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/GSpace.e:54
  195%; A precondition axiom states that for an agent to walk
  196%; from one cell in a grid to another cell, the agent
  197%; must be at the first cell, the second cell must not
  198%; be occupied, and the first cell must be adjacent to
  199%; the second cell:
  200% [grid,agent,coord1,coord2,coord3,coord4,time]
  201% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/GSpace.e:60
  202% Happens(GridWalk(grid,agent,coord1,coord2,coord3,coord4),time) ->
  203% HoldsAt(GridAt(grid,agent,coord1,coord2),time) &
  204% (!{object} HoldsAt(GridAt(grid,object,coord3,coord4),time)) &
  205% (coord1=coord3 |
  206%  coord1=coord3+1 |
  207%  coord1=coord3-1) &
  208% (coord2=coord4 |
  209%  coord2=coord4+1 |
  210%  coord2=coord4-1).
  211% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/GSpace.e:68
  212axiom(requires(gridWalk(Grid, Agent, Coord1, Coord2, Coord3, Coord4), Time),
  213   
  214    [ equals(Coord2, Coord4),
  215      equals(Coord1, Coord3),
  216      holds_at(gridAt(Grid, Agent, Coord1, Coord2),
  217               Time),
  218      not(holds_at(gridAt(Grid, Object, Coord3, Coord4),
  219                   Time))
  220    ]).
  221axiom(requires(gridWalk(Grid, Agent, Coord1, Coord2, Coord3, Coord4), Time),
  222   
  223    [ equals(Coord2, Coord4+1),
  224      equals(Coord1, Coord3),
  225      holds_at(gridAt(Grid, Agent, Coord1, Coord2),
  226               Time),
  227      not(holds_at(gridAt(Grid, Object, Coord3, Coord4),
  228                   Time))
  229    ]).
  230axiom(requires(gridWalk(Grid, Agent, Coord1, Coord2, Coord3, Coord4), Time),
  231   
  232    [ equals(Coord2, Coord4-1),
  233      equals(Coord1, Coord3),
  234      holds_at(gridAt(Grid, Agent, Coord1, Coord2),
  235               Time),
  236      not(holds_at(gridAt(Grid, Object, Coord3, Coord4),
  237                   Time))
  238    ]).
  239axiom(requires(gridWalk(Grid, Agent, Coord1, Coord2, Coord3, Coord4), Time),
  240   
  241    [ equals(Coord2, Coord4),
  242      equals(Coord1, Coord3+1),
  243      holds_at(gridAt(Grid, Agent, Coord1, Coord2),
  244               Time),
  245      not(holds_at(gridAt(Grid, Object, Coord3, Coord4),
  246                   Time))
  247    ]).
  248axiom(requires(gridWalk(Grid, Agent, Coord1, Coord2, Coord3, Coord4), Time),
  249   
  250    [ equals(Coord2, Coord4+1),
  251      equals(Coord1, Coord3+1),
  252      holds_at(gridAt(Grid, Agent, Coord1, Coord2),
  253               Time),
  254      not(holds_at(gridAt(Grid, Object, Coord3, Coord4),
  255                   Time))
  256    ]).
  257axiom(requires(gridWalk(Grid, Agent, Coord1, Coord2, Coord3, Coord4), Time),
  258   
  259    [ equals(Coord2, Coord4-1),
  260      equals(Coord1, Coord3+1),
  261      holds_at(gridAt(Grid, Agent, Coord1, Coord2),
  262               Time),
  263      not(holds_at(gridAt(Grid, Object, Coord3, Coord4),
  264                   Time))
  265    ]).
  266axiom(requires(gridWalk(Grid, Agent, Coord1, Coord2, Coord3, Coord4), Time),
  267   
  268    [ equals(Coord2, Coord4),
  269      equals(Coord1, Coord3-1),
  270      holds_at(gridAt(Grid, Agent, Coord1, Coord2),
  271               Time),
  272      not(holds_at(gridAt(Grid, Object, Coord3, Coord4),
  273                   Time))
  274    ]).
  275axiom(requires(gridWalk(Grid, Agent, Coord1, Coord2, Coord3, Coord4), Time),
  276   
  277    [ equals(Coord2, Coord4+1),
  278      equals(Coord1, Coord3-1),
  279      holds_at(gridAt(Grid, Agent, Coord1, Coord2),
  280               Time),
  281      not(holds_at(gridAt(Grid, Object, Coord3, Coord4),
  282                   Time))
  283    ]).
  284axiom(requires(gridWalk(Grid, Agent, Coord1, Coord2, Coord3, Coord4), Time),
  285   
  286    [ equals(Coord2, Coord4-1),
  287      equals(Coord1, Coord3-1),
  288      holds_at(gridAt(Grid, Agent, Coord1, Coord2),
  289               Time),
  290      not(holds_at(gridAt(Grid, Object, Coord3, Coord4),
  291                   Time))
  292    ]).
  293
  294
  295% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/GSpace.e:70
  296%; End of file.