% Peano representation of natural numbers: % z(ero) is a natural number % if n is a natural number, then also succesor(n), i.e., s(n) % is the argument a natural number? isPeano(z). isPeano(s(N)) :- isPeano(N). % relate a number to its succesor succ(N,s(N)). % relate a number to its predecessor pred(s(N),N). % addition as a relation between three natural numbers: add(z ,N,N). add(s(M),N,s(Z)) :- add(M,N,Z). % subtraction as a relation between three natural numbers: sub(M,N,Z) :- add(N,Z,M). % multiplication as a relation between three natural numbers: mult(z,_,z). mult(s(M),N,Z) :- mult(M,N,R), add(R,N,Z). % less-or-equal: leq(z,_). leq(s(M),s(N)) :- leq(M,N).