The following predicate is remove(L, X, R), where L is a list, X is an element to remove from the list. The code returns the correct list, however it always also returns false afterwards.
I can't find the place where two of the rules can be applied during runtime.
remove([],X,[]) :- !.
remove([X|T],X,L1) :- remove(T,X,L1).
remove([H|T],X,[H|L1]) :- \+(X==H), remove(T,X,L1).
Output:
remove([1,2,3,4], 3, R).
R = [1, 2, 4] ;
false.