One summary per group
A non-aggregate head argument splits the rows into groups: one summary per distinct value.
For example, we can count how many variables are negated in each clause C in our CNF example:
count_neg(C, count(V)) :- literal(C, V, 0).
This works as follows:
- Evaluate the body of the predicate; result is a set of tuples
(C, V). - For each
C, add a row(C, n)tocount_negwherenis the number of tuples whose first component isC.