Download pdf - arXiv

Transcript
D.2. Organization
107
• lib/example_analyze.yap: It transforms and analyzes the user example files, in a similar way to the lib/cost_calculate.yap, but
considering only the evidence (it also detects and fails when a body of
a clause is found).
• lib/factorial_division: A Unix binary that uses the MPFR library
to determine the floating-point computations of the fraction described
in 4.4.4. It is also possible to compile it to other platforms from the
source file lib/factorial_division.c.
In any Microsoft/Linux platform, the behavior of the tool is exactly the
same: the Yap Prolog compiler is the responsible of transforming the calls
to files in order to fit the specific platform format, so there is no necessity to
use different code in different platforms.
Rather different is the behavior of the tool depending of which version
of Yap Prolog we are going to use: the stable version used in many Linux
distributions (Debian, Ubuntu...) is still Yap Prolog 5, instead of Yap Prolog
6.
The old one does not have the predefined predicates between/3 and
is_list/3. This problem is detected when we load the code and solved
declaring them in functions.yap, but there is a more important difference
that affects the precision of integer and floating-point calculations: only in
Yap Prolog 6 can we have the precision library GMP attached when the code
is compiled, and this library is compulsory to make calculations that clearly
affect the results (if we have a probability of 0.0019, the result of cost will
be hugely different from a probability of 0.002). To avoid problems with this
lack of precision, the functions.yap will halt when max_precision value (a
Yap Prolog flag) is not enough to make mathematical calculations.
When we call the program without using any modifier, the tool will fail
indicating that you need to call the program with at least one user code file
(as a program file) to analyze. It is possible to run the program directly
reading from the standard input using the special modifier ––, in this way:
$ echo -e "p(0,1).\np(_,_)." | ./mml_cost -The modifiers will start always with a double dash and the others arguments without them will be considered as files to load as user program
code:
$ mml_cost --help
It determines the MML cost of a Prolog program
Arguments: