% Multifile declarations.
:- multifile if/2.
:- multifile fun/1.

% load phonology and tree output
:- [trale_home(tree_extensions)].

% specify signature file
signature(signature).

% grisu output specifications

hidden_feat(dtrs).         % shown by the tree
hidden_feat(daughters).    % shown by the tree

synsem <<< arg_st.
subj <<< comps.
>>> phon.


%====================================================================
% Phrase Structure Rules, encoding the ID-Principle and the
%                                      Constituent Order Principle


% Head Subject Rule

head_subject_rule ##
(phrase,
 synsem:loc:(cat:(head:Head,
                  val:(subj:e_list,
                       comps:e_list)),
             cont:Content),
 daughters:(hs_struc,
            hdtr:Hdtr,
            ndtr:Ndtr))
   ===>
cat> Ndtr,
cat> (Hdtr, synsem:loc:(cat:(head:Head,
                             val:(subj:ne_list,
				  comps:e_list)),
                        cont:Content)).


% Head Adjunct Rule

head_adjective_rule ##
(phrase,
 synsem:loc:(cat:head:(Head,
                       noun),
             cont:Content),
 daughters:(ha_struc,
            hdtr:Hdtr,
            ndtr:Ndtr))
   ===>
cat> (Ndtr, synsem:loc:(cat:(head:mod:Synsem,
                             val:(subj:e_list,
                                  comps:e_list)),
                        cont:Content)),
cat> (Hdtr, synsem:(Synsem,
                    loc:cat:(head:Head,
                             val:comps:e_list))).


%====================================================================
% PRINCIPLES


% Subcategorization Principle

phrase *> (synsem:loc:cat:val:(subj:Subj,
			       comps:Comps),
          daughters:(hdtr:synsem:loc:cat:val:((subj:[Synsem|Subj],
					       comps:Comps);
					      (subj:Subj,
					       comps:[Synsem|Comps]);
					      (subj:Subj,
					       comps:Comps)),
		     ndtr:synsem:Synsem)).


% Argument Realization Principle

(word,
 synsem:loc:cat:head:((adjective;det),
                       pred:minus)) *> (synsem:loc:cat:val:(subj:e_list,
                                                            comps:List),
                                        arg_st:List).

(word,
 synsem:loc:cat:head:(noun,
                      pred:minus)) *> (synsem:loc:cat:val:(subj:List,
                                                           comps:e_list),
                                       arg_st:List).



% Subject Principle

(val,subj:ne_list) *> subj:[_].


%====================================================================
% LEXICON

% Nouns

% Proper Names

mary ~~> (synsem:(loc:(cat:head:(noun,
                                 pred:minus),
                       cont:(index:(ref,
                                    num:sg,
                                    pers:third,
                                    gen:fem),
		              restr:e_list))),
            arg_st:e_list).

% Pronouns

she ~~> (synsem:(loc:(cat:head:(noun,
                                case:nom,
                                pred:minus),
                      cont:(index:(ref,
                                   num:sg,
                                   pers:third,
                                   gen:fem),
		            restr:e_list))),
            arg_st:e_list).


% Count Nouns

book ~~> (synsem:(loc:(cat:head:(noun,
                                 pred:minus),
                       cont:(index:(Index,
				    ref,
                                    num:sg,
                                    pers:third),
			     restr:[(book,
				     instance:Index)]))),
            arg_st:[(loc:cat:(head:det,
                              val:(subj:e_list,
                                   comps:e_list)))]).

% Determiners

a  ~~>  (synsem:(loc:(cat:head:(det,
                                pred:minus),
                      cont:determiner)),
          arg_st:e_list).


% Adjectives

red  ~~> (synsem:(loc:(cat:head:(adjective,
                                   pred:minus,
                                   mod:loc:(cat:(head:noun,
                                                 val:(subj:ne_list,
                                                      comps:e_list)),
                                            cont:(index:Index,
						  restr:Restr))),
                          cont:(index:Index,
				restr:[(red,
					arg:Index)|Restr]))),
             arg_st:[]).

simple ~~> (synsem:(loc:(cat:head:(adjective,
                                   pred:minus,
                                   mod:loc:(cat:(head:noun,
                                                 val:(subj:ne_list,
                                                      comps:e_list)),
                                          cont:(index:Index,
						restr:Restr))),
                          cont:(index:Index,
				restr:[(simple,
					arg:Index)|Restr]))),
             arg_st:[]).


%====================================================================

