We will now discuss how to match the scatter-gather DAG structure
discussed in Section . Note that the DAG in question can be
considered as a superposition of two rooted trees - one signifying the
causal ordering, and one the program-order of the sending process. Thus
we can ensure that the pattern matched is indeed the one the user intended,
by doing a two-step matching.
ch co_find = <: M @ R :> W @ R;
pch CoFind = co_find onsome 0..3;
match first = CoFind;
ch po_find = M R+ W @ R;
pch PoFind = po_find onsome 0..3;
match second = PoFind with [ first ];
The last statement does the matching, but it only considers the events
that were consumed by the match variable first. Thus the second
matching acts as an assertion. If it succeeds, then the user knows
that everything has gone well. If it fails then something is clearly wrong.