2

This is a contradiction:

(run* [q]
  (== q true)
  (== q false)) 

-> ()

Because there can't be a q that is true and false at the same time.

Shouldn't this be a contradiction as well?

(run* [q]
  (featurec q {:k true})
  (featurec q {:k false}))  

-> ((_0 :- (clojure.core.logic/featurec _0 {:k true})
           (clojure.core.logic/featurec _0 {:k false})))

I don't know what that :- mean. But since map keys are unique, I suppose there cannot be a map that can have :k to be true as well as false. How can I make sure the second goal doesn't match?

Another Example

(run* [q]
  (fresh [x]
    (featurec x {:k false})     
    (== q true)
    (featurec x {:k q}))) -> (true)

I am interpreting this as:

  • x is a map-like with :k as false.
  • q is true.
  • q is the value of :k of x

What am I trying to do exactly?

I am trying to use featurec to create goals like:

(defn is-a-foo [x v]
  (featurec x {:foo v}))

(defn is-a-bar [x v]
  (featurec x {:bar v}))

Then I'd like to be able to say:

(defn foo-implies-bar [x]
  (conde [(is-a-foo [x true]) (is-a-bar [x true])])
muhuk
  • 15,777
  • 9
  • 59
  • 98
  • A. Webb: I missed the second term there, lighttable hides by default. I suppose I better close this one since there is actually a contradiction here. – muhuk Feb 03 '14 at 03:46
  • 1
    I think it is still a good question. – A. Webb Feb 03 '14 at 03:49

0 Answers0