Head Movement Compilation

Contents

hmCode/4
ACode trace(C,_,_,{left,right})
ACode nontrace([C1..,Cn],_,_)
modifyHmCode/6


hmCode/4

hmCode/4 processes the ACode = {trace(C,Fs,Bs,Dir)/nontrace([C1,..,Cn],LexC,Bs)} which represents the positions that are affected by a movement rule.

On input to hmCode/4, the ACode is partially instantiated by movement/5 from a single movement rule as follows:

  1. trace(C,_,_,Dir)
  2. nontrace([C1,..,Cn],_,_)
The anonymous variables represent positions that will be filled during the call as follows:
  1. trace(C,Fs,[C(X)],Dir)

    Fs and X are the placeholders for the features of C-trace and the phrase itself, respectively.

  2. nontrace([C1,..,Cn],LexC,Bs)

    LexC is the lexical category from the movement chain. Bs is a list of bindings [..,C(X),...] for each category in the movement chain. These bindings are necessary to link the computed pre- and post-condition goals to the elements.

hmCode/4 will compute the pre- and post-conditions for the local and remote site to predict and exchange features, plus do head adjunction and recovery as follows:
  1. trace(C,_,_,Dir): Local is the trace site, Remote is the landing site.

    For example, a C-trace may pop its features and the remote site must push the features for C.

  2. nontrace([C1,..,Cn],_,_): Local is the landing site. Remote is not defined.

    Here we just compute the head adjunction(s) from the chain and call the necessary recovery routines for the non-lexical members of this chain.

The I/O spec for hmCode/4 is:
%% hmCode(ACode,Pre,Post,Pre,Post)
%%		Local    Remote
%%		Site     Site
Examples of I/O:
Call: hmCode(trace(v,_368796,_368797,left),_368835,_368836,_368841,_368842)
Exit: hmCode(trace(v,_368796,[v(_368859)],left),
             [popTr(v,_368796,es(i),es(o))],       % PRE, LOCAL
	     [],                                   % POST, LOCAL
	     [],                                   % PRE, REMOTE
	     [pushTr(_368859,es(i),es(o))])        % POST, REMOTE

Call: hmCode(nontrace([v,agr],_368370,_368371),_368451,_368452,_368457,_368458)
Exit: hmCode(nontrace([v,agr],v,[(lhs,_368502),agr(_368466),v(_368507)]),
	[],                                          % PRE, LOCAL
	[mkEC(agr,_368465,_368466),                  % POST, LOCAL
	 agr(_368479),
	 mkFs([index(_368486),agm(_368479)],_368465),
	 hAdj(_368507,_368466,_368502),
	 addFeature(transparent(ecp),_368502),
	 addFeature(dest(agr),_368507)],
	[],                                          % PRE, REMOTE
	[])                                          % POST, REMOTE
The following sub-sections documents what hmCode/4 does with the various ACode types.


ACode trace(C,_,_,{left,right})


ACode nontrace([C1..,Cn],_,_)

      Cn Local(dest of movement)      Remote site

Post:
         recovery + hdadj code
         + dest(Cn)   if movement list > 1
X is a lexical category in the movement list.
hmCode(nontrace(Is,X,Varsp),[],Code,[],[]) :-
	identifyLexCat(Is,X),
	recoverable(Is,Is,[],[],Vars,Code1),
	hdAdjunction(Is,Vars,Vars1,Code2),
	length(Is,L),
	(L>1
	-> extractCatLabels(Is,Cs),
	   last(Cs,C),
	   Var =.. [X,R],
	   union([Var],Vars1,Varsp),
	   append1(Code2,[addFeature(dest(C),R)],Code3)
	;  Varsp = Vars1,
	   Code3 = Code2),
	append1(Code1,Code3,Code).

identifyLexCat(Cs,C) :-
	(member(C,Cs), lexicalCat(C))
	-> true
	;  C = [].
Code for computing the recovery elements.
%% recoverable(List,List,[],[],Vars,Code) holds if a list of category
%% labels to appear at a node is recoverable from the input.
%% If so, then
%%	Code: 	Prolog code to recover the constituents
%%	Vars: 	List of bindings of the form ..C(V)..
%%		C: category label, V: name of variable used in Code

recoverable([],_,Vars,Code,Vars,Code).
recoverable([C|L],Cs,Vars,Code,Varsp,Codep) :-
	assocRealCategory(C,DerivC,Vars1,Code1),
	( member(DerivC,Cs)
	; C == DerivC ),			  % independently recoverable
	union(Vars,Vars1,Vars2),
	append(Code,Code1,Code2),
	!,
	recoverable(L,Cs,Vars2,Code2,Varsp,Codep).

% assocRealCategory(X,Y,S,L) 
%
% Given a category X, determine a real category Y that X can be synthesized
% from (usually X). 
%   L = List of goals necessary for synthesizing X from Y
%   S = List of variable substitutions (c(Var))
% 
% Three (not necessarily mutually exclusive) cases, C is a:
% (1) Lexical category: look for C.
% (2) Bundle of features derived from a category C' using Gs: look for C'.
%	rule C derived_from C' provided Gs
% (3) Non-trace null EC: look for C.
%	rule empty C with Fs st Gs
Computes head adjunction code:
% Given movement sequence [C1,..,Cn]
% produces hdAdjSeq([X1,..,Xn],LHS)
% where Vars = [..,Ci(Xi),..]
% Output adjunct structure LHS is added to Vars

hdAdjunction(Chain,Vars,[lhs(LHS)|Varsp],Goals) :-
	length(Chain,N),
	N>1,
	!,
	extractCatLabels(Chain,Cs),
	mapVars(Cs,Vars,NVars,Xs),
	hdAdjunctionGoals(Cs,Xs,LHS,Goals),
	append(Vars,NVars,Varsp).
hdAdjunction(_,Vars,Vars,[]).


modifyHmCode/6

Called on remote pre- and post-conditions only that are produced by hmCode/4. When conditions are non-empty, only works for ACode = trace(C,Fs,[C(X)],_).

Produces: mod(Dest,[C(X)],Pre,Post)

Dest is the category of the destination of the movement rule. Pre and Post are the conditions computed by hmCode/4 for ACode = trace(_,_,_,_).

modifyHmCode(Pre,Post,ACode,Dest,Mods,Modsp) :-
	(Pre=[],Post=[])
	-> Mods = Modsp
	;  (ACode = trace(_,_,Vars,_)
	   -> Mods = [mod(Dest,Vars,Pre,Post)|Modsp]
	   ;  printNotice('Error: Head movement compilation, modifyHmCode/6'),
	      fail).