nafc doesn't work with more complex goals
Description
Environment
core.logic 0.8.10, clojure 1.7.0
Activity

Tassilo Horn July 31, 2015 at 7:40 PM
My interpretation of the docstring is that the check will be delayed until the point in time where the variables become ground. And eventually q
is ground in my first example. I mean, otherwise nafc
would be pretty useless.

Nicolás Berger July 31, 2015 at 5:01 PM
This is not a bug. It's expected behavior because not all arguments to the nafc goal are ground.
From `nafc` docstring:
EXPERIMENTAL: negation as failure constraint. All arguments to the goal c must be ground. If some argument is not ground the execution of this constraint will be delayed.
In the example using fd, q is not ground (because a and b are not ground), so it's almost the same as if the nafc wasn't there.

Tassilo Horn July 31, 2015 at 8:40 AM
It seems that this problem could be specific to clojure.core.logic.fd
. At least this example works:
Details
Assignee
David NolenDavid NolenReporter
Tassilo HornTassilo HornPriority
Major
Details
Details
Assignee
Reporter

Priority

The negation as failure constraint
nafc
is supposed to succeed if and only if the goal provided by a relation and its args fails. The test cases just cover very simple cases like(nafc == q 'b)
which is essentially equivalent to(!= q 'b)
(at least to my understanding). But with a slightly more complex case, it doesn't seem to work anymore.Example:
The constraint specifies that the number 2 must NOT be contained in the list
q
but still it is. I expected to get the single answer(1 3)
here.