This restores the functionality that Teri introduced, but in which we
found a bug. It also extends it to fold. It detects if no undefs
occur and uses the earlier more efficient version in that case. There
is some overhead for the checking but it is small compared to always
assuming undefineds occur.
It should be noted that producing all possible undef answers can be
combinatorically explosive, so care should be taken when using this
option.