How System 5 becomes System 4

Wolfram Institute • 2026
The bag becomes the first set of the tape, each bag element e as the integer 2e - 2, followed by f star and empty-set pairs. Each System 5 rule becomes a block of 8f elements further right. The head sweeps back and forth; each sweep decrements the sets it passes, which is how the bag counts down, and a 0 reached in the leading sets brings the next rule block into play.
The functions come from the paclet WolframInstitute/TuringMachine.

The encoding

A System 5 program with a bag and two rules:
In[1]:=
program=System5[{1,3},{{1},{}}]
Out[1]=
System5

Its System 4 tape with the parameter
f=1
:
In[2]:=
System5ToSystem4[program,1]["Elements"]
Out[2]=
{{4,0},*,{},*,{6,0,1,2,3},*,{},*,{},*,{0,1,2,3},*,{0,1,2,3},*,{},*,{},*,{0,1,2,3}}
The first set holds
2e-2
for every bag element
e
: here
0
and
4
. Then come
f
pairs of a star and an empty set. Each rule becomes a block of
8f
elements: a star, the rule's set (all integers from 0 to
3f
, with
2k+f+3
toggled for each rule entry
k
),
2f
star and empty-set pairs, a star, the set of all integers from 0 to
3f
, and
2f-2
more pairs. The tape has
1+2f+8fr
elements for
r
rules:
In[3]:=
Table[Length[System5ToSystem4[program,f]["Elements"]],{f,1,4}]
Out[3]=
{19,37,55,73}

The run

The run of the tape, every element labeled for the first 30 steps:
In[4]:=
System4EvolutionPlot[System5ToSystem4[program,1],30]
Out[4]=
0
{4,0}
★
{}
★
{6,0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
1
{4,0}
★
{}
★
{6,0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
2
{3}
★
{}
★
{6,0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
3
{3}
★
{1}
★
{6,0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
4
{3}
★
{0}
★
{6,0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
5
{3}
★
{0}
★
{6,0,2,3}
★
{}
★
{}
★
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
6
{3}
★
{0}
★
{5,1,2}
★
{}
★
{}
★
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
7
{3}
★
{0}
★
{5,1,2}
{}
★
{}
★
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
8
{3}
★
{0}
★
{5,1,2}
{}
★
{}
★
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
9
{3}
★
{0}
{5,1,2}
{}
★
{}
★
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
10
{3}
★
{0}
{4,0,1}
{}
★
{}
★
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
11
{3}
★
{0}
{4,0,1}
{}
★
{}
★
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
12
{3}
★
{0}
{4,0,1}
{}
{}
★
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
13
{3}
★
{0}
{4,0,1}
{}
{}
★
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
14
{3}
★
{0}
{4,0,1}
{}
{}
★
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
15
{3}
★
{0}
{4,0,1}
{}
{}
★
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
16
{3}
{0}
{4,0,1}
{}
{}
★
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
17
{3}
{}
{4,0,1}
{}
{}
★
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
18
{3}
{}
{3,0}
{}
{}
★
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
19
{3}
{}
{3,0}
{}
{}
★
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
20
{3}
{}
{3,0}
{}
{}
★
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
21
{3}
{}
{3,0}
{}
{}
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
22
{3}
{}
{3,0}
{}
{}
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
23
{3}
{}
{3,0}
{}
{}
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
24
{3}
{}
{3,0}
{}
{}
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
25
{3}
{}
{3,0}
{}
{}
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
26
{3}
{}
{3,0}
{}
{}
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
27
{2}
{}
{3,0}
{}
{}
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
28
{2}
{}
{3,0}
{}
{}
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
29
{2}
{}
{2}
{}
{}
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
30
{2}
{}
{2}
{}
{}
{0,1,2,3}
★
{0,1,2,3}
★
{}
★
{}
★
{0,1,2,3}
The head sweeps right from the left end, decrementing every set it passes. A set holding 0 switches the state between B and C; in state B the next star is deleted and the head walks back to the left end, in state C the head steps over the star and toggles 1 in the set after it. So the sets count down sweep by sweep while the stars are used up, and the switches to C carry the rule blocks' integers into the sets they reach. The whole run:
In[5]:=
System4EvolutionPlot[System5ToSystem4[program,1],200,ImageSize->420]
Out[5]=

Why f matters

The stars and empty sets are time: every sweep uses one of them up. With too small an
f
the tape runs out of them before the System 5 run is over and the emulation breaks down; the proof takes
f
above twice the length of the System 5 run (see the companion notebook on reading the bag off System 4).