packages-chr
packages-chr copied to clipboard
Unexpected rule fired.
Hi,
For the following program
%% test.pl
:- use_module(library(chr)).
:- chr_constraint c/2.
c(K,_I), c(K,_J) <=> writeln('rule 1 fired').
c(_I,K), c(_J,K) <=> writeln('rule 2 fired').
?- consult(["test.pl"]).
true.
?- c(X,Y).
rule 2 fired
c($VAR(X),$VAR(Y)).
Although the 2nd rule has two heads and I only added one constraint (c(X,Y))
, the rule still fired.
This issue can be reproduced in Stable release - SWI-Prolog 8.4.1-1 for Microsoft Windows (64 bit), and Daily builds - swipl-w64-2022-01-31.exe (version 8.5.6-26-gee0b3fea1).
N.B. swish has no the same problem, but the constraint are not preserved, see https://swish.swi-prolog.org/p/unexpected_rule_fired.pl
Thanks.