Does MiniKanren have the "not" operator?
For example, how would one represent Prolog's
a :- b, not(c)
a
is true if b
is true and c
is not (Prolog uses negation as failure, i.e. not(c)
is considered proven if c
can not be proven)
Prolog's not
also works with non-ground expressions, e.g.
a(X, d(Y)) :- b(d(X), d(Y)), not(c(d(X)))
probabilistic logic programming, nominal logic programming, and tabling.
miniKanren performs an interleaved search which will eventually find any solution that exists, even if any one branch of the search tree is infinitely long and contains no solutions. If no solution exists, miniKanren may search forever if the search tree is infinite.
According to https://github.com/zhjhxxxjh/ykanren the answer is no.
There is no not
operator in minikanren, but you can achieve something similar with conda
:
(defmacro not
"fail if the given goal succeeds, use with extreme caution"
[goal]
`(conda
[~goal fail]
[succeed]))
See my similar question on Google Groups
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With