In this note we want to briefly present chemlambda (or the chemical concrete machine), an artificial chemistry with the following properties: (a) is Turing complete, (b) has a model of decentralized, distributed computing associated to it (Buliga and Kauffman, 2013), (c) works at the level of individual (artificial) molecules, subject of reversible, but otherwise deterministic interactions with a small number of enzymes, (d) encodes information in the geometrical structure of the molecules and not in their numbers, (e) all interactions are purely local in space and time.
In some respects chemlambda is closed to the fraglets (Tschudin, 2003) and metabolic approaches (Tschudin and Yamamoto, 2004) research line. In others, it resembles to the CHAM (”chemical abstract machine”) (Berry and Boudol, 1992), which uses a chemical metaphor for modeling asynchronous concurrent computations (in particular a concurrent lambda calculus). Algorithmic Chemistry (Fontana and Buss, 1996) (Fontana and Buss, 1994a) (Fontana and Buss, 1994b) is another classical line of inspiration. Because it concentrates at the level of individual molecules, it departs however from the programming model of computation introduced in (Banâtre and Le Métayer, 1986) (Banâtre et al., 1988).
Chemlambda appeared as an artificial chemistry version of a graph rewrite system, called graphic lambda calculus (GLC) (Buliga, 2013b) (web tutorial). In GLC programs are certain trivalent graphs, and execution of programs means the application of graph rewrites, called ”moves”, on the respective graph.
In the GLC formalism there is one global move (GLOBAL FAN-OUT), all the other moves are local (i.e. they involve a fixed, small number of nodes).
Chemlambda was introduced in order to eliminate this unpleasant GLOBAL FAN-OUT. Chemlambda uses only local moves (Buliga, 2013a) (web tutorial). The moves of chemlambda act on trivalent graphs called ”molecules” at certain ”reaction sites”, like chemical reactions involving molecules and enzymes (here enzyme=move).
Later on, a distributed, decentralized model of computation appeared, called distributed GLC (Buliga and Kauffman, 2013), which is based on chemlambda and GLC, also using the Actor Model by Hewitt (Hewitt, 2010) (Agha, 1986). The Actor Model ingredient is a replacement of proximity relations between (individual) interacting molecules. Indeed, real chemical interactions happen only between molecules which are close one to another. But in the chemlambda formalism there is no space where these artificial molecules float, they are just certain trivalent graphs, not embedded in any way in a space. Computation with chemlambda molecules is seen as asynchronous, purely local and decentralized application of graph rewrites (i.e. moves, or interaction with enzymes). Proximity relations are then replaced by interactions between actors, each actor being in charge of a molecule, and having a very limited repertoire of behaviours. (In turn, each behaviour uses one of the graph rewrites available, either applied between two interacting actors, or internally, as it is the case of the sequences of moves which effect a self-multiplication replacing the GLOBAL FAN-OUT of GLC).
The key merit of this model is a graphical reformulation of the well-known lambda calculus, central to logic and to the design of recursion in computer languages. By reformulating the lambda calculus in terms of graphs, the operations for the calculus become essentially local operations of graphical replacement. The graphs themselves contain all the data that is usually formulated in terms of algebra. This means that the global structure of the graph contains all the information that is usually cut up into bits of algebra. The graph becomes a whole system that instantiates the computational power of the calculus. This instantiation is the key reason why this model can propose significant designs in distributed computing. The graph as a whole can exist in a widely distributed fashion, while the interactions that constitute its computations are controlled by local nodal exchanges between actors.
Furthermore, this property of redesigning the relationship of the local and the global is not restricted just to lambda calculus networks. There are relationships of the same kind that link this research with topology (knots and lambda calculus (Kauffman, 1994b), knot automata (Kauffman, 1994a)), or with topological quantum computing (Chen et al., 2007), (Kauffman and Lomonaco Jr., 2006).
2 A quick review of lambda calculus
In this section we give a very quick review of the formalism and ideas of lambda calculus. First of all the notation
indicates a function of two variables, defined in some domain and a stipulation (the part after and before the function) of the order of application of the operator to these variables. Thus we can write
For example, If
Later we will make a notation for the operation of evaluating such an operator, but for now we just consider the non-associative algebra structure of such operators. We can work in reverse as well. Suppose I say that is an operator defined by the equation
Then we have in the notation,
For this analysis, let us suppose that the algebra generated by the variables is a universal non-associative algebra. This means that the binary operation is non-associative and there are no further relations instantiated. However, if we define by and regard as an element of an extension of the original algebra by giving it the status of then satisfies the special relation that defines it and furthermore we would like to be able to say that the definition of the action of applies even if we apply to itself. In that case we would have as a consequence of the definition Thus we can start with a universal non-associative algebra and then add new elements that satisfy special relations. We can in this freely made situation allow the new elements to act (compose) upon themselves.
Here is a useful example. Let be a given operator. It can be one of the original variables, or it can be a defined operator such as we have discussed above. The we define as
That is, we define
Now we note that
Thus any in our algebra has a fixed point that is another element of the algebra. This is the Fixed Point Theorem of Church and Curry. Along with this fixed point theorem comes some caution in the use and construction of such lambda calculi. For suppose we had been dealing with a logical calculus and , the negation operator. Then in our initial calculus we may have assumed that negation does not have a fixed point, as in classical logic. But we have seen that if
Thus the extended algebra can not be expected to continue to obey classical logical rules. If it is desired to continue to obey such rules then one must put some controls on the lambda calculus. Also, if one has a fixed point as in
then there is the possibility of an infinite recursion of the form
It is good to have a formalism for recursion, but the language needs to include controls for that so that a computation does not run without stopping.
One way to handle such control is to replace equality of evaluation by an evaluation or reduction step. Then one would have
where the arrow refers to a reduction step that can be performed. In this case, the step is called beta - reduction. In the rest of this paper, we show how to adapt such controlled lambda calculi to operations on graphs where steps of replacement from one graph to another correspond to operations like beta-reduction. The graphs, once they are formulated, have the advantage that the details of labeling in the algebra have disappeared into graphical connections and so certain complexities of lambda calculi are handled automatically. We envisage such graphical systems and their evolutions under computational steps such as beta-reduction as a new and powerful formulation of computation and information processing.
3 The Chemlambda formalism
Chemlambda is a graph rewriting system. It consists in a family of graphs, called ”molecules” and a list of graph rewrites, called ”moves”. Every move is local, in the sense that there is an a priori upper bound on the number of nodes and arrows which are modified during the move.
A molecule is a locally planar graph made by a finite number of pieces (arrows, loops, nodes described in Fig. 1). We may admit also a set of nodes with unspecified valences, called ”other molecules”. These are the equivalent of ”cores” from (Buliga and Kauffman, 2013) section 3, paragraph 5. Interaction with cores, i.e. they can be used as interfaces with external constructs.
Each chemlambda move is to be interpreted as the interaction of a chemlambda molecule with an enzyme (which has the same name as the move), at a certain reaction site (the place where the move is applied). The moves are reversible.
The list of moves is the following:
the beta move, Fig. 2 up, is the graphic version of beta reduction from lambda calculus. It is a local graph rewrite version of the Wadsworth (Wadsworth, 1971) or Lamping (Lamping, 1990) beta reduction move, in the sense that it can be applied whenever is possible, independently of the fact that the graph, or molecule, represents a lambda calculus term.
the FAN-IN move, Fig. 2 down, is a dual of the beta move, involving a fanin and fanout node. It is as important as the beta move, being involved into self-multiplication of molecules.
the DIST moves, Fig. 3, provide the mechanism of self-multiplication of molecules, together with the FAN-IN move
the co-associativity and co-commutativity moves, Fig. 4, are a very weak description of the fanout node as a fan-out, in the sense that if we think about the fanout node as being a gate with one input and two outputs which are identical with the input, then graphically such a gate would satisfy the CO-ASSOC and CO-COMM moves. However, the fanout node is not a gate in this formalism, because there is nothing which propagates through the arrows of chemlambda molecules.
the local pruning moves, Fig. 5, are useful in both senses, either as moves which destroy the ”dead” arrows and nodes, or as moves which enrich the molecule by creating new arrows or nodes.
4 Chemlambda and lambda calculus
Lambda calculus combinators can be encoded as chemlambda molecules. In (Buliga, 2013a) Theorem 4.2 is given the encoding of the BCKW system of combinators from Fig. 6. The proof of the theorem has two parts: (a) the reduction relations of the BCKW system can be done in chemlambda, (b) the B,C,K,W combinator molecules can reproduce, or self-multiply. The conclusion of the theorem is that chemlambda is Turing universal.
We think it is interesting to explain in detail what this self-multiplication means in the chemlambda formalism.
Remark, after inspection of the Fig. 6, that every combinator molecules has one arrow which points outwards from the molecule, let’s call this arrow the ”exit arrow”. Recall that we have a fanout node among the basic pieces of chemlambda molecules. In order to prove the Turing universality, we need to be able to transform, by a sequence of chemlambda moves, one combinator molecule with the exit arrow connected to the in arrow of a fanout node, into two copies of the combinator molecule. We call this self-multiplication. (In the GLC formalism this self-multiplication is done via the move GLOBAL FAN-OUT, but chemlambda has only local moves.)
As an example, in the Fig. 7 we see how the K combinator molecule self-reproduces, after a string of chemlambda moves.
5 Propagators, distributors, multipliers and guns
The self-multiplication of combinator molecules is done by a sequence of local moves of chemlambda. The sequence of moves depends on the combinator molecule. We have seen that self-multiplication is an important ingredient for proving Turing universality of chemlambda.
Many chemlambda molecules don’t encode combinators or lambda calculus terms, moreover, moves like DIST or FAN-IN don’t have a clear meaning as seen from the point of view of lambda calculus. The phenomenon of self-multiplication is not restricted to combinator molecules.
Let us then explore a bit the chemlambda formalism from the point of view of phenomena like self-multiplication, without caring about lambda calculus.
In the Fig. 8 are defined multipliers, propagators and distributor molecules. A chemlambda molecule with an exit arrow is a multiplier if there is a sequence of chemlambda moves, denoted by , which produces the self-multiplication of the molecule. For example, any combinator molecule is a multiplier, but there are other multipliers as well.
A chemlambda molecule with distinguished in and out arrows is a propagator if there is a sequence of chemlambda moves, denoted by , with the effect described in the second row of Fig. 8. The molecule is called a propagator because it looks like it propagates through the fanout nodes.
There are two kinds of distributor molecules, described in the 3rd and 4th rows of Fig. 8. Compare with the DIST moves from Fig.3, which can be interpreted by saying that the application node is a distributor of the first kind and the lambda abstraction node is a distributor of the second kind.
Starting from the mentioned multipliers and distributors, we can make many other interesting molecules. For example, we can make a propagator from a multiplier and a distributor of the first kind , as described in Fig. 9.
In Fig 10 is described a multiplier made from a distributor of the second kind.
We can as well make guns, which shoot an endless string of molecules, like in the Fig. 11. On the first row is described a gun made from a propagator molecule and a fanout node. On the second row is described a gun made from a distributor of the first kind and a fanout node.
See also (Buliga, 2013a) Section 3 for other examples of interesting chemlambda molecules, like zippers, sets and pairs.
All these constructions show that we can use chemlambda for building all sorts of synchronous or asynchronous automata (which are not living on a predefined lattice, instead they grow their own lattice). Also, we proved the potential of chemlambda to evolve complex molecules from simple ones.
6 The Y combinator and self-multiplication
In this section we come back to lambda calculus, in order to explain the behaviour of the Y combinator molecule. From the previous sections we learned that self-multiplication is a basic ingredient for encoding the BCKW system of combinators in chemlambda. The moves applied to a combinator molecule represent the reduction of the combinator. Self-multiplication is needed in order to produce copies of a part of the combinator molecule, with the purpose of further reducing one of the copies, while having at our disposal the other copy for further needs.
Seen like this, it seems that self-multiplication is also a basic ingredient for recursion. In lambda calculus there is the iconic Y combinator which represents the essence of recursion. In the following we shall see that, however, self-multiplication is not directly needed in the reduction of the Y combinator.
The Y combinator has the expression
and it has the following property: for any lambda term the expression reduces to . In particular, if is another combinator, then is a fixed-point combinator for .
In lambda calculus the string of reductions is the following sequence of beta moves:
We see that the during the reduction process we needed a multiplication of the combinator .
Let us pass to the chemlambda encoding of the Y combinator. With another combinator molecule, the combinator molecule which encodes is the one from the left hand side of the Fig. 12.
After the application of a beta move, it transforms into the molecule from the right hand side of Fig. 12. Continuing from the Fig. 12, there is a second beta move which can be applied, as in Fig. 13.
There are two DIST moves, one of the first kind, the other of the second kind, which are applied, as in Fig. 14.
Let’s see how we can reduce further this molecule, until we obtain one which corresponds to . We shall use the fact that a certain molecule, called the bit is a propagator, as proved in Fig. 15. The bit molecule corresponds to the expression which appears repeatedly in the combinator.
The last molecule corresponds to , if we interpret the fanout nodes as real fan-out gates.
Surprisingly, during the reduction there was no need to use the fact that the combinator molecule is a multiplier! This shows that the combinator molecule can be used as a fixed point combinator with any other chemlambda molecule. That is because the combinator molecule is a gun which shoots fanout nodes, Fig. 17.
7 A topological version of chemlambda
In (Buliga and Kauffman, 2013) Section 5 is proposed a topological version of GLC, called TGLC. We can do the same with chemlambda. The idea is that we may imagine formalisms which are equivalent with GLC and chemlambda, even if visually they seem different.
For a topological version of chemlambda we may use some of the basic nodes of chemlambda together with knot diagrams crossings. In Fig. 19 we give two possible translations of crossings into chemlambda: (a) as a pair of a fanout and application node, corresponding to the proposal made in (Buliga and Kauffman, 2013) Section 5, or (b) as a pair of a lambda abstraction node and an application node, as proposed in (Buliga, 2013b) Section 6. A crossing is a 4 valent vertex. Virtual crossings, i.e. encircled crossings of graphical lines, may be used for making our graphs globally planars instead of only locally planar, as previously.
If we stick to the choice (a) then we obtain a topological version of chemlambda, that has the form of knot diagrams equipped with extra lambda nodes and multiplication nodes.
In Fig. 18 we illustrate the basic fixed point combinator
In this knot diagrammatic convention, the two self-multiplications that occur at two levels in this expression are instantiated by the two curls in the graph.
Similarly, in Fig. 20 we illustrate a topological expression for the -combinator.
Note how the structure of this combinator takes on the hybrid nature of tangle diagram infused with curls and lambda nodes. It is natural to use virtual crossings in graph theory and in fact there is an extension of knot theory that allows exactly such virtual crossings in the knot diagrams.
The fact that alpha reduction is not needed in chemlambda due to the absence of variables and the presence of direct connections that effect interactions is part of a link of this formalism with the formalisms at the knot theoretic and topological level. One difference between knot theoretic considerations and lambda calculus considerations is in the fact that we do not usually think of a knot diagram as a computing element that undergoes moves and reductions for the sake of a computation. But this is not always so. For example, the skein algorithms such as the bracket polynomial algorithm can be regarded as a reduction process that produces two new graphs from each crossing in the knot diagram. This is similar to allowing free beta reduction in the lambda calculus graphs. What must be done however in the knot theoretic case is to collect up all the end calculation results and add them together. This is what is meant by a formula like
(See (Kauffman, 1991).) Each is a pattern of reductions leading to a specific algebraic value The topological invariance occurs at the level of the sum of all of these contributions.
An analogous situation could occur in a stochastic version of chemlambda, where one would need the average over all the results of the many branching graph rewrites.
- Agha (1986) Agha, G. (1986). Actors: A model of concurrent computation in distributed systems. Doctoral Dissertation. MIT Press, (html).
- Banâtre et al. (1988) Banâtre, J.-P., Coutant, A., and Le Métayer, D. (1988). A parallel machine for multiset transformation and its programming style. Future General Computer Systems, 4:133–144.
- Banâtre and Le Métayer (1986) Banâtre, J.-P. and Le Métayer, D. (1986). A new computational model and its discipline of programming. Technical Report INRIA Report 566.
- Berry and Boudol (1992) Berry, G. and Boudol, G. (1992). The chemical abstract machine. Theoretical Computer Science, 96(1):217–248.
- Buliga (2013a) Buliga, M. (2013a). Chemical concrete machine. arXiv:1309.6914.
- Buliga (2013b) Buliga, M. (2013b). Graphic lambda calculus. Complex Systems, 4:311–360.
- Buliga and Kauffman (2013) Buliga, M. and Kauffman, L. (2013). Glc actors, artificial chemical connectomes, topological issues and knots. arXiv:1312.4333.
- Chen et al. (2007) Chen, G., Kauffman, L., and Lomonaco, S. (2007). Mathematics in Quantum Computation and Quantum Technology. Chapman & Hall/CRC.
- Fontana and Buss (1994a) Fontana, W. and Buss, L. (1994a). ”the arrival of the fittest”: Toward a theory of biological organization. Bull. Math. Biol., 56:1–64.
- Fontana and Buss (1994b) Fontana, W. and Buss, L. (1994b). What would be conserved if the tape were played twice? Proc. Natl. Acad. Sci. USA, 91:757–761.
- Fontana and Buss (1996) Fontana, W. and Buss, L. (1996). The barrier of objects: From dynamical systems to bounded organizations. In J.Casti and J., Karlqvist, A., editors, Boundaries and Barriers, pages 56–116. Addison-Wesley.
- Hewitt (2010) Hewitt, C. (2010). Actor model of computation. arXiv:1008.1459.
- Kauffman (1991) Kauffman, L. (1991). Knots and Physics. World Scientific Pub.
- Kauffman (1994a) Kauffman, L. (1994a). Knot automata. In Proceedings of The Twenty-Fourth International Symposium on Multiple-Valued Logic, Boston, Massachusetts, pages 328–333.
- Kauffman (1994b) Kauffman, L. (1994b). Knot logic. In Kauffman, L., editor, Knots and Applications, pages 1–110. World Scientific Pub.
- Kauffman and Lomonaco Jr. (2006) Kauffman, L. and Lomonaco Jr., S. (2006). q - deformed spin networks, knot polynomials and anyonic topological quantum computation. quant-ph/0606114.
- Lamping (1990) Lamping, J. (1990). An algorithm for optimal lambda calculus reduction. In POPL ’90 Proceedings of the 17th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 16–30.
- Tschudin (2003) Tschudin, C. (2003). Fraglets - a metabolistic execution model for communication protocols. In Proc. 2nd Annual Symposium on Autonomous Intelligent Networks and Systems (AINS), Menlo Park, USA.
- Tschudin and Yamamoto (2004) Tschudin, C. and Yamamoto, L. (2004). A metabolic approach to protocol resilience. In Proc. 1st Workshop on Autonomic Communication (WAC 2004), Berlin, Germany, pages 191–206. Springer LNCS volume 3457.
- Wadsworth (1971) Wadsworth, C. (1971). Semantics and pragmatics of the lambda calculus. DPhil thesis, Oxford.