Using the Determinacy Checker

There are two different ways to use the determinacy checker, either as a stand-alone tool, or during compilation. You may use it whichever way fits best with the way you work. Either way, it will discover the same nondeterminacy in your program.

The stand-alone determinacy checker is called qpdet, and is run from the shell prompt, specifying the names of the Prolog source files you wish to check. You may omit the .pl suffix if you like.

     % qpdet [-r [-d] [-D] [-i ifile] fspec...]
     

The qpdet program is placed in the Quintus tools directory, and is not built by default when Prolog is installed, so you may have to build it (by typing make qpdet in the tools directory) first. The tool takes a number of options:


-r
Process files recursively, fully checking the specified files and all the files they load.
-d
Print out declarations that should be added.
-D
Print out all needed declarations.
-i ifile
An initialization file, which is loaded before processing begins.

The determinacy checker can also be integrated into the compilation process, so that you receive warnings about unwanted nondeterminacy along with warnings about singleton variables or discontinuous clauses. To make this happen, simply insert the line

     :- load_files(library(detcheck),
                   [when(compile_time), if(changed)]).
     

Once this line is added, every time that file is compiled, whether using qpc or the compiler in the development system, it will be checked for unwanted nondeterminacy.