Suppose in a state, state1
, I have a list of constraints in the constraint store:
state1 = [p(a,1), p(b,0), p(a,0), p(b,1), p(b,0)]
Now I have a constraint c(b,1)
which states that all p(b,0)
should be replaced by p(b,1)
. Thus we should obtain a new state state2
such that:
state2 = [p(a,1), p(b,1), p(a,0), p(b,1), p(b,1)]
How can this be done for any constraint of the form c(X, Y), and any list of constraints of the form p(X, Y)?
This can probably be done with just 2 or 3 lines in CHR, but I do not know how to do this. Thanks in advance.