Affiliation:
1. VU University, Amsterdam, Netherlands
2. Utrecht University, Utrecht, Netherlands
Abstract
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 λ
letrec
-terms among all terms with the same infinite unfolding. Instead of defined purely syntactically, this notion is based on a graph semantics. λ
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 λ
letrec
-term into a maximally compact form; and deciding whether two λ
letrec
-terms are unfolding-equivalent. The transformation of a λ
letrec
-terms
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 λ
letrec
-term
L
0
from the term graph
G
0
with the property [[
L
0
]] =
G
0
. Then
L
0
represents a maximally shared term graph, and it has the same unfolding as
L
.
The procedure for deciding whether two given λ
letrec
-terms
L
1
and
L
2
are unfolding-equivalent computes their term graph interpretations [[
L
1
]] and [[
L
2
]], and checks whether these are bisimilar.
For illustration, we also provide a readily usable implementation.
Funder
Nederlandse Organisatie voor Wetenschappelijk Onderzoek
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Cited by
2 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Structure-Constrained Process Graphs for the Process Semantics of Regular Expressions;Electronic Proceedings in Theoretical Computer Science;2021-02-08
2. A Complete Proof System for 1-Free Regular Expressions Modulo Bisimilarity;Proceedings of the 35th Annual ACM/IEEE Symposium on Logic in Computer Science;2020-07-08