Function Repository Resource:

TagSystemEvolveList

Source Notebook

Generate the evolution of a tag system

Contributed by: Wolfram Research

ResourceFunction["TagSystemEvolveList"][rules,init,t]

returns the list of states attained from evolving init using tag system rules over t steps.

ResourceFunction["TagSystemEvolveList"][rules,init,t,dt]

returns the states attained at every dt step from evolving init using tag system rules over t steps.

ResourceFunction["TagSystemEvolveList"][rules,init,t,dt,prop]

returns the specified prop of states attained at every dt step from evolving init using tag system rules over t steps.

ResourceFunction["TagSystemEvolveList"][rules,init,Automatic, ]

returns the sequence attained from evolving init using tag system rules for up to the number of steps specified by the option MaxSteps.

Details and Options

In a step of evolution of a tag system, a fixed number of elements is deleted from the beginning of the tape. Rules are applied based on the first element that was deleted, as well as specifying a block of digits that should be added to the end of the tape.
The argument rules should be given as a list of Rule or RuleDelayed elements, such as in the format {{0,_,s___}{s,0,0},{1,0,s___}{s,1},{1,1,s___}{s,0,1}}. Blank elements are used to represent tape elements that do not matter for choosing the block to be added to the end of the tape.
As a special case, the Post tag system can be specified by setting the argument rules to "Post". This is equivalent to giving rules as {{0,_,_,s___}{s,0,0},{1,_,_,s___} {s,1,1,0,1}}.
The argument init can be given either in compressed form (a list of digits such as {1,0,1,0,0,1,1}), or in uncompressed form (a list where the first element is a digit and the second element is a list of digits, such as {1,{1,0,1}}). The resource function TagSystemConvert can be used to interconvert between these forms.
The arguments t and dt should be given as integers.
ResourceFunction["TagSystemEvolveList"] accepts two possible strings in the argument prop:
"States"the list of tape configurations throughout the tag system evolution
"Lengths"the list of tape lengths throughout the tag system evolution
ResourceFunction["TagSystemEvolveList"] accepts two options:
MaxStepsInfinitythe maximum number of steps to be taken in the tag system evolution
MethodAutomaticthe algorithm used internally to compute the tag system evolution
If no value is specified for the MaxSteps option, ResourceFunction["TagSystemEvolveList"][rules,init,Automatic,] will attempt to perform a fixed point evolution, which takes the system to the state at which it halts.
If no value is specified for the Method option, then the tag system evolution will be performed using functional iteration in the Wolfram Language. Alternatively, there is a "BitwiseOptimized" method, which can only be used when rules is given as "Post", that uses a faster algorithm written in C++.

Examples

Basic Examples (2) 

Evolve the Post tag system from an initial condition for 8 steps:

In[1]:=
ResourceFunction[
 "TagSystemEvolveList"][{{0, _, _, s___} :> {s, 0, 0}, {1, _, _, s___} :>  {s, 1, 1, 0, 1}}, {0, 1, 0, 0, 1, 0, 1, 0, 0}, 8]
Out[1]=

Evolve the Post tag system from an initial condition for 8 steps, using the string shortcut "Post" to specify the tag system rules:

In[2]:=
ResourceFunction[
 "TagSystemEvolveList"]["Post", {0, 1, 0, 0, 1, 0, 1, 0, 0}, 8]
Out[2]=

Evolve the Post tag system from the same initial condition specified in compressed form, for 8 steps:

In[3]:=
ResourceFunction["TagSystemEvolveList"]["Post", {0, {0, 0, 1}}, 8]
Out[3]=

Evolve the Post tag system until it halts, using the Automatic setting for evolution steps:

In[4]:=
ResourceFunction[
 "TagSystemEvolveList"]["Post", {0, 1, 0, 0, 1, 0, 1, 0, 0}, Automatic]
Out[4]=

Evolve the Post tag system using compressed states until it halts:

In[5]:=
ResourceFunction[
 "TagSystemEvolveList"]["Post", {0, {0, 0, 1}}, Automatic]
Out[5]=

Scope (7) 

Perform a fixed point evolution of a Post tag system, only returning every second tape state:

In[6]:=
ResourceFunction[
 "TagSystemEvolveList"]["Post", {0, 1, 0, 0, 1, 0, 1, 0, 0}, Automatic, 2]
Out[6]=
In[7]:=
ResourceFunction[
 "TagSystemEvolveList"]["Post", {0, {0, 0, 1}}, Automatic, 2]
