Closed EdGaere closed 2 years ago
This does not seem te be a bug. The problem originates from 1) Casting to integer is done using the integer/1 functor, not intgr 2) The reason that ProbLog doesn't complain is that you're using @=< instead of =<. The former is a struct comparison. So in the first case you're performing a structured comparison. a(X) @=< a(99) which is true since variables are considered smaller than numbers w.r.t. the standard order of terms, and in the second case a(a(X)) @=< a(99) which is considered false, since a compound term is considered larger than a number.
`lte_99(X) :- integer(X) =< integer(99) .
query(lte_99(100)) .` Results in the desired behaviour.
Hi Robin - Thank so much for the explanations, indeed this solves my problem. Sorry for having reported this as a bug.
As a suggestion, perhaps provide basic arithmetic examples on the web page / getting started ? problog is so powerful, yet so confusing for newbies.
integer(X) =< integer(99) .
Thanks again Edward
Hi Edward
Thanks for your suggestion, I've added it to our list of future work.
May have found a bug, casting to an integer is inconsitent and error prone. Consider this simple example:
Let's create a trivial function that evaluates if X <= 99
Now we call our function with value 100
Output
Workaround is wordy... but works.
Workaround output
Conclusion: Explicit casting to intgr should not be necessary as it's performed in _lte99
problog==2.2.2 Python 3.8.3