The Kolakoski particle

by Jose Manuel Rodriguez Caballero

Run-length encoding

The anti run-length encoding AntiRLE[w, s] of a word w generated from the alphabet {1, 2}, are the two functions whose run-length encoding are w. These functions can be characterized by the first characters of the output, which is represented by s.
AntiRLE[w_,s_]:=If[w=="","", ​​If[​​StringTake[w,1]=="1",StringJoin[s,AntiRLE[StringTake[w,{2,-1}] ,If[s=="1","2","1"]]],​​StringJoin[s,StringJoin[s,AntiRLE[StringTake[w,{2,-1}] ,If[s=="1","2","1"]]]]​​]];
Given two words w and p from the alphabet {1, 2}, and a positive integer k, the value of F[w, p, k] is a multiway system, beginning by w, where the rules are the anti run-length encodings. The vertices in which the word p is a factor are colored in red. The other vertices are colored in blue.
In[]:=
rules = {AntiRLE[#,"1"],AntiRLE[#,"2"]} &;
F[w_,p_,k_]:=Block[{G = ResourceFunction["MultiwaySystem"][<|"StateEvolutionFunction"(rules[#]&),​​"StateEquivalenceFunction"SameQ, "StateEventFunction"Identity,​​"EventDecompositionFunction"Identity,"EventApplicationFunction"Identity,​​"SystemType""None","EventSelectionFunction"Identity|>,{w},k,"StatesGraphStructure"]},​​GraphPlot[EdgeList[G], VertexStyleFlatten[{#If[StringContainsQ[#,p],Red,Blue]}&/@VertexList[G]]]]

Kolakoski particle

The Kolakoski sequence is the unique infinite sequence in the alphabet {1, 2}, beginning by 1, for which the run-length encoding of any prefix is again a prefix of the sequence.
Prefix of the infinite Kolakoski sequence.
K=StringJoin[IntegerString[#,10]&/@{1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 2, 1, 1, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 1, 2, 1, 2, 2, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 2}]
Out[]=
122112122122112112212112122112112122122112122121121122122112122122112112122121122122112122122112112212112122
The prefixes of the Kolakoski sequence behave as a particle with respect to the anti run-length encodings.
In[]:=
AntiRLE[K,"1"]
Out[]=
1221121221221121122121121221121121221221121221211211221221121221221121121221211221221121221221121122121121221221121121221121122121121122122112122121122122121121122
In[]:=
AntiRLE[K,"2"]
Out[]=
2112212112112212211212212112212212112112212112122122112112212112112212212112122112112212112112212211212212112112212212112212211212212211211221211212211211212212211
We interpret the evolution of the Kolakoski particle as the sequence of prefixes of the Kolakoski sequence.

Time with respect to the Kolakoski particle

In the Wolfram Model, time is given by the steps in the computations. We will call this time, the absolute time. In this section we introduce another notion of time, that we call relational time with respect to a particle.
Given a vertex x, its absolute time is the number of interations of the rules in order to generate it in the multiway system. Nevertheless, the relational time of x with respect to the Kolakoski particle is the length of the largest prefix of the infinite Kolakoski sequence that is contained in the label of the vertex as a factor.
Any branch of the multiway evolution is experienced as a history of the Kolakoski particle. The time that the inhabitants of this branch can measure in physics is the relational time with respect to the Kolakoski particle.
In red are represented the vertices having relational time at lest 11 with respect to the Kolakoski particle.
In[]:=
F["2",StringTake[K,11],12]
Out[]=
In red are represented the vertices having relational time at lest 20 with respect to the Kolakoski particle.
In[]:=
F["2",StringTake[K,20],12]
Despite the fact that there are several branches in the multiway evolution, there is essentially one causal history concerning the evolution of the Kolakoski particle: the sequence of prefixes converges to the infinite sequence. Because the Kolakoski sequence is aperiodic, there is an arrow of time.