Tutorial by Examples

Monotonic predicates can be debugged by applying declarative reasoning. In pure Prolog, a programming mistake can lead to one or all of the following phenomena: the predicate incorrectly succeeds in a case where it should fail the predicate incorrectly fails in a case where it should succeed t...
Examples of monotonic predicates are: unification with (=)/2 or unify_with_occurs_check/2 dif/2, expressing disequality of terms CLP(FD) constraints like (#=)/2 and (#>)/2, using a monotonic execution mode. Prolog predicates that only use monotonic goals are themselves monotonic. Monoton...
Here are examples of predicates that are not monotonic: meta-logical predicates like var/1, integer/1 etc. term comparison predicates like (@<)/2 and (@>=)/2 predicates that use !/0, (\+)/1 and other constructs that break monotonicity all-solutions predicates like findall/3 and setof/3. ...
Here are examples of how to use monotonic predicates instead of impure, non-monotonic constructs in your programs: dif/2 is meant to be used instead of non-monotonic constructs like (\=)/2 arithmetic constraints (CLP(FD), CLP(Q) and others) are meant to be used instead of moded arithmetic predi...
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...

Page 1 of 1