I recognize that the notion “deterministic code” is extremly challenging. But a professional Prolog programmer needs to know the ABC of “deterministic code” backwards and forwards while sleeping on a burning airplane without a parachute.
(=>)/2 together with if-then-else (like in Erlang) is always deterministic. If in your Prolog code every clause in your program with
(=>)/2 and with if-then-else (like in Erlang) nothing will be non-deterministic. You need at least one rule using
(?=>)/2 or at least one rule using the true
(;)/2 disjunction, which is not if-then-else, to get something non-deterministic.
Maybe ask @dtonhofer to create a matrix. In the past @dtonhofer has created quite useful matrixes, about Prolog types, attributed variables, etc… You could make one dimension with the clause operator (=>)/2, (?=>), (:-)/2 and one dimension with what is found in the body. And then in the cells whether the predicate might be deterministic or not. He will possibly confirm my claim.
In as far the
($)/0 would only make sense if the
Body has predicates that are coded with
(?=>)/2 or true
(;)/2. If the
Body has nothing that is coded this way, you also don’t need
($)/0. There is a further and maybe fifth clause operator, namely (:-)/2 together with cut (!)/0.
Or namely (:-)/2 together with some guards and the cut (!)/2. Also there are a few further ISO core standard predicates that generate choice points, like for example repeat/0. So when I mentioned (;)/2, I mentioned only one representant of non-deterministic control flow.
There are a few more system predicates which might need a ban to create determinsitic code, like repeat/0 etc… This could also go in a matrix.