(@twinterer already gave an explanation, my answer is trying to take it from a different angle)
When you enter a request in Prolog, you will return to answer . Often the answer contains a solution , sometimes it contains several solutions, and sometimes it does not contain any solution at all. Quite often, these two concepts are confused. Consider the GNU Prolog examples:
| ?- length(Vs,3), fd_domain_bool(Vs). Vs = [_
Here we have an answer containing 8 solutions. I.e:
| ?- length(Vs,3), fd_domain_bool(Vs), fd_labeling(Vs). Vs = [0,0,0] ? ; Vs = [0,0,1] ? ; ... Vs = [1,1,1] yes
And now another request. This is the @twinterer example in question.
| ?- length(Vs,3), fd_domain_bool(Vs), fd_all_different(Vs). Vs = [_
The answer looks the same as before. However, it no longer contains a solution.
| ?- length(Vs,3), fd_domain_bool(Vs), fd_all_different(Vs), fd_labeling(Vs). no
Ideally, in this case, the top layer would not say yes, but possible. In fact, CLP (R), one of the very first constraint systems, did this.
Another way to make this a little less cryptic is to show the actual limitations. SWI does this:
?- length(Vs,3), Vs ins 0..1, all_different(Vs). Vs = [_G565,_G568,_G571], _G565 in 0..1, all_different([_G565,_G568,_G571]), _G568 in 0..1, _G571 in 0..1. ?- length(Vs,3), Vs ins 0..1, all_different(Vs), labeling([], Vs). false.
So, the SWI shows all the constraints that must be met in order to get a specific solution. Read the SWI answer as: Yes, there is a solution if all of these small prints are correct! Alas, the small print is incorrect.
And another way to solve this problem is to get the implementation of all_different/1 with greater consistency. But this only works in specific cases.
?- length(Vs,3), Vs ins 0..1, all_distinct(Vs). false.
In general, you cannot expect a system to maintain global consistency. Causes:
Maintaining consistency can be very costly. It is often best to delegate such labeling solutions. In fact, the simple all_different/1 often faster than all_distinct/1 .
Improved consistency algorithms are often very complex.
In general, maintaining global coherence is an insoluble problem.