表示共享可以通过在重复项之间共享一个表示来减少程序的内存占用。函数式编程系统中最常见的表示共享实现称为散列consing。在Prolog的上下文中,表示共享很少受到关注。一些当前的技术,处理表示共享的审查。新的贡献是:(1)用于{ \em findall/3}的{\em输入共享}的简单实现;(2)在运行时引入表示共享的{ \em sharer}模块的描述。它们的实现在由hProlog实现的WAM的上下文中示出。两者都可以适用于任何WAM类Prolog实现。共享器独立于垃圾收集器工作,但可以使其与垃圾收集器协作。基准测试结果表明,共享器的成本与堆垃圾收集器相当,其有效性高度依赖于应用程序,并且其策略必须根据收集器进行调整。逻辑程序设计理论与实践(Theory and Practice of Logic Programming,TPLP)
英文摘要:
Representation sharing can reduce the memory footprint of a program by sharing one representation between duplicate terms. The most common implementation of representation sharing in functional programming systems is known as hash-consing. In the context of Prolog, representation sharing has been given little attention. Some current techniques that deal with representation sharing are reviewed. The new contributions are: (1) an easy implementation of {\em input sharing} for {\em findall/3}; (2) a description of a {\em sharer} module that introduces representation sharing at runtime. Their realization is shown in the context of the WAM as implemented by hProlog. Both can be adapted to any WAM-like Prolog implementation. The sharer works independently of the garbage collector, but it can be made to cooperate with the garbage collector. Benchmark results show that the sharer has a cost comparable to the heap garbage collector, that its effectiveness is highly application dependent, and that its policy must be tuned to the collector. To appear in Theory and Practice of Logic Programming (TPLP)
University of Paris 1(巴黎第一大学);Universidade de Évora(埃武拉大学);CENTRIA FCT/UNL(新里斯本大学科学技术中心);JFLI CNRS(法国国家科学研究中心日本-法国联合实验室);University of Tokyo(东京大学)
GNU Prolog是Prolog语言的通用实现,它与大多数其他系统的区别在于,首先是一个本机代码编译器,它产生独立的可执行文件,不依赖于任何字节码仿真器或元解释器。其他突出的方面包括Prolog系统作为多遍编译器的显式组织,其中中间表示被物化,在Unix编译器传统中。GNU Prolog还包括一个可扩展的高性能有限域约束求解器,它与Prolog语言集成,但使用独立的低级机制实现。本文讨论了设计和实现GNU Prolog所涉及的主要问题:需求、系统组织、性能和可移植性问题,以及它相对于其他Prolog系统实现和ISO标准化倡议的地位。
Tabling, Rational Terms, and Coinduction Finally Together!
逻辑程序设计理论与实践(Theory and Practice of Logic Programming,TPLP)列表是逻辑编程中常用的技术,用于避免逻辑程序的循环行为并实现更多的声明性程序定义。此外,制表通常可以提高计算性能。有理项是指具有一个或多个无穷子项但具有有限表示的项。在Prolog中,当统一两个术语时,可以通过省略发生检查来生成有理术语。有理项的应用包括确定子句文法、约束处理系统和共归纳。在本文中,我们报告我们的扩展YAP的Prolog制表机制,以支持合理的条款。我们描述了表空间中有理项的内部表示,并证明了它的正确性。然后,我们使用这个扩展来实现一个基于表格的方法coinduction。我们比较我们的方法与当前的共归纳变换,并描述了实现。此外,我们提出了一个算法,确保一个规范的表示为合理的条款。