Finally, using “as
the Prolog flag
the number of answers in a table is restrained. In addition to the
tripwire actions this restraint supports the action
complete_soundly is supported as a synonym for XSB
compatibility. If the restraint is reached in the bounded
rationality mode the system takes the following actions:
- Ignore the answer that triggered the restraint.
- Prune the choice points of the tabled goal to avoid more answers.
- Add an new answer to the table that does not bind any variables, i.e., an empty answer substitution. This answer is conditional on answer_count_restraint/0.
- This predicate is undefined in the sense of well founded
semantics (see section 7.6
Any answer that depends on this condition is undefined because the
max_answersrestraint on some table was violated.
The program and subsequent query below illustrate the behavior.
:- table p/2 as max_answers(3). p(M,N) :- between(1,M,N).
?- p(1 000 000, X). X = 3 ; X = 2 ; X = 1 ; % WFS residual program p(1000000, X) :- answer_count_restraint. p(1000000, X).