Out[7]=

Perform a fixed point evolution of a Post tag system, only returning every second tape length:

In[8]:=
ResourceFunction[
 "TagSystemEvolveList"]["Post", {0, 1, 0, 0, 1, 0, 1, 0, 0}, Automatic, 2, "Lengths"]
Out[8]=

Do the same computation, except with a compressed initial condition; note that the compressed tape lengths are returned:

In[9]:=
ResourceFunction[
 "TagSystemEvolveList"]["Post", {0, {0, 0, 1}}, Automatic, 2, "Lengths"]
Out[9]=

Perform a tag system evolution with specified rules, initial condition, and number of evolution steps:

In[10]:=
ResourceFunction[
 "TagSystemEvolveList"][{{0, _, s___} :> {s, 1}, {1, _, s___} :> {s, 1, 1, 0}}, {1, 0, 1, 1, 0, 0}, 20]
Out[10]=

Perform the same evolution, except in compressed form:

In[11]:=
ResourceFunction[
 "TagSystemEvolveList"][{{0, _, s___} :> {s, 1}, {1, _, s___} :> {s, 1, 1, 0}}, {0, {1, 1, 0}}, 20]
Out[11]=

Return every fifth tape state of a specified tag system evolution:

In[12]:=
ResourceFunction[
 "TagSystemEvolveList"][{{0, _, s___} :> {s, 1}, {1, _, s___} :> {s, 1, 1, 0}}, {1, 0, 1, 1, 0, 0}, 20, 5]
Out[12]=
In[13]:=
ResourceFunction[
 "TagSystemEvolveList"][{{0, _, s___} :> {s, 1}, {1, _, s___} :> {s, 1, 1, 0}}, {0, {1, 1, 0}}, 20, 5]
Out[13]=

Return every fifth tape length of a specified tag system evolution:

In[14]:=
ResourceFunction[
 "TagSystemEvolveList"][{{0, _, s___} :> {s, 1}, {1, _, s___} :> {s, 1, 1, 0}}, {1, 0, 1, 1, 0, 0}, 20, 5, "Lengths"]
Out[14]=

Return every fifth compressed tape length of a specified tag system evolution:

In[15]:=
ResourceFunction[
 "TagSystemEvolveList"][{{0, _, s___} :> {s, 1}, {1, _, s___} :> {s, 1, 1, 0}}, {0, {1, 1, 0}}, 20, 5, "Lengths"]
Out[15]=

Perform a generalized tag system evolution in which the rules do not use Blank elements:

In[16]:=
ResourceFunction[
 "TagSystemEvolveList"][{{0, 0, s___} :> {s, 0}, {1, 0, s___} :> {s, 1, 0, 1}, {0, 1, s___} :> {s, 0, 0, 0}, {1, 1, s___} :> {s, 0, 1, 1}}, {1, 0, 0, 1}, 20]
Out[16]=

Return only every fifth tape state from the generalized tag system evolution:

In[17]:=
ResourceFunction[
 "TagSystemEvolveList"][{{0, 0, s___} :> {s, 0}, {1, 0, s___} :> {s, 1, 0, 1}, {0, 1, s___} :> {s, 0, 0, 0}, {1, 1, s___} :> {s, 0, 1, 1}}, {1, 0, 0, 1}, 20, 5]
Out[17]=

Return every fifth tape length from the generalized tag system evolution:

In[18]:=
ResourceFunction[
 "TagSystemEvolveList"][{{0, 0, s___} :> {s, 0}, {1, 0, s___} :> {s, 1, 0, 1}, {0, 1, s___} :> {s, 0, 0, 0}, {1, 1, s___} :> {s, 0, 1, 1}}, {1, 0, 0, 1}, 20, 5, "Lengths"]
Out[18]=

Visualize the successive tape states in the evolution of a tag system:

In[19]:=
ArrayPlot[
 PadRight[ResourceFunction[
   "TagSystemEvolveList"][{{0, _, s___} :> {s, 1}, {1, _, s___} :> {s, 1, 1, 0}}, {1, 0, 1, 1, 0, 0}, 125], Automatic, 0.25]]
Out[19]=

Plot how tape length changes across the evolution of the same cyclic tag system:

In[20]:=
ListStepPlot[
 ResourceFunction[
  "TagSystemEvolveList"][{{0, _, s___} :> {s, 1}, {1, _, s___} :> {s, 1, 1, 0}}, {1, 0, 1, 1, 0, 0}, 125, 1, "Lengths"], Filling -> Axis]
