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 not holds everywhere; both become all of num.
  • Round 2: now both are full, so not holds 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.