gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 15:54:01 24 4
gpt4 key购买 nike

这个问题在这里已经有了答案:





Are HiLog terms still useful in modern Prolog?

(2 个回答)


11 个月前关闭。




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/3 , maplist可以很容易地在其中实现:
maplist(_, [], []).
maplist(P, [X|Xs], [Y|Ys]) :- call(P, X, Y), maplist(P, Xs, Ys).
HiLog 是否主要具有历史意义,或者它的“高阶”逻辑是否比 Prolog 现在可用的更通用?

最佳答案

来自维基

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, programmersneed not avoid using call/l, and thus have more flexibility in theirtask 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.

关于prolog - HiLog 是否添加了 Prolog 中 "call"无法完成的任何内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64830763/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com