Tag Archives: quine

Find the quine: who ordered this?

I put a version of the Find the Quine on github. You may help (and have fun) to find new chemlambda quines.

The page lets you generate random 10 nodes graphs (molecules), which are variants of a graph called “10_quine”. There are more than 9 billion different variants, therefore the space of all possibilities is vast.

Up to the moment 4 new quines candidates were found. You can see them in that page too.

New phenomena were discovered, to the point that now I believe that chemlambda quines are a dot in a sea of “who ordered this?”.

Who ordered this? Just look at “new quine? 3”.  It displays an amazing range of outcomes. One of them is that it dies fast, but other appear rather frequently. The graph just blooms not into a living creature, more like into a whole ecology.

You can see several interesting pieces there.

There is a “growing blue tip” which keeps the graph alive.

There are “red spiders” who try to reach for the growing blue tip and eat it. But the red spiders sometimes return to the rest of the graph and rearrange it. They live and die.

There is a “blue wave” which helps the growing blue tip by fattening it.

There is a “bones structure” which appears while the red spiders try to eat the growing blue tip. It looks like the bones structure is dead, except that sometimes the red spiders travel back and modify the bones into new structures.

And there are also graphs which clearly are not quines, but they are extremely sensitive to the order of rewrites. See for example “!quine, sensitive 1”. There seems to be a boundary between the small realm of quines and the rest of the graphs. “new quine? 3” is on one side of that boundary and “!quine, sensitive 1” is on the other side.

So, play “Find the Quine” and mail me if you find something interesting!

On top of the page there is a link to my pages to play and learn. Mind that the versions of find the quine there and at github are slightly different, because I update them all the time and so they are not synchronized. I use github in order to have a copy just in case. In some places I can update the github pages, in other places I can update my homepage…



What is a chemlambda quine?

UPDATE 3: I made a landing page for my pages to play and learn.

UPDATE 2: And now there is Fractalize!

UPDATE: The most recent addition to the material mentioned in the post is Find a Quine, which let you generate random 10 nodes graphs (there are 9 billion of them) and to search for new quines. They are rare, but today I found 3 (two all of them are shown as examples).  If you find one, mail me the code (instructions on the page).


The ease of use of the recently written chemlambda.js makes easier the sharing of past ideas (from the chemlambda collection) and as well of new ideas.

Here is some material and some new thoughts. Before this, just recall that the *new* work is in hapax. See what chemlambda has to do with hapax, especially towards the end.

A video tutorial about how to use the rest of new demos.

The story of the first chemlambda quine, deduced from the predecessor of a Church number. Especially funny is that this time you are not watching an animation, it happens in front of you 🙂

More quines and random eggs, if you want to go further in the subject of chemlambda quines.  The eggs are 4-nodes graphs (there are 720 of them). They manifest an amazing variety of behaviour. I think that the most interesting is that there are quines and there are also graphs which have a reversible evolution, without being quines. Indeed, in chemlambda a quine is one which has a periodic evolution (thus is reversible) under the greedy algorithm of rewrites. But there is also the reversible, but not quine case, where you can reverse the evolution of a graph by picking a sequence of rewrites.

Finally, if you want to look also at famous animations, you have the feed the quine. This contains some quines but also some other graphs which featured in the chemlambda collection.

Most of all, come back to see more, because I’m going to update and update…

Feed the quine!

The chemlambda.js version of chemlambda-v2 made by ishanpm allows to understand how quines work in chemlambda. See this previous post about chemlambda.js.

So, now you may feed the quine.


UPDATE: Ishan made a github repository for his chemlambda.js. I suggest you follow his work if you are a chemlambda fan, there is big promise there.  The github page is live here. See if you can contribute to one of the issues at his repository, or to one of the issues at the chemlambda repository.

For me this chemlambda.js is pure gold, for many reasons: it does all the computation/visualization in one place, it may give a way to recover the work lost from the chemlambda collection, and as a work of art. Not to say that it will be certainly connected with hapax.

If you wonder why I don’t update the chemlambda repo readme with his important contribution, I refrain from touching that repository. Probably a new one which forks all the contributions in one place is better. This autumn.

I’ve also made a second page “feed the quine“, it has presently more examples  (not anymore) and it is compatible es5. Both pages change very often, so at any point one may be more advanced than the other.


Play with quines in the chemlambda editor

ishanpm made a wonderful chemlambda editor prototype and I enjoyed playing with the 9_quine. It looks like this (screencast, real speed)



You can do the same, or other stuff! You need a mol file to input, for example I took the mol file of the 9_quine from here.  You can pick from lots of them (not guaranteed all of them work yet in the editor, especially those with “bb” in the name), from the chemlambda collection of molecules.

Is much much better than the animation made by hand


I look forward for a convergence with hapax, it would be nice to make a gamelike “feed the quine” where you have the “tokens” which make the reactions happen and you feed them with the mouse to the quine, etc.

UPDATE: this time I used bigpred-train and I let it reduce automatically, gives this psihedelic


9-quine string animation

I use the chemlambda strings version to show  how the 9-quine works. [What is a quine in chemlambda? See here.]





The 9-quine is the smallest quine in chemlambda which does not have a termination node.  There exist smaller quines if the termination node is admitted. For example  the chemlambda equivalent of a quine from Interaction Combinators  which appears in Lafont’ foundational article.

As you see this version is conservative and there are no enzymes.

I shall come back with a post which explains why and how the 9-quine dies. It is of course due to the conflicts in chemlambda, see the examples from the page on chemlambda v2.

