%for all you late visitors to this post (like myself):-)
blah(multiply,A,B,Ans) :- Ans is A*B.
blah(divide,A,B,Ans) :- Ans is A/B.
blah(add,A,B,Ans) :- Ans is A+B.
blah(subtract,A,B,Ans) :- Ans is A-B.
?- blah(add,3,4,X).
X = 7.
?- blah(Y,3,4,X).
Y = multiply,
X = 12 ;
Y = divide,
X = 0.75 ;
Y = add,
X = 7 ;
Y = subtract,
X = -1.
?-