arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1507.06944cs.LOcs.PL
收藏

Lambda项、组合子、类型和基于树的算术计算的逻辑编程游戏场

A Logic Programming Playground for Lambda Terms, Combinators, Types and Tree-based Arithmetic Computations

Paul Tarau

摘要:

有了健全的统一,确定性子句语法和紧凑的组合生成算法的表达,逻辑编程方便地主机的声明性游乐场,有趣的属性和行为出现从异构的,但深连接的计算对象的相互作用。给出了几类lambda项的紧致组合生成算法,包括开项、闭项、单型项和线性项,以及类型推断和正规阶约简算法。我们描述了一个基于Prolog的组合lambda术语生成器和类型推断器,用于给定大小的封闭良好类型的术语,在de Bruijn符号。我们介绍了一个压缩的德布鲁因表示的lambda条款,并定义其双射的标准表示。我们的压缩条款便于推导的大小比例的排名和排名算法的lambda条款和推断的简单类型。S和K组合子表达式形成了λ演算的一个著名的图灵完备子集。我们指定的评估,类型推断和组合生成算法的SK-组合子树。在这个过程中,我们解开的属性,其结构和分布的有趣方面提供了新的光。一个统一的表示,作为二叉树与空叶,给出了表达式建立与罗瑟的X-组合子,自然数,lambda条款和简单的类型。利用这种共享表示,描述了基于树的自然数的lambda项的排序/反排序算法。我们的算法,表示为一个渐进式开发的文学Prolog程序,实现了一个声明性的游乐场,用于探索表示,编码和计算,统一表示的lambda术语,类型,组合子和基于树的算术。

英文摘要:

With sound unification, Definite Clause Grammars and compact expression of combinatorial generation algorithms, logic programming is shown to conveniently host a declarative playground where interesting properties and behaviors emerge from the interaction of heterogenous but deeply connected computational objects. Compact combinatorial generation algorithms are given for several families of lambda terms, including open, closed, simply typed and linear terms as well as type inference and normal order reduction algorithms. We describe a Prolog-based combined lambda term generator and type-inferrer for closed well-typed terms of a given size, in de Bruijn notation. We introduce a compressed de Bruijn representation of lambda terms and define its bijections to standard representations. Our compressed terms facilitate derivation of size-proportionate ranking and unranking algorithms of lambda terms and their inferred simple types. The S and K combinator expressions form a well-known Turing-complete subset of the lambda calculus. We specify evaluation, type inference and combinatorial generation algorithms for SK-combinator trees. In the process, we unravel properties shedding new light on interesting aspects of their structure and distribution. A uniform representation, as binary trees with empty leaves, is given to expressions built with Rosser's X-combinator, natural numbers, lambda terms and simple types. Using this shared representation, ranking/unranking algorithm of lambda terms to tree-based natural numbers are described. Our algorithms, expressed as an incrementally developed literate Prolog program, implement a declarative playground for exploration of representations, encodings and computations with uniformly represented lambda terms, types, combinators and tree-based arithmetic.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