Fixed reversible power bug

This commit is contained in:
Diogo Cordeiro 2018-11-22 12:34:42 +00:00
parent da9bfb77e4
commit 7acc8ed47a
1 changed files with 2 additions and 4 deletions

View File

@ -38,12 +38,10 @@ polynomial_variable(X) :-
% Returns true if X is a power term, false otherwise.
% Fully reversible.
%
power(P) :-
%% Makes this more reversible
P = X ^ N,
power(P^N) :-
%% CPL(FD) library predicate to perform integer comparassions in a reversible way
%% If 0 > N succeds, fail, otherwise check if X is a valid variable
(zcompare((>), 0, N); polynomial_variable(X)), fail.
(zcompare((<), 0, N), polynomial_variable(P)); fail.
%% if(zcompare((>), 0, N),
%% fail,
%% polynomial_variable(X)