[ library(cardinal) | Reference Manual | Alphabetic Index ]
Cardinality of a set expression
- A Set expression.
- An integer or an FD variable.
Cardinality is the cardinality of SetExpression, a set term possibly
including set operators `/\, `\/ and `\ (or \).
SetExpression is first evaluated into a ground set or a set variable and then
its Cardinality is applied as in cardinality/2.
Fails if Cardinality can not be the cardinality of SetExpression.
?- S `::..[a,b], #(S,C).
?- S `::..[a,b], #(S `/\ [b,c],1).
?- S `::..[a,b], #([b,c] `\/ S `\ [a,z] `/\ [g], C).
C = 2,
?- S `::..[a,b], #(([b,c] `\/ S `\ [a,z]) `/\ [g], C).
C = 0
?- S1 `::..[a,b], S2 `::..[b,c,d], #(S1 `/\ S2, 2).
cardinality / 2, `= / 2