Being new to Prolog, I came across a very interesting discussion that happened in late 2012. What I noticed was that there were, at the time, two notions of 'semidet' in Prolog community, namely:
- A computation that succeeds at most once.
- A computation that, upon success, leaves no choice points open.
Clearly the second one implies the first, but not vice versa.
Reading the thread, I understood that the first one was Dr.Neumerkel's notion, and the second was Drs.Wielemaker, O'Keefe, and others'.
Googling around, I've seen some database researchers mean by 'semi-deterministic' a query that would answer at most one equivalence class, nearer to the first notion.
Dr. Neumerkel says (refering to the predicate called call_semidet
there):
The implementation might be improved, but prior to optimizing and bechnmarking the actual meaning needs to be settled.
So, has the meaning been settled?
How about 'det'?
It seems customary to classify predicates according to their number of solutions. According to the SWI-Prolog's definition (see below), a 'det' can do fully nondeterministic (say parallel) computations, provided it commits to a solution which is now guaranteed to exist. So, by analogy I guess there may be two notions of 'det':
- A computation which succeeds exactly once.
- A computation which succeeds exactly once and which, upon success, leaves no choice points.
The first one is more logical but undecidable in general until the end of the computation. The second is easily decidable once a solution is found, but procedural and its meaning depends on the particular search strategy Prolog employs, i.e. the depth first search.
I wonder if there is not a community's consensus yet? Why not name these two different concepts differently?
Here's the excerpt from the SWI-Prolog's page above:
det [determinism]
Short for deterministic.
deterministic
A predicate is deterministic if it succeeds exactly one time without leaving a choice point.
semidet
Shorthand for semi deterministic.
semi deterministic
A predicate that is semi deterministic either fails or succeeds exactly once without a choice point. See also deterministic.