Putting this in a new thread to make it easier to find, but please see below for a new bug in the ‘implies’ (->) operator.
Bug in ~ operator (from other thread)
Bug in → operator?
25 ?- { (A == 1) -> (B == 2, C == 3) }.
false. % I would not expect this
26 ?- { (A == 1) -> (B == 2), (A == 1) -> (C == 3) }.
false. % I would not expect this
27 ?- { (A == 1) -> (B == 2) }, { (A == 1) -> (C == 3) } .
A::real(-1.0Inf, 1.0Inf), % Works fine
B::real(-1.0Inf, 1.0Inf),
C::real(-1.0Inf, 1.0Inf).
29 ?- { (A == 1) -> (B == 2) }, { (A == 1) -> (C == 3) }, A=1, solve([B,C]).
A = 1, % Good, this is just testing the above with solve(...)
B = 2,
C = 3.
I wouldn’t consider these bugs, but there is room for improvement. The first example (25) fails because currently “,” is only treated as a separator in top level constraint lists. In this particular case (embedded expression) you have to use and instead:
?- { (A == 1) -> (B == 2) and (C == 3) }.
A::real(-1.0Inf, 1.0Inf),
B::real(-1.0Inf, 1.0Inf),
C::real(-1.0Inf, 1.0Inf).
A reasonable enhancement would be to support “,” as a synonym for “and” in nested expressions.
The second (26) fails because it’s not recognized as a valid constraint due to the relative operator precedence of “->” and “,”. Instead:
I tend to agree although “and” and “,” have different operator priorities and associativity. But it seems safe enough so I’ll try it for a while to see if anything trips up.