Is there a consensus on the definition of 'semidet' in Prolog?

I’ve been learning Prolog and stumbled upon an interesting debate about the meaning of ‘semidet’. It seems there are two main interpretations:

  1. A computation that succeeds at most once
  2. A computation that, when successful, doesn’t leave any choice points open

The second definition is stricter than the first. I’m curious if the Prolog community has reached an agreement on which definition to use.

I also noticed that ‘det’ (deterministic) predicates have similar ambiguity:

  1. A computation that succeeds exactly once
  2. A computation that succeeds exactly once and leaves no choice points

The first is more logical but harder to determine, while the second is easier to check but depends on Prolog’s search strategy.

Has the community settled on official definitions for ‘semidet’ and ‘det’? If not, why not use different terms for these concepts? It would be helpful for newcomers like me to have clear distinctions.

% Example of a potentially ambiguous semidet predicate
maybe_succeed(X) :-
    X > 5,
    X < 10.

% Is this semidet according to definition 1 or 2?
% It succeeds at most once, but might leave choice points

What are your thoughts on this? Has there been any recent discussion or decision in the Prolog community about these terms?

As someone who’s been working with Prolog for a while, I can say that this ambiguity in ‘semidet’ and ‘det’ definitions has caused some headaches in real-world projects. In my experience, most teams tend to lean towards the stricter definitions - the ones that consider choice points. It’s more practical from an optimization standpoint.

That said, I’ve seen this vary depending on the specific Prolog implementation being used. Some are more strict about these concepts than others. When I’m collaborating on a project, we always make it a point to explicitly define what we mean by ‘semidet’ and ‘det’ in our project documentation.

As for introducing new terms, I’m not sure that’s the best solution. It might just add more confusion to an already complex topic. Instead, I think the Prolog community could benefit from a more formal standardization of these terms. It would make life easier for everyone, especially newcomers to the language.

In the meantime, my advice would be to always clarify which definition you’re using in your code comments or documentation. It saves a lot of potential confusion down the line.

hey, this is a tricky one! i’ve seen debates on this too. from what i’ve gathered, there’s no official consensus yet. some folks prefer the stricter definitions, while others go with the simpler ones. it kinda depends on the context and implementation. maybe we need new terms to clear things up? wat do u think?

In my experience working with Prolog, the lack of consensus on ‘semidet’ and ‘det’ definitions can indeed be frustrating. While there’s no official standard, I’ve found that most practitioners lean towards the stricter definitions in real-world applications. This preference is largely due to the predictability and efficiency gains when ensuring no choice points are left open.

However, it’s worth noting that different Prolog implementations might interpret these terms slightly differently. When writing portable code or collaborating with others, it’s always a good practice to explicitly state which definition you’re adhering to in your documentation or comments.

As for introducing new terms, while it could potentially clarify things, it might also add to the existing complexity. Perhaps a more practical approach would be for the Prolog community to formally adopt one set of definitions, even if it requires some compromise.