Category Archives: chemlambda

Universality of interaction combinators and chemical reactions

In the foundational article Interaction combinators, Yves Lafont describes interaction rules as having the form

lafont-1

He then gives three examples of particular families of interaction rules which can be used to simulate Turing Machines, Cellular Automata and Unary Arithmetics.

The main result of his article (Theorem 1) is that there is an algorithm which allows to translate any interaction system (i.e. collection of interaction rules which satisfy some natural conditions) into the very simple system of his interaction combinators:

lafont-2

In plain words, he proves that there is a way to replace the nodes of a given interaction system by networks of interaction combinators in such a way that any of the interaction rules of that interaction system can be achieved (in a finite number of steps) by the interaction rules of the interaction combinators.

Because he has the example of Turing Machines as an interaction system, it follows that the interaction combinators are universal in the Turing sense.

The most interesting thing for me is that Lafont has a notion of universality for interaction systems, the one he uses in his Theorem 1. This universality of interaction combinators is somehow larger than the universality in the sense of Turing. It is a notion of universality at the level of graph rewrite systems, or, if you want, at the level of chemical reactions!

Indeed, why not proceed as in chemlambda and see an interaction rule as if it’s a chemical reaction? We may add an “enzyme” per interaction rule, or we may try to make the reaction conservative (in the number of nodes and wires) as we did in chemlambda strings.

Probably the rewrites of chemlambda are also universal in the class of directed interaction networks. If we take seriously that graph rewrites are akin to chemical reactions then the universality in the sense of Lafont means, more or less:

any finite collection of chemical reactions among a finite number of patterns of chemical molecules can be translated into reactions among chemlambda molecules

But why keep talking about chemlambda and not about the original interaction combinators of Lafont. Let’s make the same hypothesis as in the article Molecular computers and deduce that:

such molecular computers which embody the interaction combinators rewrites as chemical reaction can indeed simulate any other finite collection of chemical reactions, in particular life.

For me that is the true meaning of Lafont universality.

Advertisements

More experiments with the dynamic GoI abstract machine visualiser and chemlambda

This post continues from Diagrammatic execution models (Lambda World Cadiz 2018) compared with chemlambda . For the context, I quote from  this MonkeyPatchBlog post

Koko Muroya and Steven Cheung, working under the direction of Dan Ghica, gave a fantastic overview of their work on diagrammatic execution model.  […] There is a nice demo of their work hosted on github

The demo is the “GoI Visualiser”. In this post I continue to play with this visualiser and with chemlambda as well.

You can play too by using the link to the GoI Visualiser demo and an archive available here, which contains all is needed for running chemlambda and for producind anything from this post.

There is a readme.txt inside which you may enjoy, with instructions to use and some background.

OK, let’s play.

The Goi Visualiser comes with the untyped lambda term

A = ((λf. λx. f (f x)) ((λy. y) (λz. z))) (λw. w)

and in the preceding post I reduced this term in chemlambda. Now I take this term and remark that there are inside 3 identity terms: (λy. y) , (λz. z) and (λw. w). That is why I take the term

B = (λu.(((λf.λx.f(fx))(uu))u))(λw.w)

which has the property that by one BETA reduction it becomes A.

I filmed the reduction of B with the call-by-need, in the GoI Visualiser:

dgoi-6-need

and, out of curiosity, remarked that call-by-name does not work actually it does but I misunderstood what I see!

dgoi-6-name

 

What about chemlambda? The “molecule” (i.e. chemlambda graph) for the lambda term B can be either goi-5.mol, i.e.

A out2 in2 out3
L out in1 out2
A 1 2 out
A 3 4 1
L 5 f 3
FO f 7 9
A 7 8 6
A 9 x 8
L 6 x 5
A 10 11 4
FO in1 2 13
FO 13 10 11
L w w in2

or the goi-6.mol, i.e.

A out2 in2 out3
L out in1 out2
A 1 2 out
A 3 4 1
L 5 f 3
FO f 7 9
A 7 8 6
A 9 x 8
L 6 x 5
A 10 11 4
FO in1 13 2
FO 13 10 11
L w w in2

These two molecules differ in only one place:

FO in1 2 13  (goi-5.mol)   vs.  FO in1 13 2  (goi-6.mol)

Everything is in the archive! Go check for yourself, please 🙂

This difference is due to the fact that the algorithm for building a chemlambda molecule from a lambda term leaves freedom for the way to duplicate variables. Here in the case of the term B, this freedom is in relation with the variable “u”.  Indeed

B = (λu. … (uu))u) …

and to produce 3 u’s from one we need two FO (fanout) nodes, but we may arrange them in two ways.

