A.9.17 CLP(FD) predicate index
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • The SWI-Prolog library
        • library(clpfd): CLP(FD): Constraint Logic Programming over Finite Domains
          • CLP(FD) predicate index
            • Arithmetic constraints
            • Membership constraints
              • in/2
              • ins/2
            • Enumeration predicates
            • Global constraints
            • Reification predicates
            • Reflection predicates
            • FD set predicates
            • FD miscellaneous predicates
    • Packages

A.9.17.2 Membership constraints

If you are using CLP(FD) to model and solve combinatorial tasks, then you typically need to specify the admissible domains of variables. The membership constraints in/2 and ins/2 are useful in such cases.

?Var in +Domain
Var is an element of Domain. Domain is one of:
Integer
Singleton set consisting only of Integer.
Lower .. Upper
All integers I such that Lower =< I =< Upper. Lower must be an integer or the atom inf, which denotes negative infinity. Upper must be an integer or the atom sup, which denotes positive infinity.
Domain1 \/ Domain2
The union of Domain1 and Domain2.
+Vars ins +Domain
The variables in the list Vars are elements of Domain. See in/2 for the syntax of Domain.