abs(X, Y) :- X >= 0, Y is X. abs(X, Y) :- Y >= 0, X is Y. abs(X, Y) :- X < 0, Y is -X.