7.3 Graph predicates

In principle, by now there are all the operators to describe syntax graphs. For reasons of convenience, and to a certain extent for reasons of completeness, we have added so-called graph predicates, e.g. to designate the root of a graph.

Root predicate

The root of a graph (for a whole sentence) can be identified by the predicate root.

root(#n1)

Arity predicates

The following graph description describes all graphs which contain a certain node #n1 with at least two children #n2 and #n3:

(#n1 > #n2) & (#n1 > #n3)

However, one would like to state that there must be exactly two children. For this reason, we introduce a two-place operator arity in order to be able to restrict the number of children of a node #n1, e.g. to two children:

(#n1 > #n2) & (#n1 > #n3) & arity(#n1,2)

The arity predicate can also come with three arguments in order to indicate an interval of number of children, e.g. from two to four children:

(#n1 > #n2) & (#n1 > #n3) & arity(#n1,2,4)

Similarly, there is a tokenarity operator to constrain the number of leaves which are dominated by this node. For example, the following means that node #n1 must dominate exactly 5 terminal nodes. And the subsequent example states that node #n1 must have between 5 and 7 leaves.

tokenarity(#n1,5)
tokenarity(#n1,5,7)

Continuity predicates

It may be useful to state that the leaves which are dominated by a node must form a continuous string or not. For this purpose, the two unary operators continuous and discontinuous have been introduced:

continuous(#n1)
discontinuous(#n1)