% Peano representation of natural numbers:
% - o (zero) is a natural number
% - if N is a natural number, then the successor s(N) is a natural
%   number

% is the argument a natural number?
isPeano(o).
isPeano(s(N)) :- isPeano(N).

% add(X,Y,Z) <=> Z is the sum of the natural numbers X and Y
add(o,Y,Y).
add(s(X),Y,s(Z)) :- add(X,Y,Z).

% sub(X,Y,Z) <=> Z is the difference between X and Y (Z = X - Y)
sub(X,Y,D) :- add(Y,D,X).

% mult(X,Y,Z) <=> Z is the product of the natural numbers X and Y
mult(o,_,o).
mult(s(X),Y,Z) :- mult(X,Y,XY), add(XY,Y,Z).
