% Author:
% Date: 12-3-2003

:- object lexicon.

% = structural postulates
postulate(dummy,dummy,dummy).

%postulate(p(a,AB,C), p(a,A,BC), 'Ass') :-
%  AB = p(a,A,B),
%  BC = p(a,B,C).
%postulate(p(a,A,PABC), p(a,PAAB,C), 'Ass') :-
%  PABC = p(a,B,C),
%  PAAB = p(a,A,B),
%  !.
%postulate(p(a,A,ZIP), p(a,ZIP,A), 'Cp') :-
%  ZIP = zip(p,_B),
%  !.
%postulate(MAp1, MAp2, 'MAp') :-
%  MAp1 = p(a,p(a,zip(p,A),B),C),
%  MAp2 = p(a,zip(p,A),p(a,B,C)).
%postulate(MCp1, MCp2, 'MCp') :-
%  MCp1 = p(a,A,p(a,zip(p,B),C)),
%  MCp2 = p(a,zip(p,B),p(a,A,C)),
%  !.

% = lazy evaluation

% = transparency

transparent(0) :- !.
transparent(a) :- !.
transparent_dia(p) :- !.

% = continuity

continuous(dummy).
continuous_dia(dummy).

% = non internal modes

external(0) :- !.
external(a) :- !.
external_dia(p) :- !.


% ============================================================
% Macros
% ============================================================

macro(iv, dl(0,np,s)) :- !.
macro(tv, dr(0,iv,np)) :- !.
macro(timp, dr(0,imp,np)) :- !.
macro(prep, dr(0,iv_mod,np)) :- !.
macro(imp_prep, dr(0,imp_mod,np)) :- !.
macro(iv_mod, dl(0,iv,iv)) :- !.
macro(imp_mod, dl(0, imp,imp)) :- !.
macro(timp_mod, dl(0, timp,timp)) :- !.
macro(np_mod, dl(0, np,np)) :- !.
macro(gq_subj, dr(0,s,iv)) :- !.
macro(gq_obj, dl(0,DRA,s)) :-
  DRA = dr(0,s,np),
  !.
macro(gq_imp_subj, dr(0,imp,IMP)) :- 
  IMP = dl(0,np,imp),
  !.
macro(gq_imp_obj, dl(0,IMP,imp)) :- 
  IMP =  dr(0,imp,np),
  !.
macro(det_subj, dr(0,gq_subj,n)) :- !.
macro(det_obj, dr(0,gq_obj,n)) :- !.
macro(det_imp_subj, dr(0,gq_imp_subj,n)) :- !.
macro(det_imp_obj, dr(0,gq_imp_obj,n)) :- !.

macro(refl, dl(0,tv,iv)) :- !.
macro(relpro, dr(0,rel,relbody)) : !.
macro(relbody, dr(0,s,np)) :- !.
macro(rel, dl(0,n,n)) :- !.
macro(conj(A), dr(0,DLA,A)) :-
  DLA = dl(0,A,A),
  !.

% ============================================================
% Endmarks
% ============================================================

endmark('!', imp) :- !.
endmark('.', s) :- !.
endmark('?', q) :- !.

% ============================================================
% Lexicon
% ============================================================

% = lex(Pros,Formula,Sem)

lex(sit, iv, sit).
lex(sit, imp, lambda(A,appl(action,appl(sit,A)))).
lex(lay, iv, lay).
lex(lay, imp, lambda(A,appl(action,appl(lay,A)))).
lex(get, iv, get).
lex(get, imp, lambda(A,appl(action,appl(get,A)))).
lex(walk, iv, walk). 
lex(walk, imp, lambda(A,appl(action,appl(walk,A)))).
lex(look, iv, look).
lex(look, imp, lambda(A,appl(action,appl(look,A)))).
lex(point, iv, point).
lex(point, imp, lambda(A,appl(action,appl(point,A)))).

lex(get, tv, get).
lex(get, dr(0,imp,np), lambda(A,appl(action,appl(get,A)))).
lex(find, tv, find).
lex(find, dr(0,imp,np), lambda(A,appl(action,appl(find,A)))).
lex(grab, tv, grab).
lex(grab, dr(0,imp,np), lambda(A,appl(action,appl(grab,A)))).
lex(release, tv, release).
lex(release, dr(0,imp,np), lambda(A,appl(action,appl(release,A)))).
lex(switch, tv, switch).
lex(switch, dr(0,imp,np), lambda(A,appl(action,appl(switch,A)))).
lex(start, tv, start).
lex(start, dr(0,imp,np), lambda(A,appl(action,appl(start,A)))).
lex(open, tv, open).
lex(open, dr(0,imp,np), lambda(A,appl(action,appl(open,A)))).
lex(close, tv, close1).
lex(close, dr(0,imp,np), lambda(A,appl(action,appl(close1,A)))).
lex(goto, tv, goto).
lex(goto, dr(0,imp,np), lambda(A,appl(action,appl(goto,A)))).

lex(is, iv, lambda(A,A)).
lex(is, tv, lambda(A,appl(is,A))).
lex(can, dr(0, dl(0,box(0,np),s), iv),  lambda(A,lambda(_B,A))).
lex(can, dr(0, dr(0,q,imp), box(0,np)), lambda(_A,lambda(B,B))).

