An encoding of the $$\lambda $$ -calculus in the String MultiSet Rewriting calculus
Acta Informatica (2024) 61:161–181
https://doi.org/10.1007/s00236-024-00456-w
ORIGINAL ARTICLE
An encoding of the -calculus in the String MultiSet
Rewriting calculus
Attila Bagossy1 · Péter Battyányi1
Received: 27 August 2021 / Accepted: 17 November 2023 / Published online: 13 March 2024
© The Author(s) 2024
Abstract
In this paper, we present an encoding of the λ-calculus in a multiset rewriting system and
provide a few applications of the construction. For this purpose, we choose the calculus
named String MultiSet Rewriting, which was introduced in Barbuti et al. (Electron Notes
Theor Comput Sci 194:19–34, 2008) by Barbuti et al. With the help of our encoding, we give
alternative proofs for the standardization and the finiteness of developments theorems in the
λ-calculus.
1 Introduction
In past years, many formalisms have appeared in order to model biological systems based
on interacting components. Most of these systems are high-level abstractions of biological
phenomena aiming to describe the organization of the components of a biological system
and the possible interactions between the components. For example, we would mention the
κ-calculus of Danos and Laneve [11], which is a formal system modeling protein interaction,
and the biochemical Stochastic π-calculus [16], which allows qualitative and quantitative
investigations of composite systems. The Brane Calculus defined by Cardelli [8] is an efficient
tool for the exact presentation of cell-level processes, and the same is true for the Calculus of
Looping Sequences [3]. Many of the systems mentioned are based on multiset rewriting, and
the same is true for membrane systems [10], chemical reaction systems [15] and Petri nets
[9]. There are recent investigations concerning the introduction of regulating mechanism to
reduce the extent of non-determinism and to enhance the expressive power of these systems
[20]. A significant part of the attention devoted to these investigations is due to the effort
of providing manageable but general enough modeling frameworks for biologically inspired
computational systems [18].
The work is supported by the EFOP-3.6.3-VEKOP-16-2017-00002 project.
B
Péter Battyányi
Attila Bagossy
1
Department of Computer Science, Faculty of Informatics, University of Debrecen, Debrecen, Hungary
123
162
A. Bagossy, P. Battyányi
A form of multiset rewriting, which is the Calculus of Looping Sequences, was proposed in
[14] offering a simple and easy to implement tool with a clear semantics to model biochemical
processes. Translating higher-level systems to this calculus turned out to be difficult, however.
Hence, the calculus of String MultiSet Rewriting (SMSR) was developed [4], which proved to
be an appropriate intermediate solution: its main invention is the maximal matching operator,
which facilitates the representation of higher-level languages. The underlying idea of that
calculus is that, by grabbing the tree-like structures of terms of a formal system, a multiset
of strings can describe the index paths from root to leaves in a given term and, consequently,
substitutions with terms are encoded as replacement of a whole multiset of strings having a
common prefix with another multiset in a single step.
In this paper, we introduce first the SMSR system following [4]. Then, we show how
to represent λ-terms with multisets and define the multiset rewriting rule corresponding to
β-reduction. We prove that this multiset calculus correctly simulates the λ-calculus equipped
with β-reduction. With this in hand, we present two applications of the construction: We give
a proof of the standardization theorem of the λ-calculus and a demonstration of the finiteness
of developments theorem. The proofs benefit from the fact that strings in multisets can be
considered index sequences identifying subterm occurrences in the corresponding λ-terms;
hence, the statements concerning subterms, contractums and residuals can be formulated in a
precise and natural way based on the multiset calculus. The proofs give some insight into the
original λ-calculus notions: For example, we can address every subterm occurrence by some
string and, hence, by giving an appropriate ordering to these strings, we can show that a βreduction sequence is standard if and only if the sequence of index strings is non-decreasing.
That is, the phrase “from left to right” used to explain standardness obtains its meaning. By the
proof of the finiteness of developments theorem, we make use of a separation lemma applied
in [21], the proof of which can possibly be presented in a more intuitive and clearer way when
we resort to multisets. The present encoding can open the way for approaching theorems of the
λ-calculus from a different perspective: It offers a computationally complete “index calculus”
that may be the source of further investigations. It seems to be flexible enough to encode
different evaluation semantics of the lambda calculus, or, possibly, resource lambda calculus
[7], or symmetric lambda calculi [17] or non-deterministic calculi like, for example, the
chemical programming model of Bânatre et al [2]. On the other hand, the calculus appears
to be simple enough to serve as the foundation for implementations. There is already an
ongoing research on the implementation of a multiset rewriting calculus [20] very similar
to SMSR calculus. To sum it up, the multiset rewriting calculus provides a powerful tool in
the study of rewriting systems, which is capable of both underpinning precise mathematical
arguments and of permitting the creation of tools for real-life applications.
2 String MultiSet Rewriting
In this section, we provide a brief overview of the String MultiSet Rewriting (SMSR) calculus
following the treatment in [4].
2.1 Strings and multisets
In what follows, we present the String MultiSet Rewriting (SMSR) calculus. Prior to this,
we briefly recall the main notions regarding multisets.
123
An encoding of the λ-calculus in the...
163
Let N denote the set of natural numbers and N+ denote the set of positive integers,
respectively, and let U be a finite non-empty set. A multiset M over U is a pair M = (U , f ),
where the mapping f : U → N gives the multiplicity of each element a ∈ U . If f (a) = 0
for each a ∈ U , then M is the empty multiset. The number of elements in a multiset M,
that is, the elements a ∈ U with positive multiplicity, is denoted by |M|, and we refer to
this number as the cardinality of M. In our case, the cardinality of a string multiset M is the
number of strings in M.
Next, we define some elementary operations concerning multisets. Let M1 = (U , f 1 ),
M2 = (U , f 2 ). Then, (M1 M2 ) = (O, f ) where f (a) = min{ f 1 (a), f 2 (a)}; (M1 M2 ) =
(O, f ), where f (a) = max{ f 1 (a), f 2 (a)}; (M1 ⊕ M2 ) = (O, f ), where f (a) = f 1 (a)+
f 2 (a); (M1 M2 ) = (O, f ) where
f (a) = max{ f 1 (a) − f 2 (a), 0}; and M1 M2 , if f 1 (a) ≤ f 2 (a) for all a ∈ O.
String MultiSet Re (...truncated)