"Define a molecular computer as one molecule which transforms, by random chemical reactions mediated by a collection of enzymes, into a predictable other molecule, such that the output molecule can be conceived as the result of a computation encoded in the initial molecule. "
M. Buliga, Build a molecular computer. Journal of Brief Ideas, 2015
(Computation of the Ackermann(2,2)=7 with chemlambda. See further details about how is made. You can move the atoms by click and drag.)
The notion of a molecular computer presented here is a model of computation based on individual molecules in a random environment. The model proposed here satisfies the following requirements: (a) is Turing universal (thus in principle to allow to compute anything), (b) based on a minimal set of well chosen chemical reactions which happen randomly.
Individual molecules encode data and programs in the chemical composition. Computations are not encoded in the numbers of species in a soup (multi set) of more or less arbitrarily chosen molecules.This is different than models of computation like the chemical abstract machine, or those based on chemical reaction networks.
I believe we can build molecular computers. This page is a call for making them real, either by discovering them in living organisms, or by learning how to build them from scratch.
The argumentation of this possibility goes like this:
step 1: virtual molecular computers are possible.
Based on a made up, very simple artificial chemistry called chemlambda, this is proved theoretically [1], [2], [3]. It is shown that chemlambda is Turing universal, that we can use some of the chemlambda molecules to encode untyped lambda beta calculus terms (but there exist many other molecules which do not encode lambda terms), that the reduction rules of the pure, untyped, lambda beta calculus can be realized by the chemlambda graph rewrites (but the graph rewrites apply as well to molecules which don't represent lambda terms and they work in a more general sense than only as representations of untyped lambda beta reduction rules).
Chemlambda works with molecules which are graphs made by elementary constituents ("atoms") and links ("bonds") which enter in chemical reactions seen as local graph rewrites and interpreted as chemical reactions of the molecule with a set of invisible "enzymes", one enzyme per type of graph rewrite. Moreover, chemlambda does not use variables and does not rely on evaluations of terms. Instead of passing variables and evaluations, chemlambda uses a different strategy which is akin to signal transduction.
To obtain a full model of computation one needs an algorithm concerning the application of graph rewrites. The algorithm is random and uses the fact that the graph rewrites are local (i.e. they involve only patterns with a small number of atoms and bonds, without any concern about the global structure of the graph-molecule). Chemlambda is therefore an asynchronous graph-rewriting automaton.
There is a github repository where this model is implemented and various demos are available, which show some features of the model:
classical examples of lambda calculus computations
demos about artificial life forms called "chemlambda quines"
(How to use the repository). The active branch of the repository is available at this link. Follow the instruction from the README.md.
As an example, this javascript animation is the output of the computation which uses the molecule sheet_copy.mol. It is produced by the scripts from the repository and you use the browser to see it. It's an example of a computation which is not about lambda calculus, but nevertheless it leads to a structure which is programmed in the initial simpler one. You can move the atoms by click and drag.
step 2: from virtual chemical reactions to real ones.
The patterns which appear in the chemlambda graph rewrites are so simple that it is highly possible that there exist real correspondents of "atoms", "ports", "bonds" and "enzymes", perhaps as simple real chemical molecules, which enter in real chemical reactions which mimic the graph rewrites of chemlambda. The problem is to identify those patterns in reality, by a combination of database searches and experiments which make this project ideal for an open source bio-hacking project, for example.
Chemlambda
is a graph-rewriting formalism with some of the moves (graph-rewrites) inspired from lambda calculus, like for example the BETA move, which is a variant of the Wadsworth-Lamping treatment of the beta move on syntactic trees of lambda terms. But there is a difference: in chemlambda there are no correct molecules (graphs).
Another resemblance is with the Alchemy of Fontana and Buss. They also propose to look at lambda calculus as an artificial chemistry. The main difference is that while in chemlambda application and abstraction are treated on the same par, as atoms in the molecule, in Alchemy application is seen as a chemical reaction and abstraction is seen as a reactive locus in a molecule, i.e. the chemical reactions in Alchemy are of the type A + B - - > AB, where A, B are lambda terms and AB is A applied to B. In the work of Christoph Flamm the chemical reactions are of the type A + B - - > C + D, understood as a rewrite of the unconnected pattern obtained from the union of A and B. In chemlambda the rewrites model a chemical reaction A + Enzyme - - > B + Enzyme, where Enzyme is associated to the rewrite.
Chemlambda molecules
The molecules of chemlambda are graphs made by 9 elementary constituents, called A, L, FI, FO, FOE, T, Arrow, FRIN, FROUT. Every elementary constituent is made by a main atom, represented in the demos as a big colored circle, and some smaller atoms, called ports. A, L, FI, FO, FOE have 3 ports each, Arrow has two ports, and T, FRIN and FROUT have one port each. They are linked by bonds, which are of two kind: inner, between a main atom and its ports, and outer, between ports. Each port has a pair of types, one from the family (left, right, middle) and the other one from the family (in,out). The outer bonds are permitted only between a pair of ports, one with type in, the other with type out.
We use the "mol" notation for a chemlambda molecule. The programs from the github repository work with files with the extension .mol as inputs. Thus a molecule is represented by a .mol file. The visualisations represent a molecule as made by coloured circles of various radii (there is a radius "main_const" for the main atoms and the types of ports "left", "right" and "middle" are represented by radii of circles with the same names).
The colour of the main atoms comes from the type of the atom (A,L, FI, ...) and the colour of the ports encode the type "in" or "out".
Therefore there is a one-to-one correspondence between the mol notation and what you see. Everything in the visualizations is coded by color, radius of the circle and, for links, there are inner (thicker) and outer links. For reading convenience I shall use (a given pallete of) these colours in the explanations.
The colours are: " in_col", " out_col", " red_col" (yes, I know), " green_col", " arrow_col" and " term_col". The colour palette does not really matter, of course, for the chemistry (see this older introduction about the molecules with a different palette).
Here is the list of nodes with the types of their ports, and the way they are written in the mol file. The colours are as in the visualisations convention. Recall that the mol file notation does not need colours, these are only for visualization purposes.
L middle.in left.out right.out , is inspired from the lambda abstraction.
A left.in right.in middle.out , is inspired from application operation.
FI left.in right.in middle.out , has no correspondent in lambda calculus, name means "fan-in".
FO middle.in left.out right.out , has no correspondent in lambda calculus, name means "fan-out".
FOE middle.in left.out right.out , has no correspondent in lambda calculus, name means "extra fan-out". Mind that in chamlambda there are two kinds of fan-out nodes!
Arrow middle.in middle.out , has no correspondent in lambda calculus, is a simple solution for application of some of the moves. Is inspired from Louis Kauffman proposal to use commutative polynomials for the graphical elements (where the variables of the polynomials play the roles of the ports). Louis Kauffman used on July 3rd 2014 the Mathematica symbolic reduction for polynomial commutative algebra in order to try to reduce the fixed point combinator in graphic lambda calculus, thus making the first attempt of a visualisation program for chemlambda.
T middle.in , called "termination" node, is used in relation to lambda calculus in place of variables x appearing in terms Lx.A, where A does not contain x.
FRIN middle.out , is a "free in" node, used for edges with a free source. (Thus, if your mol file has a port variable "a" which appears only once, in a port of type in, then the main script adds "FRIN a" to the mol file.)
FROUT middle.in , is a "free out" node, used for edges with a free target. (Thus, if your mol file has a port variable "a" which appears only once, in a port of type out, then the main script adds "FROUT a" to the mol file.)
Remark that the colours and the relative size of the circles are enough to encode all the information needed in the formalism. For example the colours of nodes and ports allows to discern which is L 1 2 3 and which is FI 1 2 3 .
Chemlambda graph rewrites
A shorter name is "moves". They should be seen as chemical reactions involving a small part of the molecule and an invisible enzyme, one enzyme type per move.
In the following you see the moves written in the mol convention, and also a visualization of the moves. For each move you can CLICK on the move name to see what is happening. You can move the atoms by click and drag.
BETA and FAN-IN family
L 1 2 c , A c 4 3 - - > Arrow 1 3 , Arrow 4 2
FI 1 4 c , FOE c 2 3 - - > Arrow 1 3 , Arrow 4 2
DIST family
FO 1 2 c , FOE c 3 4 - - > FI j i 2 , FO k i 3 , FO l j 4 , FOE 1 k l
FI 1 4 c , FO c 2 3 - - > FO 1 i j , FI i k 2 , FI j l 3 , FO 4 k l<
L 1 2 c , FOE c 3 4 - - > FI j i 2 , L k i 3 , L l j 4 , FOE 1 k l
L 1 2 c , FO c 3 4 - - > FI j i 2 , L k i 3 , L l j 4 , FOE 1 k l
A 1 4 c , FOE c 2 3 - - > FOE 1 i j , A i k 2 , A j l 3 , FOE 4 k l
A 1 4 c , FO c 2 3 - - > FOE 1 i j , A i k 2 , A j l 3 , FOE 4 k l
PRUNING family
A 1 2 3 , T 3 - - > T 1 , T 2 (same for FI instead of A )
L 1 2 3 , T 3 - - > T 1 , T c , FRIN c
FO 1 2 3 , T 2 - - > Arrow 1 3 (same for FOE instead of FO )
FO 1 2 3 , T 3 - - > Arrow 1 2 (same for FOE instead of FO )
COMB move and COMB cycle.
The cycle is a rapid application of COMB moves, whenever there are Arrow elements with the "in" port connected to a port which does not belong to another Arrow.
any node M 1 , Arrow 1 2 - - > M 2
Exemplified here with a BETA move followed by a COMB cycle which eliminates all the Arrow elements, excepting the one which has its in port connected to its out port (so connected to another Arrow port).
The reduction algorithm
One needs to add to chemlambda a reduction model (which says basically how to apply the moves and what to do if two or more moves attempt to modify the same node of the graph). Any reduction model will do, with the condition to be:
local (the algorithm for deciding which move to apply or which solves conflicts has to be formulated so that it works with an input consisting of a graph with at most N nodes and links, with N fixed a priori)
geometrical (the result of the algorithm is the same regardless of the internal numbering, ordering or naming of the variables from the input)
it has to be asynchronous (because of locality in time as well) and decentralized, in the sense that the "local" constraint applies also in space, so the algorithm running in one place has to be able to solve moves and conflicts on its piece of graph based on an a priori bounded number N of graph nodes, links and messages exchanged with other places.
In the demos there is used the most simple algorithm, called for this reason the "stupid" one, in order to show that even so the results are interesting. This algorithm may turn out to be less stupid than I thought, in particular because it led to this proposal of a molecular computer.
The algorithm takes as input an initial graph, then there is a cycle where, at each step (deterministically or randomly):
are identified the pieces of graph where the moves apply
in the deterministic version, according to a priority of moves (i.e. in this case first identify the patterns for the move FO-FOE, then block the nodes which involve that move, then look further for the other moves DIST which involve free nodes, then block the nodes involved, then look for the BETA and FAN-IN moves, block the nodes, then look for PRUNING moves, block the nodes)
in the random version each move has an asociated random coin flip, with an weight. The coin is flipped for each proposed move and the move is applied or not, accordingly,
moves are applied
at the end of the step there is a COMB cycle, which search for the application of all COMB moves (which eliminate the Arrow elements) until there is no possibility of applying further COMB moves (which does not mean that all Arrow elements are eliminated)
The effect of this algorithm is equivalent, in case we start from a graph which represents a lambda term, to a massively parallel reduction of the term, but one not involving any variable passing, nor evaluation steps.
On top of this, if we restrict to graphs coming from lambda terms, one has to take care that: (a) there is no eta reduction, it's pure lambda beta, so "functional" is not appropriate to use because functions need eta reduction (b) even if the initial and final graphs (if there is a final graph) correspond to lambda terms, typically the intermediary ones do not, see for example the bw version of the predecessor reduction.
Each move is seen as an interaction between a (part of a) molecule-graph with an invisible enzyme, one enzyme per move. One can make the enzymes visible, even use them as a resource, introduce moves between enzymes, making the whole model conservative, or even transform the enzymes into chemlambda graphs as well, by a sort of bootstrapping.