It is sometimes argued that, for the sake of efficiency, we must accept the use of non-monotonic constructs in real-world Prolog programs.
There is no evidence for this. Recent research indicates that the pure monotonic subset of Prolog may not only be sufficient to express most real-world programs, but also acceptably efficient in practice. A construct that has recently been discovered and encourages this view is if_/3
: It combines monotonicity with a reduction of choice points. See Indexing dif/2.
For example, code of the form:
pred(L, Ls) :- condition(L), then(Ls). pred(L, Ls) :- \+ condition(L), else(Ls).
Can be written with if_/3
as:
pred(L, Ls) :- if_(condition(L), then(Ls), else(Ls)).
and combines monotonicity with determinism.