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 literals are negated in each clause C in our CNF example:
count_neg(C, count(*)) :- literal(C, _, 0).
This works as follows:
- Evaluate the body of the predicate; the result is a set of rows, one per negated literal.
- For each
C, add a row(C, n)tocount_neg, wherenis the number of those rows with thatC.