为什么以下 Datalog 程序是等效的?

发布于 2024-10-08 06:43:16 字数 226 浏览 0 评论 0原文

对于某些存在谓词 a,b 为什么 this:

q(X,Y) <-- a(X,Y), q(Z,Y)
q(X,Y) <-- b(X,Y)

等价于 this:

q(X,Y) <-- a(X,Y), b(Z,Y)
q(X,Y) <-- b(X,Y)

? 为什么顶层递归不能继续扩展呢?

For some existentional predicates a,b why is this:

q(X,Y) <-- a(X,Y), q(Z,Y)
q(X,Y) <-- b(X,Y)

equivalent to this:

q(X,Y) <-- a(X,Y), b(Z,Y)
q(X,Y) <-- b(X,Y)

?
Why can't the top recursion just continue to expand?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

救赎№ 2024-10-15 06:43:16

如果将第一个子句展开一次,您将得到 a(X,Y), a(Z,Y), b(Z′,Y)。由于 Z 是自由的,a(Z,Y)Y 上的一个简单存在量词,它已由第一个子句断言,因此表达式折叠为 a(X,Y), b(Z′,Y),这当然相当于 a(X,Y), b(Z,Y)< /code>,因为 Z′ 也是一个自由变量。

If you expand the first clause once, you get a(X,Y), a(Z,Y), b(Z′,Y). Since Z is free, a(Z,Y) is a simple existential quantifier on Y, which has already been asserted by the first clause, so the expression collapses to a(X,Y), b(Z′,Y), which is of course equivalent to a(X,Y), b(Z,Y), since Z′ is also a free variable.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文