Reading the working string off the bag

Wolfram Institute • 2026
The sorted bag is read in pairs from the bottom: a gap of 1 is a 0, a gap of 2 a 1. Along the System 5 run the bags read back, in order, as the working strings of the doubled cyclic tag system.
The functions come from the paclet WolframInstitute/TuringMachine.

The decoder

Smith's example bag, the working string
01
doubled:
In[1]:=
System5ToCyclicTagSystem[{1,2,3,4,5,7,8,10}]
Out[1]=
{0,0,1,1}
A gap of 3 is not a bit:
In[2]:=
System5ToCyclicTagSystem[{1,4}]
Out[2]=
Missing[NotAnEncoding]

Along a run

Smith's cyclic tag system with the appendants
1
and
10
on
01
:
In[3]:=
cts=CyclicTagSystem[{{1},{1,0}},{0,1}]
Out[3]=
CyclicTagSystem

Its doubled system: every bit twice, every appendant doubled and followed by an empty one. Its run:
In[4]:=
CyclicTagSystemEvolutionPlot[CyclicTagSystem[{{1,1},{},{1,1,0,0},{}},{0,0,1,1}],12]
Out[4]=
0
0
0
1
1
1
0
1
1
2
1
1
3
1
1
1
0
0
4
1
1
0
0
5
1
0
0
1
1
6
0
0
1
1
7
0
1
1
8
1
1
9
1
1
1
10
1
1
11
1
1
1
0
0
12
1
1
0
0
The System 5 run of the encoded program:
In[5]:=
System5EvolutionPlot[CyclicTagSystemToSystem5[cts,2],1000,ImageSize->420]
Out[5]=
bag
after a pop
Its bags decoded, consecutive repeats removed:
In[6]:=
First/@Split[DeleteMissing[System5ToCyclicTagSystem/@System5Evolution[CyclicTagSystemToSystem5[cts,2],1000][[All,"Bag"]]]]
Out[6]=
{{0,0,1,1},{0,1,1},{1,1},{1,1,1,0,0},{1,1,0,0},{1,0,0,1,1},{0,0,1,1},{0,1,1},{1,1}}
The working strings of the doubled system, consecutive repeats removed; they are the same:
In[7]:=
First/@Split[CyclicTagSystemEvolution[CyclicTagSystem[{{1,1},{},{1,1,0,0},{}},{0,0,1,1}],8][[All,"Data"]]]
Out[7]=
{{0,0,1,1},{0,1,1},{1,1},{1,1,1,0,0},{1,1,0,0},{1,0,0,1,1},{0,0,1,1},{0,1,1},{1,1}}