A tempting shortcut
Why bother with N - 1? Define each predicate as the negation of the other:
Run naive evaluation and it never settles:
- Round 1: both relations are empty, so
notholds everywhere; both become all ofnum. - Round 2: now both are full, so
notholds nowhere; both become empty. - Round 3 fills them again: it flips forever, never stable.
Naive evaluation does not terminate here, and Datamog rejects the program before it even starts.