/****************************************************************
A small DCG for very simple English sentences

This version: 13/06/03 stwa
****************************************************************/

:- multifile(n/2).
:- [semconOperators].

:- use_module(semconHelpers,[vars2atoms/1,compose/3]).

s(NP@VP) --> np(NP),vp(VP).
np(DET@N) --> det(DET),n(N).
np(PN) --> pn(PN).
vp(TV@NP) --> tv(TV),np(NP).
vp(IV) --> iv(IV).


det(lambda(P, lambda(Q, exists(x, ((P@x) & (Q@x)))))) --> [a], {vars2atoms(P), vars2atoms(Q)}.
det(lambda(P, lambda(Q, forall(x, ((P@x) > (Q@x)))))) --> [every], {vars2atoms(P), vars2atoms(Q)}.

n(lambda(X, witch(X))) --> [witch], {vars2atoms(X)}.
n(lambda(X, wizard(X))) --> [wizard], {vars2atoms(X)}.
n(lambda(X, broomstick(X))) --> [broomstick], {vars2atoms(X)}.

pn(lambda(P, P@harry)) --> [harry], {vars2atoms(P)}.

iv(lambda(X, fly(X))) --> [flies], {vars2atoms(X)}.
tv(lambda(X, lambda(Y, X@lambda(Z, curse(Y,Z))))) --> [curses], {vars2atoms(X), vars2atoms(Y), vars2atoms(Z)}.
