[LOGIC-98] nominal unification misses after-the-fact fd constraints Created: 05/Jan/13 Updated: 11/Jan/13 Resolved: 11/Jan/13 |
|
| Status: | Resolved |
| Project: | core.logic |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Nada Amin | Assignee: | David Nolen |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Related to http://dev.clojure.org/jira/browse/LOGIC-92, these two snippets both return (nom/tie 'a_0 1) instead of three results for 1, 2, 3. (run* [q]
(nom/fresh [a b c]
(fresh [x y]
(== (nom/tie b (nom/tie a x)) (nom/tie c q))
(infd x (interval 1 3)))))
(run* [q]
(nom/fresh [a b c]
(fresh [x y]
(infd y (interval 1 3))
(== (nom/tie b (nom/tie a x)) (nom/tie c q))
(== x y))))
|
| Comments |
| Comment by Nada Amin [ 08/Jan/13 4:24 AM ] |
|
logic-98.diff fixes this by forcing all nom-related vars at once. Do you have any ideas for separating the concern, so that force-ans doesn't need to know about ::nom? |
| Comment by David Nolen [ 08/Jan/13 6:32 AM ] |
|
Will need to think about this some more. |
| Comment by Nada Amin [ 08/Jan/13 2:33 PM ] |
|
Ouch! Here is a snippet that doesn't do the right thing, even with the patch: (run* [q]
(nom/fresh [a b c d]
(fresh [x y z]
(== (nom/tie b (nom/tie a x)) (nom/tie c z))
(infd x (interval 1 3))
(== (nom/tie d q) z))))
It returns only (1) instead of (1 2 3). |
| Comment by Nada Amin [ 11/Jan/13 10:07 AM ] |
|
logic-98-nominal.diff is a solution that works for all three test cases above by simply making core.logic.nominal aware of ::fd and updating the doms when appropriate. |
| Comment by David Nolen [ 11/Jan/13 10:49 AM ] |
|
fixed, http://github.com/clojure/core.logic/commit/ef27fa3ed2381f3ad4685d4bc59a298646a4febb It would be nice if nominal didn't need to know about fd, as there will be other "enumerable" domains in the future. But this works great for now. |