N-Prolog Version 3.51
N-Prolog Ver 3.51 Release Notes
Release Date: December 1, 2024
Version: 3.51
Key Changes
This release addresses several important issues, including backtracking behavior, the handling of op/3, and general system stability improvements.
-
Bug Fix in Backtracking Handling
Overview
In certain cases, the last successfully executed predicate failed to properly invoke its continuation. This issue caused some complex rules and predicate combinations to behave unexpectedly.Affected Cases
The issue was observed in cases like the following:seq :- test1, test2, write(done).
test1 :- fail.
test1.test2 :- fail.
test2.Before the fix, running the seq predicate did not output done as expected.
Resolution
The compiler has been updated to ensure that the continuation is properly invoked after the last successful predicate. As a result, the example above now behaves as intended. -
Fix in op/3 Predicate
Issue with the Third Argument
A bug was discovered where providing a list as the third argument to op/3 resulted in incorrect behavior. This bug has now been fixed, and op/3 correctly accepts lists as valid third arguments.Constraint on the First Argument
The first argument of op/3 (denoting the precedence) now correctly enforces the specification that the value must be between 1 and 1200 (inclusive). If the precedence is outside this range, an "Operator priority error" is raised.Error Example
?- op(0, xfx, test).
Operator priority error op 0
?- op(500, xfx, [relation1, relation2]).
yes
-
New Test Cases Added
A new test case, tests/bug.o, has been added to validate the fix for backtracking behavior.
Additional test cases for op/3 have been included to verify correct handling of lists and precedence values.
Verification Example
The following demonstrates the correct behavior after the fixes:
?- ['./tests/bug.o'].
yes
?- seq.
done
yes
?- op(600, xfy, [and, or]).
yes
?- op(1300, xfx, test).
ERROR: op/3: The precedence must be between 1 and 1200.
?- op(0, xfx, test).
Operator priority error op 0
Looking Ahead
We are committed to further improving N-Prolog based on user feedback. If you encounter any issues or have suggestions, please let us know!