Lambda calculus inspires experiments with chemlambda

In the now deleted chemlambda collection I told several stories about how lambda calculus can bring inspiration for experiments with chemlambda. I select for this post a sequence of such experiments. For previous related posts here see this tag and this post.

Let’s go directly to the visuals.

Already in chemlambda v1 I remarked the interesting behaviour of the graph (or molecule) which is obtained from the lambda term of the predecessor applied to a Church number.  With the deterministic greedy algorithm of reductions, after the first stages of reduction there is a repeating pattern of  reduction, (almost) up to the end. The predecessor applied to the Church number molecule looks almost like a closed loop made of pairs A-FO (because that’s how a Church number appears in chemlambda), except a small region which contains the graph of the predecessor, or what it becomes after few rewrites.

In chemlambda v2 we have two kinds of fanouts: FO and FOE.  The end result of the reduction of the same molecule, under the same algorithm, is different: where in chemlambda v1 we had FO nodes (at the end of the reduction), now we have FOE nodes. Other wise there’s the same phenomenon.

Here is it, with black and white visuals


Made by recording of this live (js) demo.

1. What happens if we start not from the initial graph, but from the graph after a short number of rewrites? We have just to cut the “out” root of the initial graph, and some nodes from it’s neighbourhood and glue back, so that we obtain a repeating pattern walking on a circular train track.

Here is it, this time with the random reduction algorithm:


I previously called this graph an “ouroboros”. Or a walker.

2. That is interesting, it looks like a creature (can keep it’s “presence”) which walks in a single direction in a 1-dimensional world.  What could be the mechanism?

Penrose comes to mind, so in the next animation I also use a short demonstration from a movie by Penrose.



3. Let’s go back to the lambda calculus side and recall that the algorithm for the translation of a lambda term to a chemlambda molecule is the same as the one from GLC, i.e the one from Section 3 here. There is a freedom in this algorithm, namely that trees of FO nodes can be rewired as we wish. From one side this is normal for GLC and chemlambda v1,  which have the CO-COMM and CO-ASSOC rewrites


In chemlambda v2 we don’t have these rewrites at all, which means that in principle two diferent molecules,  obtained from the same lambda term, which differ only by the rewiring of the FO nodes may reduce differently.

In our case it would be interesting to see if the same is true for the FOE nodes as well. For example, remark that the closed loop, excepting the walker, is made by a tree of FOE nodes, a very simple one. What happens if we perturb this tree, say by permuting some of the leaves of the tree, i.e. by rewiring the connections between FOE and A nodes.


The “creature” survives and now it walks in a world which is no longer 1 dimensional.

Let’s play more: two permutations, this time let’s not glue the ends of the loop:


It looks like a signal transduction from the first glob to the second. Can we make it more visible, say by making invisible the old nodes and visible the new ones? Also let’s fade the links by making them very large and almost transparent.


Signal transduction! (recall that we don’t have a proof that indeed two molecules from the same lambda term, but with rewired FO trees reduce to the same molecule, actually this is false! and true only for a class of lambda terms. The math of this is both fascinating and somehow useless, unless we either use chemlambda in practice or we build chemlambda-like molecular computers.)

4.  Another way to rewire the tree of FOE nodes is to transform it into another tree with the same leaves.



5. Wait, if we understand how exactly this works, then we realize that we don’t really need this topology, it should also work for topologies like generalized Petersen graphs, for example for a dodecahedron.



This is a walker creature which walks in a dodecaheral “world”.

6. Can the creature eat? If we put something on it’s track, see if it eats it and if it modifies the track, while keeping it’s shape.


So the creature seems to have a metabolism.

We can use this for remodeling the world of the creature. Look what happens after many passes of the creature:



7. What if we combine the “worlds” of two creatures, identical otherwise. Will they survive the encounter, will they interact or will they pass one through the other like solitons?



Well, they survive. Why?

8. What happens if we shorten the track of the walker, as much as possible? We obtain a graph wit the following property: after one (or a finite give number of) step of the greedy deterministic algorithm we obtain an isomorphic graph. A quine! chemlambda quine.

At first, it looks that we obtained a 28 nodes quine. After some analysis we see that we can reduce this quine to a 20 nodes quine. A 20-quine.

Here is the first observation of the 20-quine under the random algorithm


According to this train of thoughts, a chemlambda quine is a graph which has a periodic evolution under the greedy deterministic algorithm, with the list of priority of rewrites set to DIST rewrites (which add nodes)  with greater priority than beta and FI-FOE rewrites (which subtract ndoes), and which does not have termination nodes (because it leads to some trivial quines).

These quines are interesting under the random reduction algorithm, which transform them into mortal living creatures with a metabolism.


So this is an example of how lambda calculus can inspire chemlambda experiments, as well as interesting mathematical questions.

Replication, 4 to 9

In the artificial chemistry chemlambda  there exist molecules which can replicate, they have a metabolism and they may even die. They are called chemlambda quines, but a convenient shorter name is: microbes.
In this video you see 4 microbes which replicate in complex ways. They are based on a simpler microbe whose life can be seen live (as a suite of d3.js animations) at [1].
The video was done by screencasting the evolution of the molecule 5_16_quine_bubbles_hyb.mol and with the script quiner_experia, all available at the chemlambda GitHub repository [2].

[1] The birth and metabolism of a chemlambda quine. (browsers recommended: safari, chrome/chromium)

[2] The chemlambda repository: github.com/chorasimilarity/chemlambda-gui/blob/gh-pages/dynamic/README.md