Zero-effect clauses
Note that writing clauses like
p(1,2) :- false.
has absolutely no effect on the meaning of Prolog program - you might as well leave them out (because everything that is left out is considered false - Closed World Assumption)
For example:
p(2,4) :- false. p(A,B) :- between(1,4,A),B is 2*A.
Result:
?- p(2,4). true. ?- bagof([X,Y],p(X,Y),Bag). Bag = [[1, 2], [2, 4], [3, 6], [4, 8]].
and it is exactly the same for
p(A,B) :- between(1,4,A),B is 2*A. p(2,4) :- false.
or
p(A,B) :- between(1,4,A),B is 2*A.
And now for some inconsistency
Using false
and the cut means you can write Bad and Inconsistent Programs:
f(X,X) :- !, false. f(0,1).
Now you are in trouble:
?- f(0,1). % f(0,1) is in the truth set true. ?- f(0,_). % there is no f/2 in the truth set with 0 on first position! false. ?- f(_,1). % there is no f/2 in the truth set with 1 on second position! false.
Failure-Slice Debugging Technique
From the Stack Overflow tag for failure-slice
A failure-slice is a fragment of a Prolog program obtained by inserting one or more false
goals somewhere in it. Failure-slices help to localize reasons for universal non-termination of a pure monotonic Prolog program. They also help to give a lower bound for the number of inferences needed. It is a concrete program-slicing technique.
References
Localizing and explaining reasons for non-terminating logic programs with failure-slices (Ulrich Neumerkel, Fred Mesnard, September 1999)
See also