I am trying to Implement plus(X,Y,Z) , which should return all triples of elements in the ring Z_m that satisfy the property X + Y = Z, etc.
Here is my codes:
plus(X,Y,Z):-read(M),A is mod(X,M),B is mod(Y,M),Sum is A+B,Z is Sum mod M.
times(X,Y,Z):-read(M),A is mod(X,M),B is mod(Y,M),Product is A*B,Z is Product mod M.
But it is said:
Arguments are not sufficiently instantiated
In:
[2] _1430 is _1436 mod 5
[1] plus(_1490,_1492,_1494) at line 10
I am new to Prolog and I feel so clueless...