Welcome! Please see the About page for a little more info on how this works.

0 votes
in core.logic by
Given the following code


(run* [x11 x12 x13
       x21 x22     x24
       x31     x33 x34
           x42 x43 x44]
      (fd/in x11 x12 x13 x21 x22 x24 x31 x33 x34 x42 x43 x44 (fd/interval 1 9))
      (fd/eq (= (+ x11 (/ x12 x13))   5)
             (= (+ x21 (/ x22   2)) x24)
             (= (+ x31 (/   6 x33)) x34)
             (= (+   4 (/ x42 x43)) x44)
             (= (+ x11 (/ x21 x31))   4)
             (= (* x12 (/ x22   6)) x42)
             (= (+ x13 (-   2 x33)) x43)
             (= (+ (-  5 x24) x34)  x44)))


I have {{([1 4 1 3 6 6 1 1 7 4 2 6] [2 6 2 4 6 7 2 1 8 6 3 6])}} as a result.

However, as soon as I change {{(fd/interval 1 9)}} to {{(fd/interval 0 9)}}, the result becomes an empty sequence. However, I expect it to include at least the two aforementioned solutions.

5 Answers

0 votes
by

Comment made by: dnolen

It would help if you could confirm that the issue is present without using {{fd/eq}} - which is just macro sugar. Writing out the long form is tedious but it will help isolate the issue. Thanks.

0 votes
by

Comment made by: dnnx

I actually suspect that the bug is in fd/eq. Here is a smaller test case:

`
(run* [q]

  (fd/in q (fd/interval 1 2))
  (fd/eq (= (/ q q) 1)))

`

It returns (1 2) as expected, but as soon as I change fd/interval to 0 2, it returns an empty seq.

0 votes
by

Comment made by: dnolen

Thanks for the minimal case, yeah looks like an issue with {{fd/eq}} as it works fine if you write it out long hand.

0 votes
by

Comment made by: dnolen

See also LOGIC-156

0 votes
by
Reference: https://clojure.atlassian.net/browse/LOGIC-162 (reported by alex+import)
...