Prolog Language Monotonicity Non-monotonic predicates


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.

If these predicates are used, then adding goals can lead to more solutions, which runs counter to the important declarative property known from logic that adding constraints can at most reduce, never extend, the set of solutions.

As a consequence, other properties that we rely for declarative debugging and other reasoning are also broken. For example, non-monotonic predicates break the fundamental notion of commutativity of conjunction known from first-order logic. The following example illustrates this:

?- var(X), X = a.
X = a.

?- X = a, var(X).

All-solutions predicates like findall/3 also break monotonicity: Adding clauses can lead to the failure of goals that previously hadĀ held. This also runs counter to montonicity as known from first-order logic, where adding facts can at most increase, never reduce the set of consequences.