5

MiniKanren 有“not”运算符吗?

例如,如何表示 Prolog 的

a :- b, not(c)

a如果b为真c且不为真则为真(Prolog 使用否定作为失败, not(c)如果c无法证明则认为已证明)

Prolognot也适用于非地面表达式,例如

a(X, d(Y)) :- b(d(X), d(Y)), not(c(d(X)))
4

2 回答 2

4

根据https://github.com/zhjhxxxjh/ykanren,答案是否定的。

于 2017-08-12T21:00:48.923 回答
3

minikanren中没有not运算符,但您可以通过以下方式实现类似的操作conda

(defmacro not
  "fail if the given goal succeeds, use with extreme caution"
  [goal]
  `(conda 
     [~goal fail]
     [succeed]))

在 Google 网上论坛上查看我的类似问题

于 2017-08-13T04:11:27.070 回答