ML-KULeuven / problog

ProbLog is a Probabilistic Logic Programming Language for logic programs with probabilities.
https://dtai.cs.kuleuven.be/problog/
297 stars 34 forks source link

numbervars/2 is not working #95

Open rmanhaeve opened 1 year ago

rmanhaeve commented 1 year ago

Produces a UnifyError

To reproduce:

query(numbervars(a(X))).
VincentDerk commented 1 year ago

I get the following error on your example:

UnknownClause: No clauses found for 'numbervars/1' at 1:7.

, which seems expected to me.

You probably mean to use numbervars/2 or numbervars/3 (libraries).

rmanhaeve commented 1 year ago

Sorry, the example that breaks it is

query(numbervars(a(X),0)).
VincentDerk commented 1 year ago

Ah yes.

Normal usage: query(numbervars(a(X),Y)). Output: numbervars(a(X1),a($Var(0)))

What happens is engine_builtin.py::_built_in_numbervars() fails when calling unify_value. Because engine_unify.py::unify_value() raises the UnifyError. I am not familiar with numbervars so I'm not sure what the desired behavior is. Might need a try-catch there.