I've got the following knowledge base, which is supposed to add two arguments and give the results:
add(0,X,X).
add(succ(X),Y,succ(R)):- add(X,Y,R).
Now this is my query:
?- add(succ(succ(succ(0))), succ(succ(0)), Result).
The 0 does not unify with the first argument so it goes to the second add/3 clause. Now here is the thing i can't figure out. The book (LPN) tells me that the outermost succ factor is stipped off the first argument, but I can't figure out why? In my mind it adds a succ functor. Could someone please explain why it is stripping it off?
Thanks in advance!
Luuk