:- use_module(library(aggregate)).(can be autoloaded)
max(X,Witness)and Goal has no solutions, i.e., the minimum and maximum of an empty set is undefined.
The Template values
min(X,W) are processed incrementally rather than using findall/3
and run in constant memory.