开发者

What does \+ mean in Prolog?

I've seen some answers here that u开发者_如何学Pythonse it and I don't know what it means or how to use it. I's also hard to look for it via a search engine :)


It's the 'not provable' operator. It succeeds if its argument is not provable (and fails if its argument is provable).


It's do with negation. \+ Goal will succeed if Goal cannot be proven.


The way I memorize it is through the following logical rule:

  • \+ = 'if unsure or false, assume false'

This is different from standard boolean logic in that if your goal is uncertain instead of outright true or false, it assumes false when it can't prove true. The most obvious example of this is being unable to see whether a stream is still open or not. If you can't prove it is open, it's the same as being closed to the program.

https://en.wikipedia.org/wiki/Negation_as_failure

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