From 7acc8ed47af1b8868104bd2dab5eedded949fc06 Mon Sep 17 00:00:00 2001 From: Diogo Cordeiro Date: Thu, 22 Nov 2018 12:34:42 +0000 Subject: [PATCH] Fixed reversible power bug --- polimani.pl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/polimani.pl b/polimani.pl index cce9b39..bca9745 100644 --- a/polimani.pl +++ b/polimani.pl @@ -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)