We start by defining the prediction rule. Figure 4.1 specifies the procedure.
Figure 4.1: The procedure for prediction.
Prediction will be performed on active items AL and will return true or false depending on whether a new item has been added to the agenda (see line (1)). It will predict instantiations [Rule] of all rules Rule in the grammar G whose head HEAD(Rule) unifies with the restriction of the selected element of the active item, denoted as (SEL(AL)) (line (3)) and inserts new items (line (4)) into the agenda Agenda according to a given priority determined by the function PRIO individually for each new item (line (5)).
Figure 4.2: The procedure for passive-completion.