HiLog 是否添加了 Prolog 中 "call" 无法完成的内容?

Does HiLog add anything that can not be done with "call" in Prolog?

The Wikipedia article for Prolog 状态:

Higher-order programming style in Prolog was pioneered in HiLog and λProlog.

HiLog 的动机包括其实现高阶谓词的能力,如 maplist:

maplist(F)([],[]).
maplist(F)([X|Xs],[Y|Ys]) <- F(X,Y), maplist(F)(Xs,Ys).

描述HiLog的论文假设Prolog只有call/1,没有call/3

然而,由于 Prolog(现在)有 call/3maplist 可以很容易地在其中实现:

maplist(_, [], []).
maplist(P, [X|Xs], [Y|Ys]) :- call(P, X, Y), maplist(P, Xs, Ys).

HiLog 是否主要具有历史意义,或者它的“高阶”逻辑是否比现在 Prolog 中可用的逻辑更通用?

有点模糊:

HiLog 不在 Prolog 中(Prolog 保留 Prolog)但在 Flora, which is basically an logic-based object-oriented database. It has its own syntax and runs on XSB Prolog 中使用。

如果我理解正确的话,HiLog 的想法是通过在谓词名称位置允许变量来为“高阶”谓词定义实用语法。这是两个 maplist 示例之间的区别。

这看起来好像是二阶逻辑(变为 uncomputable/untractable 因为无法找出谓词 F 是否与谓词 G 相关一般来说,因为您可能被迫比较它们的范围,它们成功的所有点)但是通过限制句法相等性(FG 被压平到一阶(可计算)如果名称相同谓词相同,foo/2),此时可以部署 call/N 以生成 Prolog 代码。

所以,是的,目前你必须跳过箍才能在 Prolog 中表达语句,这可能是 HiLog 中的一行(虽然我没有例子,但对此没有太深入)。这是C和...呃... Prolog的区别!

类似于 extensions/modifications 将 Prolog 转化为各种 X-log 的许多其他想法,但并非所有这些都已实现(我曾经尝试制作一个概览图 here),“ HiLog syntax”(或类似的东西)可能会在未来突破其利基市场的专门 X-log 中找到。

来自维基

Although syntactically HiLog strictly extends first order logic, HiLog can be embedded into this logic.

任何 HiLog 术语都可以翻译成 Prolog 术语 (HiLog: A foundation for higher-order logic programming - Weidong Chen, Michael Kifer, David S.Warren - 1993)。所以在某种意义上是的,它并不比Prolog更通用。

让我引用论文中的一些结论

Firstly, programming in HiLog makes more logic programs logical. We all admonish Prolog programmers to make their programs as pure as possible and to eschew the evils of Prolog’s nonlogical constructs. In Prolog, the intermixing of predicate and function symbols, in particular in the predicate, call/ 1, is nonlogical, whereas in HiLog, it is completely logical and is a first-class citizen. So in HiLog, programmers need not avoid using call/l, and thus have more flexibility in their task of writing pure logic programs.

Secondly, even though one might say that HiLog is simply a syntactic variant of Prolog, syntax is important when one is doing meta-programming. Since in meta-programming the syntax determines the data structures to be manipulated, a simpler syntax means that meta-programs can be much simpler.

因为我在评论中回答了我自己的问题,所以我会post在这里:

有些事情您可以在 HiLog 中完成,而在 Prolog 中 call 无法完成,例如:

类似查询:

?- X(dog, 55, Y).

断言如:

foo(X, Y) :- Z(X), Z(Y(X)).

如上述 HiLog 论文和 HiLog 维基百科页面所述,Prolog 可以模拟 HiLog。但是,这需要将整个程序和所有查询转换为一个谓词。