Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

TuringMachine

Guides

  • TuringMachine

Tech Notes

  • Exploring One-Sided Turing Machines

Symbols

  • MultiwayNonHaltedStatesLeft
  • MultiwayTuringMachineFunction
  • MultiwayTuringMachinePlot
  • MultiwayTuringMachineRules
  • NonTerminatingTuringMachineQ
  • OneSidedTuringMachineEvolution
  • OneSidedTuringMachineFind
  • OneSidedTuringMachineFunction
  • OneSidedTuringMachineFunctionPlot
  • OneSidedTuringMachinePlot
  • OneSidedTuringMachineRuntimePlot
  • TuringMachineOutput
  • TuringMachineOutputWithStepsFloat
  • TuringMachineOutputWithSteps
  • TuringMachineOutputWithStepsWidthsFloat
  • TuringMachineOutputWithStepsWidths
  • TuringMachineRuleCases
  • TuringMachineRuleCount
  • TuringMachineSteps
  • TuringMachineStepsWidths
  • TuringMachineWidths
  • TuringMachineWorstCasePlot
  • $PvsNPStyles

Overviews

  • TuringMachine
Exploring One-Sided Turing Machines
A one-sided Turing machine reads a non-negative integer off a tape that is infinite in one direction, runs until it halts, and leaves an integer behind as its output. Because every such machine is finite, the whole space of machines with a given number of states and colors can be enumerated and indexed by a single number — the convention used throughout A New Kind of Science. This paclet takes that index, written
{number,s,k}
, as its basic description of a machine and builds the rest of its tools on top of it.
Specifying and running a machine
A machine is
{number,s,k}
: its enumeration number, its number of states s, and its number of colors k.
OneSidedTuringMachineFunction
runs one for at most a given number of steps and returns the integer value left on the tape.
Run the s=3, k=2 rule 600720 on input 1 for at most 32 steps:
In[1]:=
OneSidedTuringMachineFunction
[{600720,3,2},1,32]
Out[1]=
7
Steps, width, and everything at once
A fourth argument selects a property instead of the value.
"Steps"
is how many steps the machine ran before halting:
In[2]:=
OneSidedTuringMachineFunction
[{600720,3,2},1,32,"Steps"]
Out[2]=
5
"Width"
is the largest extent of tape the head ever visited:
In[3]:=
OneSidedTuringMachineFunction
[{600720,3,2},1,32,"Width"]
Out[3]=
3
All
returns the
{steps,value,width}
triple together:
In[4]:=
OneSidedTuringMachineFunction
[{600720,3,2},1,32,All]
Out[4]=
{5,7,3}
A machine that has not halted by
maxSteps
reports
Infinity
/
Undefined
for the parts that could not be resolved, so these properties double as a halting test.
Visualizing the evolution
OneSidedTuringMachinePlot
draws the space-time history — one row per step, with tape cells colored by their symbol value and the head marked in black (its orientation showing the machine's state):
In[5]:=
OneSidedTuringMachinePlot
[{600720,3,2},1,16]
Out[5]=
7
Scanning a family of machines at once
Replacing the rule number with
All
evaluates an entire family. Here every s=1, k=2 machine is run on inputs 1 through 8, giving a rule-by-input matrix of outputs (
Undefined
where a machine did not halt):
In[6]:=
OneSidedTuringMachineFunction
[{All,1,2},{1,8},32]
Out[6]=
{{Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined},{0,2,0,4,4,6,0,8},{Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined},{3,3,7,5,7,7,15,9},{0,Undefined,2,Undefined,4,Undefined,6,Undefined},{0,2,2,4,4,6,6,8},{0,0,2,0,4,4,6,0},{0,3,2,5,4,7,6,9},{Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined},{Undefined,2,Undefined,4,Undefined,6,Undefined,8},{Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined},{Undefined,3,Undefined,5,Undefined,7,Undefined,9},{1,Undefined,3,Undefined,5,Undefined,7,Undefined},{1,2,3,4,5,6,7,8},{1,3,3,7,5,7,7,15},{1,3,3,5,5,7,7,9}}
The number of machines in a family is
TuringMachineRuleCount
:
In[7]:=
TuringMachineRuleCount
[2,2]
Out[7]=
4096
Finding rules with a given behavior
The inverse question — which machines reproduce a given behavior — is
OneSidedTuringMachineFind
. Given a list of
{input,steps,value}
triples it returns every rule of the requested
{s,k}
family that matches. Rule 1500's own
{2,2}
family contains it, of course, alongside other rules with the same first two outputs:
In[8]:=
MemberQ
OneSidedTuringMachineFind
[{{1,3,3},{2,1,3}},{2,2}],1500
Out[8]=
True
Nondeterministic machines
When a
{state,color}
pair is allowed several transitions, the machine becomes multiway: it branches into many possible histories.
MultiwayTuringMachineRules
shows the transition table, where the ambiguous cell carries more than one triple:
In[9]:=
MultiwayTuringMachineRules
[{12,13},2,2]
Out[9]=
{{1,0}{{1,0,-1}},{1,1}{{1,0,-1}},{2,0}{{2,0,-1},{2,0,1}},{2,1}{{1,0,1}}}
From there
MultiwayTuringMachineFunction
collects every tape value reachable from a halted branch,
MultiwayNonHaltedStatesLeft
counts the branches still waiting to be explored, and
NonTerminatingTuringMachineQ
tests whether the machine falls into a cycle. Together with the rule-space tabulators (
TuringMachineOutput
,
TuringMachineSteps
,
TuringMachineWidths
, and their combined variants) these cover the everyday loop of enumerating machines, running them, and measuring how they behave.
RelatedGuides
▪
TuringMachine
""

© 2026 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com