Out[20]=

Options (2) 

MaxSteps (1) 

It may not always be feasible to evolve the tag system indefinitely when using the Automatic evolution step setting. Setting the MaxSteps option can prevent computationally expensive fixed point evolutions:

In[21]:=
ResourceFunction[
 "TagSystemEvolveList"][{{0, _, s___} :> {s, 1}, {1, _, s___} :> {s, 1, 1, 0}}, {0, {1, 1, 0}}, Automatic, MaxSteps -> 500]
Out[21]=

Method (1) 

An example demonstrating the superior time efficiency of the "BitwiseOptimized" method for long evolutions:

In[22]:=
First[Timing[
  ResourceFunction["TagSystemEvolveList"][
   "Post", {0, {0, 1, 1, 0, 0}}, Automatic, MaxSteps -> 100000]]]
Out[22]=
In[23]:=
First[Timing[
  ResourceFunction["TagSystemEvolveList"][
   "Post", {0, {0, 1, 1, 0, 0}}, Automatic, MaxSteps -> 100000, Method -> "BitwiseOptimized"]]]
Out[23]=

Properties and Relations (2) 

The resource function TagSystemConvert can be used to interconvert between compressed and uncompressed forms:

In[24]:=
ResourceFunction["TagSystemConvert"] /@ ResourceFunction["TagSystemEvolveList"][
  "Post", {0, 1, 0, 0, 1, 0, 1, 0, 0}, 8]
Out[24]=

Compare with directly generating the compressed form:

In[25]:=
ResourceFunction["TagSystemEvolveList"]["Post", ResourceFunction["TagSystemConvert"][{0, 1, 0, 0, 1, 0, 1, 0, 0}], 8]
Out[25]=

Possible Issues (5) 

Note that if the number of evolution steps specified is longer than the evolution to the fixed point of the tag system, only the states up to and including the fixed point will be returned:

In[26]:=
ResourceFunction[
 "TagSystemEvolveList"]["Post", {0, 1, 0, 0, 1, 0, 1, 0, 0}, 10]
Out[26]=
In[27]:=
ResourceFunction["TagSystemEvolveList"]["Post", {0, {0, 0, 1}}, 10]
Out[27]=

Compressed state representations do not make sense with generalized tag systems, as they require successive tape elements to be specified in order to be evolved correctly:

In[28]:=
ResourceFunction[
 "TagSystemEvolveList"][{{0, 0, s___} :> {s, 0}, {1, 0, s___} :> {s, 1, 0, 1}, {0, 1, s___} :> {s, 0, 0, 0}, {1, 1, s___} :> {s, 0, 1, 1}}, {0, {1, 0}}, 20]
Out[28]=

Tag system rules must have the head Rule or RuleDelayed:

In[29]:=
ResourceFunction[
 "TagSystemEvolveList"][{Rule[{0, _, s___}, {s, 1}], Rule[{1, _, s___}, {s, 1, 1, 0}]}, {0, {1, 1, 0}}, 5]
Out[29]=
In[30]:=
ResourceFunction[
 "TagSystemEvolveList"][{RuleDelayed[{0, _, s___}, {s, 1}], RuleDelayed[{1, _, s___}, {s, 1, 1, 0}]}, {0, {1, 1, 0}}, 5]
Out[30]=
In[31]:=
ResourceFunction[
 "TagSystemEvolveList"][{List[{0, _, s___}, {s, 1}], List[{1, _, s___}, {s, 1, 1, 0}]}, {0, {1, 1, 0}}, 5]
Out[31]=

The specified rules must reflect how a tag system actually works; in this case, elements should not be added to the beginning of the tape:

In[32]:=
ResourceFunction[
 "TagSystemEvolveList"][{{0, _, s___} :> {0, s, 1}, {1, _, s___} :> {1, s, 1, 1, 0}}, {0, {1, 1, 0}}, 5]
Out[32]=

TagSystemEvolveList does not support tag systems in which the number of elements to be deleted from the beginning of the tape is not consistent across rules:

In[33]:=
ResourceFunction[
 "TagSystemEvolveList"][{{0, s___} :> {s, 1}, {1, _, s___} :> {s, 1, 1, 0}}, {0, {1, 1, 0}}, 5]
Out[33]=

Version History

  • 1.1.1 – 12 April 2021
  • 1.1.0 – 16 March 2021
  • 1.0.0 – 15 March 2021

Related Resources

License Information