Michael Kifer - 2013-08-19

Once delay is fixed, aggregates should be delayed automatically on nonvat(?X) for every non-grouping, non-aggregate variable in the aggregate body. That is,
in the above,
q(?X,?R) :- sum{?A|p(?A,?X)} =?L, ?R is ?L+1.
s(?X,?R) :- q(?X,?R), r(?X).
should just work without explicit delay quantifiers.