EQ conditions which match against a negative result fail to find any results.

Description

I was trying to follow the example provided by [this blog post](https://mattsenior.com/2014/02/using-clojures-core-logic-to-solve-simple-number-puzzles) and found that it only worked if I removed the conditions that test for subtraction with a negative result. I removed a lot of different things and found that even this basic example does not find any matches:

```
(ns example.core
(:refer-clojure :exclude [==])
(:require [clojure.core.logic :refer :all])
(:require [clojure.core.logic.fd :as fd]))

(run* [q]
(fresh [a0 a1]
(== q [a0 a1])
(fd/in a0 a1 (fd/interval 1 9))
(fd/- a0 a1 -1)
;(fd/eq
; (= (- a0 a1) -1))
))
```

Dependencies (though I tried clojure 1.8 and 1.9 too):
```
:dependencies [[org.clojure/clojure "1.7.0"]
[org.clojure/core.logic "0.8.11"]]
```

Environment

OS: Mac OSX
JVM:
java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

Activity

Show:
Stephen Hopper
November 4, 2018, 8:43 PM

I've narrowed this down a bit more. This code works fine on core.logic "0.8.7" and "0.8.8" but is broken in "0.8.9" and beyond.

import
November 8, 2018, 11:59 PM

Comment made by: joinr

Up to commit 36d4e03055c57094e09aa81e2bc37883de1dfbde, this works as advertised

Looks like https://github.com/clojure/core.logic/commit/719c23f80280762ff20216a579d88efa32da2de7
introduced a regression (although it may have solved other problems).

Suggest adding the above as a simple regression test (after revisiting reasons for LOGIC-161 bugfix). I'm lost in the fd code at the moment, aside from seeing the changes to domain/interval creation that the regression introduced. I tried munging the negative value a number of ways, never could get a result.

Assignee

David Nolen

Reporter

Stephen Hopper

Labels

Approval

None

Patch

None

Priority

Major
Configure