A.8 library(clpb): CLP(B): Constraint Logic Programming over Boolean Variables
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • The SWI-Prolog library
        • library(clpb): CLP(B): Constraint Logic Programming over Boolean Variables
          • Introduction
          • Boolean expressions
          • Interface predicates
          • Examples
          • Obtaining BDDs
          • Enabling monotonic CLP(B)
          • Example: Pigeons
          • Example: Boolean circuit
          • Acknowledgments
          • CLP(B) predicate index
    • Packages

A.8.6 Enabling monotonic CLP(B)

In the default execution mode, CLP(B) constraints are not monotonic. This means that adding constraints can yield new solutions. For example:

?-          sat(X=:=1), X = 1+0.
false.

?- X = 1+0, sat(X=:=1), X = 1+0.
X = 1+0.

This behaviour is highly problematic from a logical point of view, and it may render declarative debugging techniques inapplicable.

Set the flag clpb_monotonic to true to make CLP(B) monotonic. If this mode is enabled, then you must wrap CLP(B) variables with the functor v/1. For example:

?- set_prolog_flag(clpb_monotonic, true).
true.

?- sat(v(X)=:=1#1).
X = 0.