【24h】

Regular corecursion in Prolog

机译:Prolog中的常规corecursion

获取原文
获取原文并翻译 | 示例
       

摘要

Corecursion is the ability of defining a function that produces some infinite data in terms of the function and the data itself, as supported by lazy evaluation. However, in languages such as Haskell strict operations fail to terminate even on infinite regular data, that is, cyclic data. Regular corecursion is naturally supported by coinductive Prolog, an extension where predicates can be interpreted either inductively or coinductively, that has proved to be useful for formal verification, static analysis and symbolic evaluation of programs. In this -paper we use the meta-programming facilities offered by Prolog to propose extensions to coinductive Prolog aiming to make regular corecursion more expressive and easier to program with. First, we propose a new interpreter to solve the problem of non-terminating failure as experienced with the standard semantics of coinduction (as supported, for instance, in SWI-Prolog). Another problem with the standard semantics is that predicates expressed in terms of existential quantification over a regular term cannot directly defined by coinduction; to this aim, we introduce finally clauses, to allow more flexibility in coinductive definitions. Then we investigate the possibility of annotating arguments of coinductive predicates, to restrict coinductive definitions to a subset of the arguments; this allows more efficient definitions, and further enhance the expressive power of coinductive Prolog. We investigate the effectiveness of such features by showing different example programs manipulating several kinds of cyclic values, ranging from automata and context free grammars to graphs and repeating decimals; the examples show how computations on cyclic values can be expressed with concise and relatively simple programs. The semantics defined by these vanilla meta-interpreters are an interesting starting point for a more mature design and implementation of coinductive Prolog.
机译:Corecursion是定义功能的能力,该功能可根据懒惰求值功能在函数和数据本身方面生成一些无限数据。但是,在诸如Haskell之类的语言中,即使对无限的常规数据(即循环数据),严格的操作也无法终止。规则共归自然是由共归Prolog支持的,共归Prolog是谓词的一种扩展,可以对谓词进行归纳或共归解释,这已证明对程序的形式验证,静态分析和符号评估有用。在本文中,我们使用Prolog提供的元编程功能来建议对共性Prolog进行扩展,以使常规corecursion更具表达性并易于编程。首先,我们提出了一种新的解释器,以解决共归标准语义(例如,在SWI-Prolog中受支持)所经历的非终止失败的问题。标准语义的另一个问题是,不能通过共归来直接定义以谓词上的存在量化表示的谓词。为此,我们引入了finally子句,以便在共归定义中提供更大的灵活性。然后,我们研究了对共形谓词的自变量进行注释的可能性,以将共形定义限制于自变量的子集。这样可以进行更有效的定义,并进一步增强共存Prolog的表达能力。我们通过展示操纵多种循环值的不同示例程序(从自动机和上下文无关的语法到图形以及重复小数)来研究此类功能的有效性。这些示例说明了如何使用简洁而相对简单的程序来表示循环值的计算。这些原始元解释器定义的语义是更有意义的设计和实现共归Prolog的有趣起点。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号