加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

prolog – 如何理解ASP中的否定失败?

发布时间:2020-12-16 03:35:46 所属栏目:asp.Net 来源:网络整理
导读:假设我们有以下程序: human(socrates).day(tomorrow).die(X) :- human(X).may_go_to_school(Y) :- day(Y),not holiday(Y). 如果我们运行clingo来获取程序的答案集,我们就会得到 Answer: 1human(socrates) day(tomorrow) die(socrates) may_go_to_school(tom
假设我们有以下程序:

human(socrates).
day(tomorrow).
die(X) :- human(X).
may_go_to_school(Y) :- day(Y),not holiday(Y).

如果我们运行clingo来获取程序的答案集,我们就会得到

Answer: 1
human(socrates) day(tomorrow) die(socrates) may_go_to_school(tomorrow)

我们知道地滚球将首先将所有变量实例化为常数,因此接地后的程序将是:

human(socrates).
day(tomorrow).
die(socrates) :- human(socrates).
may_go_to_school(tomorrow) :- day(tomorrow),not holiday(tomorrow).

我在book from Gelfond读到它给出了3条规则来获取答案集:

  1. Satisfy the rules of Π. In other words,believe in the head of a rule if you believe in its body.

  2. Do not believe in contradictions.

  3. Adhere to the “Rationality Principle” which says: “Believe nothing you are not forced to believe.”

在规则中:

may_go_to_school(tomorrow) :- day(tomorrow),not holiday(tomorrow).

我们得到了一个否定,因为失败不是假期(明天)

如本书所示:

Symbol not is a new logical connective called default negation,(or negation as failure); not l is often read as “it is not believed that l is true.” Note that this does not imply that l is believed to be false. It is conceivable,in fact quite normal,for a rational reasoner to believe neither statement p nor its negation,?p.

然后根据规则1,如果你相信它的身体,相信一个规则的头,我是否应该相信身体不是假期(明天).既然我不相信任何假期(明天).也不是明天(明天).

根据答案,我应该相信?holiday(明天).

>那么为什么我们需要这种否定作为失败?
>我们可以使用经典否定吗?

解决方法

Can we just use classical negation?

好吧,我们似乎不能.问题是我们无法实现逻辑否定.主要思想是Prolog为您的程序理论生成一个模型(Herbrand模型).当我们添加否定时,程序的语义会发生变化,因此Prolog可能无法使用sld分辨率找到模型.因此,作为失败的否定具有以下优点:我们可以得到否定(不完全是逻辑否定),并且仍然没有像经典否定那样存在程序语义问题.

你可以看看我的相关问题:Logical Negation in Prolog.这个问题与这个问题并没有完全相同,但@ j4n bur53在他的回答中描述了为什么我们不能有逻辑否定.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读