The most common use for this constraint is to state a relation between two variables, where one is a linear index and the other an arbitrary value defined by an entry in a table of constants.
More generally, the table can itself contain problem variables.
If Values contains only instantiated integers, then the implementation maintains domain-consistency between Index and Element.
If Values contains reals or domain variables, the implementation maintains bounds-consistency for Element and the variables in Values, and domain-consistency for Index.
?- element(I, [1,3,6,3], V).
I = I{1 .. 4}
V = V{[1, 3, 6]}
There is 1 delayed goal.
yes.
?- element(I, [](1,3,6,3), V), V #\= 3.
I = I{[1, 3]}
V = V{[1, 6]}
There is 1 delayed goal.
yes.
?- A#::2..4, B#::8..9, C#::4..5, element(I, [A,B,C], X), X#=<7.
A = A{2 .. 4}
B = B{[8, 9]}
C = C{[4, 5]}
I = I{[1, 3]}
X = X{2 .. 5}
There is 1 delayed goal.
Yes (0.00s cpu)