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

用letrec实现λ演算的最大分担

Maximal Sharing in the Lambda Calculus with letrec

Clemens Grabmayer, Jan Rochel

摘要:

增加程序中的共享对于压缩代码是可取的,并且避免在运行时重复的归约工作,从而加速执行。我们展示了如何最大程度的共享,可以获得表示为在λ演算与letrec的条款的程序。我们引入了一个概念的“最大紧性”之间的所有条款相同的无限展开的EQUIDA-LETREC-条款。而不是纯粹的语法定义,这个概念是基于图语义。将非线性项解释为一阶项图,从而通过项图解释的双相似性来保留和反映项之间的展开等价性。项图的紧性可以通过函数互模拟来比较。我们描述了以下两个问题的实用和有效的方法:转换成一个最大的紧凑形式的一个apenda-letrec-长期,并决定是否两个apenda-letrec-长期展开等价。将一个双列项$L$转换成最大紧凑形式$L_0$分三步进行:(i)将L转换成它的项图$G = [[ L ]]$ ;(ii)计算$G$的最大共享形式作为它的互模拟塌陷$G_0$ ;(iii)从具有属性$[[ L_0 ]] = G_0$的项图$G_0$中读回一个双列项$L_0$。这保证了$L_0$和$L$具有相同的展开,并且$L_0$表现出最大共享。用于判定两个给定的双列词项$L_1$和$L_2$是否展开等价的过程计算它们的词项图解释$[[ L_1 ]]$和$[[ L_2 ]]$,并检查这些词项图是否双相似。为了说明,我们还提供了一个易于使用的实现。

英文摘要:

Increasing sharing in programs is desirable to compactify the code, and to avoid duplication of reduction work at run-time, thereby speeding up execution. We show how a maximal degree of sharing can be obtained for programs expressed as terms in the lambda calculus with letrec. We introduce a notion of `maximal compactness' for lambda-letrec-terms among all terms with the same infinite unfolding. Instead of defined purely syntactically, this notion is based on a graph semantics. lambda-letrec-terms are interpreted as first-order term graphs so that unfolding equivalence between terms is preserved and reflected through bisimilarity of the term graph interpretations. Compactness of the term graphs can then be compared via functional bisimulation. We describe practical and efficient methods for the following two problems: transforming a lambda-letrec-term into a maximally compact form; and deciding whether two lambda-letrec-terms are unfolding-equivalent. The transformation of a lambda-letrec-term $L$ into maximally compact form $L_0$ proceeds in three steps: (i) translate L into its term graph $G = [[ L ]]$; (ii) compute the maximally shared form of $G$ as its bisimulation collapse $G_0$; (iii) read back a lambda-letrec-term $L_0$ from the term graph $G_0$ with the property $[[ L_0 ]] = G_0$. This guarantees that $L_0$ and $L$ have the same unfolding, and that $L_0$ exhibits maximal sharing. The procedure for deciding whether two given lambda-letrec-terms $L_1$ and $L_2$ are unfolding-equivalent computes their term graph interpretations $[[ L_1 ]]$ and $[[ L_2 ]]$, and checks whether these term graphs are bisimilar. For illustration, we also provide a readily usable implementation.

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

↑