logic-and-learning-lab / Popper

An inductive logic programming system
MIT License
206 stars 36 forks source link

Add fix for queries containing compound functors. #57

Closed AbhijeetKrishnan closed 1 year ago

AbhijeetKrishnan commented 1 year ago

When query results contain compound functors (e.g. a(b(1), c(1))) pyswip returns them as a quoted string. a(b(1), c(1)) gets returned as a('b(1)', 'c(1)'). This leads to the contained functors being treated as single atoms and not as functors themselves, leading to unexpected behaviour.

A MWE (examples/compound-functor) has also been included to showcase this behaviour. The expected solution f(A):-valid(A) cannot be found since the pyswip query results contain strings, which leads to the examples failing when tested. Popper successfully finds the expected solution after introducing the (admittedly hacky) fix in this commit.

andrewcropper commented 1 year ago

Thank you @AbhijeetKrishnan !