The algorithm is the one to be expected, here the one from section 3, M. Buliga, Graphic lambda calculus, Complex Systems 22, 4 (2013), 311-360, arXiv:1305.5786.  In chemlambda we transform terms from lambda calculus by this algorithm, but mind that in Graphic Lambda Calculus (GLC) there is only one fanout node, the FO. In chemlambda there are two fanout nodes, the FO and the FOE. What is interesting is that there are no other nodes but the fanin FI, two fanouts FO, FOE, application A, lambda L, arrow Arrow, free input FRIN, free output FROUT, termination T. There are no brackets, boxes, tags!

You want to see again the rewrites of chemlambda? arXiv:1811.04960

So the algorithm of conversion is the one from GLC, with only FO nodes in the initial molecule for the term. There are two possible ways to convert the term B, these are goi-5.mol and goi-6.mol.

The goi-6.mol behaves very cool all the time (i.e. under the random reduction algorithm of chemlambda)

goi-6

 

The goi-5.mol behaves very well in about 87.5% cases (i.e. in 7/8 cases), from experiments. In most of the cases the reduction ends with an identity, as it should, but in 1/8 cases we end with this siamese brothers identity:

goi-5b

 

which is in mol notation:

FI 1 2 out

L z z 1

L v v 2

i.e. a fanin FI is left alone and it does not know that his left and right inputs are the same.

Why is that?

From all examples where I reduced molecules from lambda terms, I encountered this phenomenon only once, see the story of The factorial and the little lisper  .  In that case, I was able to produce a working example, and as well some funny ones, like this version of the factorial of 5:

tubefact

 

(taken from the Chemlambda for the people html/js slides)

This happens because there is a mix between execution and duplication which sometimes goes astray. For example if I take the molecule goi-2.mol

FO out out1 out2
A 1 2 out
A 3 4 1
L 5 f 3
FO f 7 9
A 7 8 6
A 9 x 8
L 6 x 5
A 10 11 4
L y y 10
L z z 11
L w w 2

which is exactly like the molecule goi.mol for the lambda term A (seen in the previous post), only with

FO out out1 out2

added, then the execution (reduction) of the two copies of A while they duplicate, it goes great:

goi-2

 

That is because the nodes FO, FOE and FI satisfy the shuffle trick, which guarantees the duplication of FO trees from lambda terms molecules (in particular).

I suspect that there is a choice of the FO fanout trees in the conversion of a lambda term into a molecule which does the job.

Don’t know how to prove it 🙂

 

Diagrammatic execution models (Lambda World Cadiz 2018) compared with chemlambda

Via this MonkeyPatchBlog post I learned about a keynote presented at the Lambda World Cadiz 2018, on Diagrammatic execution models, quote:

Koko Muroya and Steven Cheung, working under the direction of Dan Ghica, gave a fantastic overview of their work on diagrammatic execution model.   […]

There is a nice demo of their work hosted on github, which was used during the presentation. […]

Applied category theory is booming right now, and this work led me to wonder if they were considering describing their work in a categoretic way (yes, it seems). Some of the demos they showed were reminiscent of chemlambda: a graph evolving given rewriting rules (which incidently provided the illustration for the ACT 2019 announcement).”

So I wanted to see how does the lambda term reduce in chemlambda (with the random reduction).

Here is the GoI Visualiser in action: the term is ((λf. λx. f (f x)) ((λy. y) (λz. z))) (λw. w)

reduced with call-by-need looks like this:

goi

Comparison with chemlambda. The mol file goi.mol for this lambda term is:

A 1 2 out

A 3 4  1

L 5 f 3

FO f 7 9

A 7 8 6

A 9 x 8

L 6 x 5

A 10 11 4

L y y 10

L z z 11

L w w 2

I prepared an archive with all needed, taken from the chemlambda repository. You may just download it and then you shall see in the mol folder the goi.mol file. To produce (a) reduction you write in terminal

bash quiner_shuffle.sh

then you write

goi.mol

then you see that a file goi.html appeared. You write

firefox goi.html &

and you see this:

goi-chem

 

or something equivalent. So that’s how the reduction of this term looks in chemlambda. 🙂 Well, the animated gif shows that again and again…

UPDATE: Thank you for the interest and nice words. If you don’t like my way of writing code, which is to be expected because geometer here, then there is this Haskell implementation.

My opinion is still that the most interesting ideas of chemlambda are:

As concerns the first point, this justifies the accent on the dumbest, random, local reduction algorithm, and the experiments outside graphs which represent lambda terms (from all those chemlambda quines to mixtures of busy beavers and lambda terms).

As for the second point, there is really a lot of mathematics, perhaps logic too, to be explored here.

 

 

 

 

Chemlambda collection afterlife [updated]

Still, hundreds of posts available via reshares from the chemlambda collection. Recall that I deleted the collection some time ago, see here.

