Implementation of arithemtic invariants.
This is similar to the normal arithmetic is/2 predicate, but evaluates the expression based on the tentative values of its variables. The result is delivered as (an update to) the tentative value of the Result variable. Once initiated, tent_is will stay active and keep updating Result's tentative value eagerly whenever the tentative value of any variable in Expression changes.
?- [X, Y] tent_set [3, 4], Z tent_is X + Y. X = X{3 -> 0} Y = Y{4 -> 0} Z = Z{7 -> 0} Yes (0.00s cpu) ?- [X, Y] tent_set [3, 4], Z tent_is X + Y, X tent_set 7. X = X{7 -> 0} Y = Y{4 -> 0} Z = Z{11 -> 0} Yes (0.00s cpu)