I’m a bit confused about term indexing in CHR constraints.
The question I have stems from a sentence in the famous CHR tutorial slides in which it is asserted (slide 151) that
foo(a, Y), foo(a, Z) ==> more stuff..
means:
foo(X,Y), foo(W,Z) ==> X==W | more stuff...
I’d like to know if that equivalence is true only in a semantical sense, or also in an operational one. In the first case, I can call foo(a,X), foo(a,Y)
and pay a price that goes with the square of the number of a
s, in the second case, I would have to pay a price proportional to the square of foo/2
constraints.
In other words, can we expect the usual good indexing behavior that we have in prolog also in CHR rules?