
(Union for [A— > BC] in (BP A)
(Union for [[i,j],[j,n]] in (Absorb B [i,n])
(For [[j,k],[k,n] in (Absorb C [j,n])
collect [[i,k],[k,n]])))))
The second element of the second argument to Absorb will always be n, since it never
changes. We can clearly omit this from the parameter structure and simplify. We then
get the following algorithm, renamed Endpositions.
Algorithm XIV
Invoke (member n (Endpositions 'S 0))
Define (Endpositions Ai) = ; returns a set of end positions
case n-i =1
(if (member [A —> (input i i+1)] (UP A))
then {i+1} else {})
case n-i > 1
(Union (if (member [A —> (input i i+1)] (UP A))
then {i+1} else {})
(Union for [A ~> BC