Times, Quotient and Remainder predicates in Prolog
问题 how can I do the following. I needed to define the predicate shownumber (X,N) , which is true when the symbol X corresponds to the natural number N. For example, shownumber(s(zero),1) is true. Okay, now I've got a predicate: shownumber (zero, 0). shownumber (s (N), X): - shownumber (N, Y), X is Y + 1. Now I need to use the shownumber (X, Y) predicate to define: 1) times (X, Y, Z) which is true if X * Y = Z. 2) quotient (X, Y, Q) which is true if X / Y = Q (in natural number arithmetic) 3)