% This file contains the older versions of the
% library module REGION and the domain module AIRPORT.  
%
% We keep them for historical reference.
%
% In order to test this, the library module REGION must
% be replaced with the version here.
%
% The REGION module is slightly different than that which
% is in the library.  This version has some declarations
% and two axioms which are commented out.  These are
% some older ideas about the At(_,_) constant.
%
% The AIRPORT module here is also different from the 
% current AIRPORT module.  Here we have P_1, P_2, P_3
% as places, instead of Desk, Garage, Airport.

module REGION;

  sorts
%    Place;
    Region;

%  inclusions
%    Place << Region;

  constants
    At(Region, Region) : Boolean;

  variables
%    p : Place;
    r2, r, r1 : Region;

  axioms

    % Places can be in non-place regions, but no region can be in a place
%    -At(r,p);
  
    % Regions are nested and a place is in all of the regions which are
    % supersets of itself 
%    At(p, r) if At(p, r1) & At(r1,r);
    At(r2, r) if At(r2, r1) & At(r1,r);
   -At(r,r);

    % The regions are not nested unless we explicitly say so
    default -At(r,r1);

endmodule;

module AIRPORT;

  % to talk about regions and locations of things
  import REGION;
  import LOCAL;

  inclusions
    Place << Region;

  objects
    I : Agent;
    Car : Thing;
    P_1, P_2, P_3 : Place;
    Desk, Home, Airport, County : Region;

  constants
    Walkable(Region) : Boolean;
    Drivable(Region) : Boolean;
    Walk(Place) : action;
    Drive(Place) : action;

  variables
    p,p1 : Place;
    x : Thing;
    r : Region;

  import MOVE;
    Move(I,p) is Walk(p);

  import CARRY;
    Carry(I,Car,p) is Drive(p);

  import NOCONCURRENCY;

  axioms

    % We can only walk across walkable regions and drive to drivable ones
    nonexecutable Walk(p) if Location(I)=p1 & -exists r (At(p,r) & At(p1,r)
                                                         & Walkable(r));

    nonexecutable Drive(p) if Location(I)=p1 & -exists r (At(p,r) & At(p1,r)
                                                          & Drivable(r));


    % Our "geography":

    At(P_1, Desk);
    At(P_2, Home);
    At(P_3, Airport);

    At(Desk, Home);
    At(Home, County);
    At(Airport, County);

    Walkable(Home);
    default -Walkable(r);

    Drivable(County);
    default -Drivable(r);

endmodule