I arrived at the conclusion that there is no reason to hide recent or (sometimes) older research from public, just because I believe the academic publishing is close to collapse.

kinesinX2

So I started by posting on arXiv a text version of the experimental article Molecular computers, available now as arXiv:1811.04960.  The JS animations are replaced with links and there is a note to the reader added.

The same article is also posted at Figshare:

https://doi.org/10.6084/m9.figshare.7339103.v1

 

I deleted the Google+ chemlambda collection

This 400 posts collection, 60 000 000 views,  was as much a work of research popularization as a work of art. Google cannot be trusted with keeping high density data (scientific, art, etc). Read here about this.

bigpred_train_egg_mist_blue_superoptim

It pained me to delete it, but it had to be done. It was harder than when I quit Facebook, Twitter.

The collection and richer material exist, I have them. Still, the Github repository is available, as well as the github.io demos. For example, the dodecahedron multiplication animation used as background for a conference site of statebox.io was made from a screencast of a d3.js which can be seen  here.

 

Mail me for access to more material. I have to think what I am going to do with them, long term. Meanwhile look for updates at my professional homepage or the alternative page.

John Baez’ Applied Category Theory 2019 post uses my animation without attribution [updated]

The post, dated Oct 2, appears at John Baez Azimuth blog. Here is what I see today Oct 4th:

baez_s

UPDATE: now there is a link to the chemlambda repository, but see also the comments, there and here. The real problem is related to the attitude concerning  Open Science. Link to archived post.

This is the gif which illustrates the chemlambda github repository.

The original animation appeared for the first time in the chemlambda collection post Metabolism as failed replication. The later post (Sept 2016) contains more about this idea and useful links.

[ UPDATE: Recently, I deleted the chemlambda collection. The content of it will become public again in a new form. Meanwhile mail me for access. However, the github repo, libraries, demos and articles are public.]

The chemlambda molecule which is used is available at the chemlambda library of molecules, as tape_long_4653_2.mol . You can download the simulation itself (which was used to make the animation) from the Chemlambda collection of simulations at Figshare, the file tape_long_4653_2.js.

The last time when one of my animations was used withot attribution, the situations was quickly solved.  I explained then that the chemlambda project is an Open Science project and that correct attribution is what is fair to do.

Now, I would expect from an academic researcher more.

Anyway, again the magic of chemlambda strikes. Let me tell you what the animation is really about. Metabolism and replication are two fundamental ingredients of life. Which came first? Are these independent?  I prepared the molecule and experimented with it to show that (in the artificial toy chemistry chemlambda) metabolism and replication may be related, in the sense that metabolism may appear as failed replication.

The molecule in question is a “tape”, topologically the same as a DNA loop. On the tape there is a very small part which triggers the duplication of the tape molecule. The duplication works perfectly, there are several examples in the chemlambda collection. But this time I took a tape which duplicates without problems and I modified it in a single place. The result is a failed duplication which is spectacular in the sense that the tape molecule produces a number of disconnected graphs (i.e. other molecules), some of them are quines.

 

 

 

The second Statebox Summit – Category Theory Camp uses my animation

with attribution.

UPDATE: the post was initially written as a reaction to the fact that the Open Science project chemlambda needs attribution when some product related to it is used (in this case an animation obtained from a dodecahedron molecule which produces 4 copies; it works because it is a Petersen graph). As it can be seen in the comments everything was fixed with great speed, thank you Jelle. Here’s the new page look

Screenshot from 2018-09-09 15:18:06.png

Wishing the best to the participants, I’d like to learn more about Holochain in particular.

The rest of the post follows. It may be nice because it made me think about two unrelated little facts: (1) I was noticed before about the resemblance between chemlambda molecules and the “vajra chains” (2) well, I CHING hexagrams structure and rewrites are close to the two families of chemlambda rewrites, especially as seen in the “genes” shadow of a molecule. So putting these two things together, stimulated to find an even more halucinatory application of chemlambda, I arrived to algorithmic divination. Interested? Write to me!

__________________________________________________

I hope they’ll fix this, the animation is taken probably from the slides I prepared for TED Chemlambda for the people (html+js).

Here’s a gif I made from what I see today Saturday 20:20 Bucharest time.

test_s

Otherwise I’m interested in the subject and open to discussions, if any which is not category theory PR, but of substance.

UPDATE: second thoughts

  • the halucinatory power of chemlambda manifests again 🙂
  • my face is good enough for a TED conference (source), now my animation is good for a CT conference, but not my charming personality and ideas
  • here is a very lucrative idea, contact me if you like it,  chemlambda OS research could be financed from that: I was notified about the resemblance between chemlambda molecules and the vajra chains of awareness, therefore what about making an app which would use chemlambda as a divination tool? Better than a horoscope, if well made, huge market. I can design some molecules and the algorithm for divination.