• 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

4.1 Notation of Predicate Descriptions
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • Built-in Predicates
        • Notation of Predicate Descriptions
          • The argument mode indicator
          • Predicate indicators
          • Predicate behaviour and determinism
    • Packages

4.1.3 Predicate behaviour and determinism

The keywords in table 4 may appear in the manual's predicate descriptions and in pldoc structured comments in source code. They describe the general behaviour of a predicate.

det A deterministic predicate always succeeds exactly once and does not leave a choicepoint.
semidet A semi-deterministic predicate succeeds at most once. If it succeeds, it does not leave a choicepoint.
nondet A non-deterministic predicate is the most general case and no claims are made on the number of solutions (which may be zero, i.e., the predicate may fail) and whether or not the predicate leaves a choicepoint on its last solution.
multi As nondet, but succeeds at least once.
failure Always fails.
undefined Well-founded semantics “third value” . See undefined/0.
Table 4 : Determinism indicators

“Leaving no choicepoint” means that the system knows that redoing the predicate will not yield any additional solutions. For example, member/2 is non-deterministic, but deterministic if the solution is the last element of the list. The predicate member/2 may not know immediately whether there are more solutions after the first one, so a choicepoint remains, even if it eventually turns out to yield nothing:

?- member(1, [2,1,3]).
true ;     % there may be more solutions
false.     % actually not

If a solution is the last element of the list, there is enough information to leave no choicepoint:

?- member(1, [2,3,1]).
true.

Note that if the toplevel waits for input after a query this indicates that the query succeeded with a choicepoint. If the user enters * the toplevel explains the location of the choicepoint. Alternatively, the GUI debugger may be used to examine the open choicepoints.

ClioPatria (version V3.1.1-59-g7b9a7a3)