Function Repository Resource:

ComputationalSystemRules

Source Notebook

Find explicit sets of rules for computational systems

Contributed by: Wolfram Staff

ResourceFunction["ComputationalSystemRules"][sys]

returns an explicit set of rules for the computational system sys.

Details and Options

ResourceFunction["ComputationalSystemRules"] gives rules for most of the computational systems acceptable to RulePlot.
Possible systems sys include:
CellularAutomaton[spec]cellular automaton
TuringMachine[spec]Turing machine
SubstitutionSystem[spec]substitution system
BooleanFunction[spec]Boolean function
ResourceFunction["ComputationalSystemRules"] works with 1D and 2D systems.
Cases not supported in ResourceFunction["ComputationalSystemRules"] include totalistic cellular automata.

Examples

Basic Examples (4) 

Get the explicit set of rules for a cellular automaton:

In[1]:=
ResourceFunction["ComputationalSystemRules"][CellularAutomaton[30]]
Out[1]=

Evolution of the system specified by the explicit rules:

In[2]:=
ArrayPlot[CellularAutomaton[%, {{1}, 0}, 20]]
Out[2]=

Compare with the canonical representation of the same system:

In[3]:=
ArrayPlot[CellularAutomaton[30, {{1}, 0}, 20]]
Out[3]=

Explicit rules for a Turing machine:

In[4]:=
rules = ResourceFunction["ComputationalSystemRules"][
  TuringMachine[2506]]
Out[4]=

Both representations yield the same evolution:

In[5]:=
ArrayPlot[Last /@ TuringMachine[#, {1, {{}, 0}}, 30]] & /@ {2506, %}
Out[5]=

Boolean function in two variables:

In[6]:=
rules = ResourceFunction["ComputationalSystemRules"][
  BooleanFunction[8, 2]]
Out[6]=
In[7]:=
RulePlot[BooleanFunction[rules]]
Out[7]=

String substitution system:

In[8]:=
srules = {"A" -> "AB", "B" -> "A"};
In[9]:=
rules = ResourceFunction["ComputationalSystemRules"][
  SubstitutionSystem[srules]]
Out[9]=

An evolution step:

In[10]:=
SubstitutionSystem[srules, "A", {5}]
Out[10]=
In[11]:=
SubstitutionSystem[rules, {0}, {5}]
Out[11]=
In[12]:=
StringJoin[% /. {0 -> "A", 1 -> "B"}]
Out[12]=

Scope (6) 

CellularAutomaton (4) 

Various forms of cellular automata, including elementary rules:

In[13]:=
ResourceFunction["ComputationalSystemRules"][CellularAutomaton[90]]
Out[13]=

Multi-color rules:

In[14]:=
ResourceFunction["ComputationalSystemRules"][
 CellularAutomaton[{679458, 3}]]
Out[14]=

Neighborhood rules:

In[15]:=
ResourceFunction["ComputationalSystemRules"][
 CellularAutomaton[{23898, 2, 3/2}]]
Out[15]=

Rules specified using an association:

In[16]:=
ResourceFunction["ComputationalSystemRules"][
 CellularAutomaton[<|"RuleNumber" -> 30|>]]
Out[16]=
In[17]:=
ResourceFunction["ComputationalSystemRules"][
 CellularAutomaton[<|"RuleNumber" -> 23898, "Range" -> 3/2|>]]
Out[17]=

TuringMachine (2) 

Turing machine rule 2506:

In[18]:=
ResourceFunction["ComputationalSystemRules"][TuringMachine[2506]]
Out[18]=

Turing machine with more than two colors:

In[19]:=
ResourceFunction["ComputationalSystemRules"][
 TuringMachine[{596440, 2, 3}]]
Out[19]=
In[20]:=
ResourceFunction["ComputationalSystemRules"][
 TuringMachine[{{1, 2} -> {1, 1, -1}, {1, 1} -> {1, 2, -1}, {1, 0} -> {2, 1, 1}, {2, 2} -> {1, 0, 1}, {2, 1} -> {2, 2, 1}, {2, 0} -> {1, 2, -1}}]]
Out[20]=

Possible Issues (2) 

ComputationalSystemRules does not parse system specifications beyond those acceptable to RulePlot:

In[21]:=
rule = {977401, 2, 2, {1, 1}};
In[22]:=
ResourceFunction["ComputationalSystemRules"][TuringMachine[rule]]
Out[22]=
In[23]:=
RulePlot[TuringMachine[rule]]
Out[23]=

Use a system that can be handled by RulePlot:

In[24]:=
rule = {596440, 2, 4};
In[25]:=
ResourceFunction["ComputationalSystemRules"][TuringMachine[rule]]
Out[25]=
In[26]:=
RulePlot[TuringMachine[rule]]
Out[26]=

ComputationalSystemRules does not handle totalistic cellular automata:

In[27]:=
ResourceFunction["ComputationalSystemRules"][
 CellularAutomaton[{30, {2, 1}, 2}]]
Out[27]=

Version History

  • 1.0.0 – 06 July 2020

Related Resources

Author Notes

ComputationalSystemRules plugs in internal code of RulePlot and depends on the current forms two private functions RPRuleMaker (for Turing machines) and RPRuleMaker1 (for all other systems). This is fragile, of course. In the future, ComputationalSystemRules and RulePlot should better share the code in a more civilized fashion.

License Information