% INTERPRETATION TESTER
% <Your Name Here>

% Include these lines.

:- dynamic context/2.
:- dynamic goal/2.

% REMOVE THE RABBIT FROM THE HAT.
%  Test queries:
%  to understand, ask
%      understand(removefrom(therabbit, thehat), Interpretation).
%  to generate, ask
%      generate(instruct(move(r3,path(from(h2),away))), U, I).
%
% SCHEMA:
%    instruct the hearer to move X from L away
%    if you say remove NP1 from NP2
%    NP1 describes X and
%    NP2 describes L and
%    X is located at L.

schema(chain(instruct(move(X,path(from(L),away))),
	   if(instruct(move(X,path(from(L),away))),
	      [say(removefrom(NP1,NP2)),
	       applies(NP1,X),
	       applies(NP2,L),
	       location(X,L)]),
	   [axiom(say(removefrom(NP1,NP2))),
	    axiom(applies(NP1,X)),
	    axiom(applies(NP2,L)),
	    axiom(location(X,L))])).

% Many rabbits, many hats, but only one rabbit in a hat.

context(applies(therabbit, r1), -2).	
context(applies(therabbit, r2), -2).	
context(applies(therabbit, r3), -3).	
context(applies(therabbit, r4), -3).	
context(applies(therabbit, r5), -3).	
context(applies(therabbit, r6), -3).	

context(applies(thehat, h1), -1).
context(applies(thehat, h2), -2).
context(applies(thehat, h3), -2).

context(location(r1, p1), -1).
context(location(r2, p2), -1).
context(location(r3, h2), -1).
context(location(r4, p4), -1).
context(location(r5, p5), -1).
context(location(r6, p6), -1).

% Gotta know what to do.

goal(instruct(_), -1).
