• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

7.10 Tabling restraints: bounded rationality and tripwires
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • Tabled execution (SLG resolution)
        • Tabling restraints: bounded rationality and tripwires
          • tripwire/2
          • size_abstract_term/3
          • radial_restraint/0
          • Restraint subgoal size
          • Restraint answer size
          • Restraint answer count
            • answer_count_restraint/0
    • Packages

7.10.3 Restraint answer count

Finally, using “as max_answers(Count)” or the Prolog flag max_answers_for_subgoal, the number of answers in a table is restrained. In addition to the tripwire actions this restraint supports the action bounded_rationality193The 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.
[undefined]answer_count_restraint
This predicate is undefined in the sense of well founded semantics (see section 7.6 and undefined/0). Any answer that depends on this condition is undefined because the max_answers restraint 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).

ClioPatria (version V3.1.1-51-ga0b30a5)