Prolog successor notation yields incomplete result and infinite loop
I start to learn Prolog and first learnt about the successor notation. And this is where I find out about writing Peano axioms in Prolog. See page 12 of the PDF : sum(0, M, M). sum(s(N), M, s(K)) :- sum(N,M,K). prod(0,M,0). prod(s(N), M, P) :- prod(N,M,K), sum(K,M,P). I put the multiplication rules into Prolog. Then I do the query: ?- prod(X,Y,s(s(s(s(s(s(0))))))). Which means finding the factor of 6 basically. Here are the results. X = s(0), Y = s(s(s(s(s(s(0)))))) ? ; X = s(s(0)), Y = s(s(s(0))) ? ; X = s(s(s(0))), Y = s(s(0)) ? ; infinite loop This result has two problems: Not all results