% Pednault's Briefcase example
% from
% Edwin Pednault. Synthesizing plans that contain actions with
% context-dependent effects. Computational Intelligence, 4(4):356-372, 1988.

include "../library-ontology"
include "../library"

sorts
  Item;

inclusions
  Item << Thing;

module BRIEFCASE_DRIVE;

  objects
    Ed : Person;
    Paycheck, Dictionary : Item;
    Briefcase : Carrier; 
    Car : Vehicle;
    Home, Office : Place;

  actions
    PutIn(Thing, Carrier);
    PickUp(Thing); PutDown(Thing);
    Board; Disembark;
    Drive(Place);

  variables
    x : Thing;
    c : Carrier;
    p : Place;

  % The action PutIn is synonymous with library action Load applied 
  % The action TakeOut is synonymous with library action Unload
  import CARRIER;
    Load(x,c) is PutIn(x,c);
    Unload(x) is false;
    Move(x,p) is false;

  import CARRIER;
    Load(x,Ed) is PickUp(x);
    Unload(x) is PutDown(x);
    Move(x,p) is false;

  import CARRIER;
    Load(Ed,Car) is Board;
    Unload(Ed) is Disembark;
    Move(Car,p) is Drive(p);

  import NOCONCURRENCY;

  axioms
    TooSmallToSupport(Briefcase,Ed);

%    nonexecutable TakeOut(x) if -(Support(x)=Briefcase | Support(x)=Car);
%    nonexecutable TakeOut(x) if -(Holds(Briefcase,x) | Holds(Car,x));
%    nonexecutable PutDown(x) if Support(x)!=Ed;
    nonexecutable PutDown(x) if -Holds(Ed,x);

    nonexecutable PutIn(Ed,c);

    % Ed can't drive while carrying something 
%    nonexecutable Drive(p) if Support(x)=Ed;
    nonexecutable Drive(p) if Holds(Ed,x);
