plus(X,Y,Z):- int(X),int(Y),!,Z is X + Y. plus(X,Y,Z):- int(Y),int(Z),!,X is Z - Y. plus(X,Y,Z):- int(X),int(Z),!,Y is Z - X.
plus(X,Y,Z)
and
analysis is able to determine that X
and Y
are
integers, we can simplify it to:
plus(X,Y,Z):- Z is X + Y.
int(X)
and int(Y)
are redundant tests
plus/3
plus/3
is called at some other program point and the
analyzer has not determined that X
and Y
are integers,
the previous simplification cannot be done.