% Peano representation of natural numbers: % a natural number is 0 (Funktor: o) or the successor s(n) of a natural number n isPeano(o). isPeano(s(N)) :- isPeano(N). % Operations on Peano numbers: successor and predecessor succ(N, s(N)). pred(s(N), N). % add operation on Peano numbers: add(o ,Y,Y). add(s(X),Y,s(Z)) :- add(X,Y,Z). % subtraction, i.e., compute the difference Z between X and Y (with X>=Y) sub(X,Y,Z) :- add(Y,Z,X). % multiply operation on Peano numbers: mult(o ,_,o). mult(s(X),Y,Z) :- mult(X,Y,XY), add(XY,Y,Z). % less-or-equal: leq(o,_). leq(s(X),s(Y)) :- leq(X,Y).