So why does equal([1,2,3], X) not end up universally with your code?
Look at your failure-slice code! What are failures? Here is the tag information:
Failure Failure - A fragment of the Prolog program obtained by adding multiple targets to false . Fail-safe fragments help to localize the reasons for the universal failure of a pure monotonous Prolog program. They also help to give a lower estimate of the number of conclusions needed. This is a specific program-slicing .
To create a slice of failure:
- we insert
false targets into the program - making sure that the fragment does not end with the above value.
del (_, [], []): - false .
del (X, [X | T], T): - false .
del (X, [H | T], [H | T1]): - false ,
dif (X, H) ,% note that the OP originally used `X \ = H`
del (X, T, T1) .
member (X, [X | _]).
member (X, [_ | T]): -
member (X, T).
equal ([], []): - false .
equal ([X], [X]): - false .
equal ([H1 | T], L2): -
member (H1, L2), false ,
del (H1, L2, L3) ,
equal (T, L3) .
? - equal ([1,2,3], _), false . % note that `false` is redundant ...
** LOOPS ** % ... as above `equal / 2` cannot succeed.
So ... what does refusal of refusal mean? It says:
- So that the goal
equal([1,2,3], X) ends universally ... - ... we must change at least one of the remaining parts (those that are not
crossed out )!
repeat
source share