Indexing

The index(_) Feature

Although indices are presented as numbers in PAPPI:

the internal representation is always a variable.

So, coindexation involves variable unification only.

The Constraint Predicate Link/2

The constraint predicate link adds another feature link(_) to the implementation. If two unindexed constituents are linked, they are assigned the same link feature.

Indexing must be sensitive to this constraint predicate. The index/2 predicate which assigns indices to constituents must check for the presence of a link(_) feature and unify its argument with it (if one is present):

index(Item,I) :-
	Item has_feature index(J),
	!,
	I = J,
	linkOne(Item,J).
index(Item,I) :-
	addFeature(index(I),Item),
	linkOne(Item,I).

linkOne(Item,I) :-
	Item has_feature link(J) -> I = J ; true.