Wolfram Language Paclet Repository
Community-contributed installable additions to the Wolfram Language
Tools for exploring and analyzing Turing machines
Contributed by: Nik Murzin and Willem Nielsen
The paclet identifies a Turing machine by its enumeration number and its {s, k} state/color counts. OneSidedTuringMachineFunction runs a one-sided machine on an integer input and returns its halting value, step count, or tape width; OneSidedTuringMachinePlot draws the space-time evolution; and OneSidedTuringMachineFind searches for machines reproducing given outputs. The MultiwayTuringMachineFunction family explores nondeterministic (multiway) machines, while TuringMachineRuleCount and the TuringMachineOutput primitives tabulate behavior across whole rule spaces.
To install this paclet in your Wolfram Language environment,
evaluate this code:
PacletInstall["WolframInstitute/TuringMachine"]
To load the code after installation, evaluate this code:
Needs["WolframInstitute`TuringMachine`"]
Run the one-sided Turing machine defined by the s=3, k=2 rule 600720 on input 1 for at most 32 steps:
| In[1]:= |
| Out[1]= |
Return the number of steps the machine took to terminate:
| In[2]:= |
| Out[2]= |
Return the maximum width the head spanned on the tape:
| In[3]:= |
| Out[3]= |
Return the steps, value, and width together:
| In[4]:= |
| Out[4]= |
Plot the space-time evolution of the machine on input 1:
| In[5]:= |
| Out[5]= |
Evaluate a whole family of machines at once — every s=1, k=2 one-sided machine on inputs 1 through 8, each for up to 32 steps:
| In[6]:= |
| Out[6]= | ![]() |
Count how many distinct Turing machine rules exist for a given number of states and colors:
| In[7]:= |
| Out[7]= |
Split a long evolution into several columns with the "Columns" option:
| In[8]:= |
| Out[8]= | ![]() |
Suppress the output label to show the bare space-time pattern:
| In[9]:= |
| Out[9]= | ![]() |
Search the 2-state, 2-color rule space for the machines that reproduce a target behavior, given as {input, steps, value} triples:
| In[10]:= |
| Out[10]= |
Compare how a single machine transforms several different inputs:
| In[11]:= | ![]() |
| Out[11]= | ![]() |
The All property is exactly the "Steps", "Value", and "Width" properties assembled into a triple:
| In[12]:= | ![]() |
| Out[12]= |
The number of rows tabulated by the rule-space functions equals TuringMachineRuleCount:
| In[13]:= |
| Out[13]= |
A machine that does not halt within maxSteps reports Undefined for its value:
| In[14]:= |
| Out[14]= |
With the All property the unresolved parts come back as Infinity:
| In[15]:= |
| Out[15]= |
The space-time patterns of three different 2-state, 2-color machines on the same input 1, halting at values 3, 2, and 7:
| In[16]:= | ![]() |
| Out[16]= | ![]() |
Wolfram Language Version 14.3