PREDICATES
ADD(integer,integer,integer)
SUB(integer,integer,integer)
MUL(integer,integer,integer)
DIV(integer,integer,integer)
CLAUSES
ADD(A,B,SUM):-
SUM=A+B.
SUB(A,B,DIF):-
DIF=A-B.
MUL(A,B,MUL):-
MUL=A*B.
DIV(A,B,DIV):-
DIV=A/B.
//output
Goal: ADD(5,4,SUM)
SUM=9
1 solution
Goal: SUB(9,4,SUB)
SUB=5
1 solution
Goal: MUL(4,5,MUL)
MUL=20
1 solution
Goal: DIV(10,2,DIV)
DIV=5
1 solution

*Related*

this is not working

try this

PREDICATES

ADD(integer,integer,integer)

SUB(integer,integer,integer)

MUL(integer,integer,integer)

DIV(integer,integer,integer)

CLAUSES

ADD(A,B,SUM):-

SUM=A+B.

SUB(A,B,DIF):-

DIF=A-B.

MUL(A,B,MUL):-

MUL=A*B.

DIV(A,B,DIV):-

DIV=A/B.

GOAL

ADD(5,4,SUM),

SUB(5,4,DIF),

MUL(5,4,MUL),

DIV(5,4,DIV).