MiniKanren 有 "not" 运算符吗?
Does MiniKanren have the "not" operator?
迷你看人有"not"运算符吗?
例如,如何表示 Prolog 的
a :- b, not(c)
如果 b
为真而 c
不为真,则 a
为真(Prolog 使用否定作为失败,即 not(c)
如果 c
无法证明,则视为已证明)
Prolog 的 not
也适用于非基础表达式,例如
a(X, d(Y)) :- b(d(X), d(Y)), not(c(d(X)))
根据https://github.com/zhjhxxxjh/ykanren,答案是否定的。
minikanren中没有not
运算符,但是你可以用conda
实现类似的东西:
(defmacro not
"fail if the given goal succeeds, use with extreme caution"
[goal]
`(conda
[~goal fail]
[succeed]))
迷你看人有"not"运算符吗?
例如,如何表示 Prolog 的
a :- b, not(c)
如果 b
为真而 c
不为真,则 a
为真(Prolog 使用否定作为失败,即 not(c)
如果 c
无法证明,则视为已证明)
Prolog 的 not
也适用于非基础表达式,例如
a(X, d(Y)) :- b(d(X), d(Y)), not(c(d(X)))
根据https://github.com/zhjhxxxjh/ykanren,答案是否定的。
minikanren中没有not
运算符,但是你可以用conda
实现类似的东西:
(defmacro not
"fail if the given goal succeeds, use with extreme caution"
[goal]
`(conda
[~goal fail]
[succeed]))