lex(where, dr(0, q, iv), lambda(A, quant(question,C,appl(appl(inside,C),A)))).
lex(there, dr(0,s,iv), lambda(A,A)).

lex(in, dr(a, dl(0, iv, iv), np), lambda(A, lambda(B, appl(B, appl(inside, A))))).
lex(inside, dr(0, dl(0, iv, iv), np), lambda(A, lambda(B, appl(B, appl(inside, A))))).
lex(with, dr(0, dl(0, iv, iv), np), lambda(A, lambda(B, appl(B, appl(with, A))))).

lex(in, dr(a, dl(0, imp, imp), np), lambda(A, lambda(B, appl(B, appl(inside, A))))).
lex(inside, dr(0, dl(0, imp, imp), np), lambda(A, lambda(B, appl(B, appl(inside, A))))).
lex(with, dr(0, dl(0, imp, imp), np), lambda(A, lambda(B, appl(B, appl(with, A))))).

lex(through, prep, lambda(A, lambda(B, appl(B,appl(through,A))))).
lex(on, prep, lambda(A, lambda(B, appl(B,appl(on,A))))).
lex(at, prep, lambda(A, lambda(B, appl(B,appl(at,A))))).
lex(of, prep, lambda(A, lambda(B, appl(B,appl(of,A))))).
lex(up, prep, lambda(A, lambda(B, appl(B,appl(up,A))))).
lex(to, prep, lambda(A, lambda(B, appl(B,appl(to,A))))).
lex(into, prep, lambda(A, lambda(B, appl(B,appl(to,A))))).

lex(through, imp_prep, lambda(A, lambda(B, appl(B,appl(through,A))))).
lex(on, imp_prep, lambda(A, lambda(B, appl(B,appl(on,A))))).
lex(at, imp_prep, lambda(A, lambda(B, appl(B,appl(at,A))))).
lex(of, imp_prep, lambda(A, lambda(B, appl(B,appl(of,A))))).
lex(up, imp_prep, lambda(A, lambda(B, appl(B,appl(up,A))))).
lex(to, imp_prep, lambda(A, lambda(B, appl(B,appl(to,A))))).
lex(into, imp_prep, lambda(A, lambda(B, appl(B,appl(to,A))))).

lex(on, timp_mod, lambda(A, appl(A, false))).
lex(off, timp_mod, lambda(A, appl(A, true))).

lex(user, n, user).
lex(me, np, user).
lex(you, box(0,np), you).

lex(book, n, book).
lex(couch, n, couch).
lex(lamp, n, lamp).
lex(door, n, door).
lex(table, n, table).
lex(tv, n, tv).
lex('TV', n, tv).
lex(bed, n, bed).
lex(room, n, room).
lex(studyroom, n, studyroom).
lex(bedroom, n, bedroom).
lex(closet, n, closet).
lex(livingroom, n, livingroom).
lex(door, n, door).
lex(studydoor, n, studydoor).
lex(closetdoor, n, closetdoor).
lex(frontdoor, n, frontdoor).
lex(bedroomdoor, n, bedroomdoor).
lex(deskchair, n, deskchair).
lex(chair, n, chair).
lex(book, n, book).
lex(tablelamp, n, tablelamp).
lex(button, n, button).
lex(startbutton, n, startbutton).
lex(game, n, game).
lex(game_of_life, n, game_of_life).

lex(the, dr(a, np, n), lambda(A, quant(iota,B,appl(A,B)))).

lex(a, det_obj, lambda(A,lambda(B,quant(exists,C,bool(appl(A,C),&,appl(B,C)))))).
lex(a, det_subj, lambda(A,lambda(B,quant(exists,C,bool(appl(A,C),&,appl(B,C)))))).
lex(a, det_imp_obj, lambda(A,lambda(B,quant(exists,C,bool(appl(A,C),&,appl(B,C)))))).
lex(a, det_imp_subj, lambda(A,lambda(B,quant(exists,C,bool(appl(A,C),&,appl(B,C)))))).

lex(every, det_obj, lambda(A,lambda(B,quant(forall,C,bool(appl(A,C),->,appl(B,C)))))).
lex(every, det_subj, lambda(A,lambda(B,quant(forall,C,bool(appl(A,C),->,appl(B,C)))))).
lex(every, det_imp_obj, lambda(A,lambda(B,quant(forall,C,bool(appl(A,C),->,appl(B,C)))))).
lex(every, det_imp_subj, lambda(A,lambda(B,quant(forall,C,bool(appl(A,C),->,appl(B,C)))))).

lex(your, dr(a, np, n), lambda(A, quant(iota,B,appl(A,B)))).

lex(and, conj(iv), lambda(A,lambda(B,lambda(C,bool(appl(B,C),&,appl(A,C)))))).
lex(and, conj(s), lambda(A,lambda(B,lambda(C,bool(appl(B,C),&,appl(A,C)))))).

lex(yes, dr(0, s, s), lambda(A, A)).
lex(no, dr(0, s, s), lambda(A, A)).
lex(yes, dr(0, imp, imp), lambda(A, A)).
lex(no, dr(0, imp, imp), lambda(A, A)).

:- end_object lexicon.
