how does the order we put the cut symbol '!' inside a Prolog predicate affects the results? For example in this code:
p(0,Y) :- !, Y is 0.
p(X,Y) :- A is X-1, p(A,B), Y is B+X.
When we test with a query like p(2,3). the program answers with true, and even when we try this p(V,6) the program answers with false But when we reverse the order of the cut symbol, like this :
p(0,Y) :- Y is 0, !.
p(X,Y) :- A is X-1, p(A,B), Y is B+X.
The program answers correctly the first query, but for the second one it returns the famous "Arguments are not sufficiently instantiated" error.