Graph rewrites, from graphic lambda calculus, to chemlambda, to directed interaction combinators

07/07/2020 ∙ by Marius Buliga, et al. ∙ ProtonMail 0

Here I report about the modifications of and relations between graphic lambda calculus, various formalisms which appeared under the name chemlambda and a version of directed interaction combinators. This is part of the study and experiments with the artificial chemistry chemlambda and the relations with lambda calculus or interaction combinators, as described in arXiv:2003.14332 and available from the entry page at



There are no comments yet.


This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.


The chemlambda project context and relevant previous work are explained in Section 4 (About this project) of [4] arXiv:2003.14332 See also, for more mathematical background, the presentation [6] Emergent rewrites in knot theory and logic.

Here I report about the modifications of the various formalisms which are related to chemlambda. The online varsion of this article, which will be kept up to date, is Graph rewrites, from emergent algebras to chemlambda. See also the site of all chemlambda projects.

1 Graphic lambda calculus

Introduced in [3] arXiv:1305.5786, graphic lambda calculus has the following doupbel push-out (DPO [15]) graph rewrites:

Graphic lambda calculus does not have an algorithm of application of rewrites.

There is an algorithm for conversion of untyped lambda terms into glc graphs. Here are two examples of reductions:

  1. reduction of the Omega combinator

  2. reduction of the term SKK

Graphic lambda calculus is interesting because it can also represent the graphical version of emergent algebras via decorated tangle diagrams explained in arXiv:1103.6007. It can therefore be used to represent and compute (reduce) differential calculus in metric spaces endowed with dilation structures arXiv:0810.5042.

This is done via the identification of decorated crossings as

Another, different identification of undecorated crossings, which can be done with GLC, uses the application and abstraction nodes

Under this identifications the equivalent of the beta rewrite in terms of tangle diagrams becomes equivalent with the ”splice” and ”loop” graph rewrites.

Both these identifications apply for a notion of tangle diagrams which differs from the usual one. Namely we use tangle diagrams which are not constrained to be planar graphs. More precisely, here a tangle diagram is an oriented port graph in the sense of Bawden [1] [2], with nodes which are 4-valent and oriented links. The nodes can be either undecorated, i.e. of the two kinds of oriented crossings, or decorated, i.e. the two kinds of decorated crossings are supplementary decorated with an element of a commutative group.

The difference from usual (oriented and with decorated crossings) tangle diagrams is that as graphs these diagrams are not supposed to be planar. By Kuratowski theorem, a graph is planar if it does not contain certain local patterns. In the terms of local machines explained in [5] Alife properties of directed interaction combinators vs. chemlambda we can’t detect with a local machine the absence of a local pattern in a graph, only the presence of it.

In joint work with L.H. Kauffman [7] arXiv:1312.4333, in section 5 Kauffman calls for a topological version of GLC, based exclusively on manipulations of tangle diagrams.

2 Chemlambda v1 (chemical concrete machine)

Introduced in [9] arXiv:1309.6914, chemlambda v1 or the chemical concrete machine is a modification of GLC which contains only local rewrites. It also proposes for the first time to see the graphs as molecules and the rewrites as chemical reactions mediated by rewriting enzymes. Beyond that, chemlambda v1 still lacks a clearly defined algorithm of rewriting.

The elements of chemlambda v1 are

The graphs are called molecules and the rewrites are mediated by enzymes.

The elements of GLC as translated into chemlambda are:

The rewrites are:

With these rewrites we can do some lambda calculus reductions, by using the same parsing of lambda calculus terms to (chemlambda) graphs as in GLC. For example the ENELSE lambda term.

A rewrite which is introduced later in the article is DISENTANGLE (as a pattern it appears later as SHUFFLE)

With this supplementary rewrite I can prove that the BCKW combinators system

can be implemented, in the sense that the combinators can duplicate (example here for B)

and that all needed reductions among B,C,K,W combinators can be done (example here for K)

This graph rewrite system has conflicting rewrites, but it has no algorithm of application of rewrites. Especially the status of DISENTANGLE is unclear. This will be solved in chemlambda v2.

The first published (in the usual ways) article which contains the name ”chemlambda” is joint with L.H. Kauffman, in the ALIFE-14 conference, arXiv:1403.8046. Here Kauffman pushes again for a more topological version Kauffman’ slides [11] which mixes tangle diagrams with chemlambda nodes, in order to be able to do computations (in the logical sense).The emergent algebras part of GLC, which is still present in chemlambda, used such tangle diagrams manipulations for differential calculus computations, instead. In these articles the emergent algebras aspects and interest are hidden.

Together with Kauffman, we experimented a lot with the power of chemlambda v1. Our essays on paper were not going too far, due to the lack of a program which could make much easier such exploration. In the background this was because of a lack of a clear rewrite application algorithm.

During this period I became aware of the existence of chemlambda quines. See as an example the tedious manipulation of reductions for the predecessor of a Church number taken from this chorasimilarity post

Meanwhile Kauffmann started to use Mathematica for doing chemlambda v1 reductions, as described in his slides [11].

He introduced the ”Arrow” 2-valent node, which is useful for easy application of several rewrites in the same time.

3 Chemlambda v2

is an artificial chemistry, in the sense that it is a purely local graph rewrite system together with an algorithm of applications which can be done by local machines. This notion of artificial chemistry is proposed in [17]. See arXiv:2005.06060 for more explanations.

Motivated by the first programming essays by Kauffman for chemlambda v1, I wrote the needed programs for chemlambda v2, in awk and html+d3.js used for visualization. The first chemlambda project site [13] contains demonstrations made with these programs from the github repository chemlambda-gui [14].

The latest chemlambda project site, which contains several repositories from various contributors, is this [12]. The project received help from several contributors, or validators, therefore now we can reduce chemlambda molecules in haskell, python or javascript, as you can see in the more recent demonstrations.

The chemlambda v2 rewrites solve the problem of the curious DISENTANGLE rewrite by introducing two fanout nodes (FO and FOE) instead of one and by a modified set of graph rewrites. These are the following. We use the mol notation for clarity and we describe the rewrites by giving the LHS and RHS patterns:

and the COMB rewrites which eliminate Arrow nodes.

The DISENTANGLE rewrite is no longer needed, because it’s effect can be achieved by the SHUFFLE move, which is a sequence of two chemlambda v2 rewrites: FO-FOE and FI-FOE.

4 Interaction Combinators and directed interaction combinators (dirIC)

For completeness, here are the graph rewrites of Lafont’ Interaction combinators [16], as they appear in the chemlambda v2 js programs, chemistry IC in chemistry.js:

FRIN and FROUT 1-valent nodes are introduced (as in chemlambda) for the free half-edges. We use also the Arrow 2-valent node and the COMB rewrites for eliminating them.

All LHS patterns, of chemlambda and IC, are made of two nodes connected through their active ports. The main difference between chemlambda v2 rewrites and IC rewrites is that several chemlambda nodes have two active ports, while IC nodes have only one active port.

It is possible to modify the chemlambda v2 chemistry such that there are no conflicts. We obtain a chemistry called ”dirIC”, or directed interaction combinators, explained in [5] Alife properties of directed interaction combinators vs. chemlambda, over the same set of nodes as chemlambda v2. With the chemistry dirIC, there is a translation between IC nodes of Lafont to chemlambda nodes:

As argued here [5], the existence of conflicting rewrites in chemlambda v2, compared with dirIC, creates much more interesting alife behaviours.