A.9 library(clpfd): CLP(FD): Constraint Logic Programming over Finite Domains
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • The SWI-Prolog library
        • library(clpfd): CLP(FD): Constraint Logic Programming over Finite Domains
          • Introduction
          • Arithmetic constraints
          • Declarative integer arithmetic
          • Example: Factorial relation
          • Combinatorial constraints
          • Domains
          • Example: Sudoku
          • Residual goals
          • Core relations and search
          • Example: Eight queens puzzle
          • Optimisation
          • Reification
          • Enabling monotonic CLP(FD)
          • Custom constraints
          • Applications
          • Acknowledgments
          • CLP(FD) predicate index
          • Closing and opening words about CLP(FD)
    • Packages

A.9.12 Reification

The constraints in/2, #=/2, #\=/2, #</2, #>/2, #=</2, and #>=/2 can be reified, which means reflecting their truth values into Boolean values represented by the integers 0 and 1. Let P and Q denote reifiable constraints or Boolean variables, then:

#\ QTrue iff Q is false
P #\/ QTrue iff either P or Q
P #/\ QTrue iff both P and Q
P #\ QTrue iff either P or Q, but not both
P #<==> QTrue iff P and Q are equivalent
P #==> QTrue iff P implies Q
P #<== QTrue iff Q implies P

The constraints of this table are reifiable as well.

When reasoning over Boolean variables, also consider using CLP(B) constraints as provided by library(clpb).