Closed liu-cs closed 2 years ago
Hi Changsong
This is related to the whether the variables are grounded when you compare the check.
Since Y is not ground when comparing to X, the comparison \== is true, as it is just a check that they are not identical, which they are not. The unifcation only happens afterwards. Replace the \== by \= (meaning X and Y are not unifiable).
Try this code in the editor for comparison (link):
a :- 1 \== Y, Y=1.
b :- 1 \= Y, Y=1.
c :- Y=1, 1 \== Y.
d :- Y=1, 1 \= Y.
query(a).
query(b).
query(c).
query(d).
Hope this helps!
Thanks, Robin. The explanation and example are very clear. Our problog based geometry solver now works well :-)
Hi, I am trying to use Problog to build an automatic geometry problem solver. I encountered an unexpected query result for the following simple KB:
and the result is:
I couldn't understand how the
is_parallel_to(line2,line2): 1
gets into the result as we haveX \== Y,
in the bodies of both rules. Can anyone please help to take a look and point out where it goes wrong? Thanks!-Changsong