<< Back to previous view

[LOGIC-106] cannot use fresh/conde in the invoke of a constraint Created: 20/Jan/13  Updated: 28/Jul/13  Resolved: 21/Jan/13

Status: Closed
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


This means that we cannot really emulate modes with constraints. The problem is related to -inc.

An easy way to try it out is to have a dummy fresh goal in predc and see the failing tests.

@@ -2932,7 +2932,7 @@
        (invoke [this a]
          (let [x (walk a x)]
            (when (p x)
-             ((remcg this) a))))
+             (bind* a (fresh [y] (== x x)) (remcg this)))))
        (rator [_] (if (seq? pform)
                     `(predc ~pform)

Comment by David Nolen [ 20/Jan/13 7:55 PM ]

Sorry I didn't mean to suggest this approach. In general you cannot put search related operators into a constraint. In fact I think we should replace any instances of bind* and bind in constraint logic as they really are a part of the search infrastructure and I'd like them to become implementation details of a particular search approach.

Instead I meant to suggest that the disjunction expressed by your example

(run 1 [re]
  (forall [s o]
      [(== s '(foo bar bar bar))
       (== o regex-BLANK)]
      [(!= s '(foo bar bar bar))
       (== o regex-NULL)])
    (regex-matcho re s o)))

Is perhaps best described as an explicit constraint something more like:

(defn regexc [s o]
    (invoke [c a]
      (let [s (walk* a)[
        (if (= s '(foo bar bar bar))
          ((== o regex-BLANK) a)
          ((== o regex-NULL) a)))))
    (runnable? [c a]
      (ground-terms? x))

Of course someone might want to write constraint like this quite often, then I think it's question of what the best way to support that might be.

Comment by David Nolen [ 21/Jan/13 11:56 AM ]

No plans to add support for search operators in constraints in the near future.

Generated at Thu Jan 18 08:27:27 CST 2018 using JIRA 4.4#649-r158309.