Wolfram Research

Function Repository Resource:

TuringMachineGlocalBranchialGraph

Source Notebook

Generate a graph of branch pair ancestry for a nondeterministic Turing machine "glocal" (hybrid of global and local) multiway system

Contributed by: Jonathan Gorard

ResourceFunction["TuringMachineGlocalBranchialGraph"][rules,init,n]

generates the graph of branch pair ancestry after n steps in the glocal multiway evolution of a nondeterministic Turing machine with the specified rules, starting from initial conditions init.

ResourceFunction["TuringMachineGlocalBranchialGraph"][rulessel,init,n]

uses the function sel to select which of the events obtained at each step to include in the evolution.

Details and Options

Glocal multiway systems combine the global events (and the corresponding causal structure) of ordinary multiway systems, with the individual token philosophy of local multiway systems. A single event vertex in the evolution causal graph (or token event graph) will, in general, have many incoming and outgoing evolution edges, corresponding to the fact that several tokens must be assembled together in order to reconstruct a single global input or output state for the event.
The branchial graph for a glocal multiway system shows the branch pair (i.e. critical pair) ancestry for a glocal evolution causal graph/token event graph. Unlike the branchial graph for an ordinary (global) multiway system, which only contains information regarding the evolution ancestry of states, glocal branchial graphs contain information about both the causal ancestry of events and the evolution ancestry of states/tokens.
Argument and option patterns for ResourceFunction["TuringMachineGlocalBranchialGraph"] match those of the resource function MultiwayTuringMachine (and, to a lesser extent, the resource function MultiwaySystem).
ResourceFunction["TuringMachineGlocalBranchialGraph"] accepts both individual Turing machine rules and lists of rules, and likewise for initial conditions. ResourceFunction["TuringMachineGlocalBranchialGraph"][rules,init,n] is interpreted as ResourceFunction["TuringMachineGlocalBranchialGraph"][rules,{init},n], etc.
The event selection function sel in ResourceFunction["TuringMachineGlocalBranchialGraph"][rulessel,] can have the following special forms:
"Sequential" applies the first possible replacement (sequential substitution system)
"Random" applies a random replacement
{"Random",n} applies n randomly chosen replacements
Duplicated tokens are displayed separately at each time step by default, although this can be overridden by setting "DeduplicateTokens"True.
Events are represented in the form {rule,input,rest}, where rule is the rule used in the updating event, input is the part of the state to which the rule is applied and rest is the remainder of the state. For substitution systems, rest is given in the form {prefix,suffix}.
Options for ResourceFunction["TuringMachineGlocalBranchialGraph"] include:
"DeduplicateTokens" False whether to merge all instances of equivalent tokens that appear at each time step
"VertexRendering" True whether to use special rendering for state/token and event vertices
"IncludeInitializationEvents" False whether to include pseudoevents that set up initial conditions
"StateRenderingFunction" Automatic how to label states/tokens that appear in the evolution causal graph/token event graph
"EventRenderingFunction" Automatic how to label events that appear in the evolution causal graph/token event graph
All of the standard options for the Graph function can also be applied to ResourceFunction["TuringMachineGlocalBranchialGraph"].
Possible settings for "StateRenderingFunction" and "EventRenderingFunction" include:
Automatic make a label from the name of the vertex
Inherited use the explicit vertex name as the label
None use no label for the vertex
"string" use a shape from the VertexShapeFunction collection
func apply the function func to the name of the vertex

Examples

Basic Examples (3) 

Generate glocal branchial graphs for two simple nondeterministic Turing machine (2-state, 2-color machines) evolutions:

In[1]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, VertexSize -> 1]
Out[1]=
In[2]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506, 1506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, VertexSize -> 4]
Out[2]=

Show just the structure of the graphs, without labels:

In[3]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "VertexRendering" -> False]
Out[3]=
In[4]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506, 1506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "VertexRendering" -> False]
Out[4]=

Merge all instances of equivalent tokens that appear at each time step:

In[5]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "DeduplicateTokens" -> True, VertexSize -> 1]
Out[5]=

Run the system for more steps:

In[6]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 5, "DeduplicateTokens" -> True, VertexSize -> 2]
Out[6]=

Show just the structure of the graphs, without labels:

In[7]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "VertexRendering" -> False, "DeduplicateTokens" -> True]
Out[7]=
In[8]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 5, "VertexRendering" -> False, "DeduplicateTokens" -> True]
Out[8]=

Specify an event selection function that picks only up to two events at each step:

In[9]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506} -> (Take[#, UpTo[2]] &), {{1, 1, 0}, {0, 1, 0, 0}}, 5, VertexSize -> 0.5]
Out[9]=

Scope (5) 

Rules and Initial Conditions (2) 

TuringMachineGlocalBranchialGraph accepts both single Turing machine IDs and lists of Turing machine IDs:

In[10]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][200, {{1, 1, 0}, {0, 1, 0, 0}}, 2, VertexSize -> 0.5]
Out[10]=
In[11]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{200, 300}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, VertexSize -> 1]
Out[11]=

Simulating 3-state, 2-color machines:

In[12]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{{2139050, 3}, {2149050, 3}}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, VertexSize -> 2]
Out[12]=

TuringMachineGlocalBranchialGraph accepts both individual initial conditions and lists of initial conditions:

In[13]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, VertexSize -> 1]
Out[13]=
In[14]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{{1, 1, 0}, {0, 1, 0, 0}}, {{1, 1, 0}, {1, 0, 1, 1}}}, 3, VertexSize -> 2]
Out[14]=

Event Selection Functions (3) 

Apply only the first possible event at each step:

In[15]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506} -> "Sequential", {{1, 1, 0}, {0, 1, 0, 0}}, 5, VertexSize -> 0.5]
Out[15]=

Apply the first and last possible events at each step:

In[16]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506} -> ({First[#], Last[#]} &), {{1, 1, 0}, {0, 1, 0, 0}}, 5, VertexSize -> 0.5]
Out[16]=

Compare this to the full branchial graph for the unrestricted glocal multiway evolution:

In[17]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 5, VertexSize -> 3]
Out[17]=

Options (15) 

Token Deduplication (2) 

By default, equivalent tokens remain unmerged at each time step:

In[18]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, VertexSize -> 1]
Out[18]=

Merging of equivalent tokens at each time step can be enforced using the option "DeduplicateTokens":

In[19]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{1, 1, 0}, {0, 1, 0, 0}}, 3, "DeduplicateTokens" -> True, VertexSize -> 1]
Out[19]=

Vertex Rendering (2) 

By default, state/token vertices and event vertices use special rendering (inherited from the MultiwayTuringMachine resource function):

In[20]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{1, 1, 0}, {0, 1, 1, 0}}, 3, VertexSize -> 1]
Out[20]=

This rendering can be disabled using the option "VertexRendering":

In[21]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{1, 1, 0}, {0, 1, 1, 0}}, 3, "VertexRendering" -> False]
Out[21]=

State/Token Vertex Rendering (4) 

By default, states/tokens are labeled by their contents:

In[22]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{1, 1, 0}, {1, 1, 0, 0}}, 3, VertexSize -> 1]
Out[22]=

Use no labeling for states/tokens:

In[23]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{1, 1, 0}, {1, 1, 0, 0}}, 3, "StateRenderingFunction" -> None, VertexSize -> 1]
Out[23]=

Use raw state/token names as vertex labels:

In[24]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{1, 1, 0}, {1, 1, 0, 0}}, 3, "StateRenderingFunction" -> Inherited, VertexSize -> 1]
Out[24]=

Use a named shape as each state/token label:

In[25]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{1, 1, 0}, {1, 1, 0, 0}}, 3, "StateRenderingFunction" -> "Square", VertexSize -> 1]
Out[25]=

Event Vertex Rendering (5) 

By default, both states/tokens and events are labeled by their contents:

In[26]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{1, 1, 0}, {1, 1, 1, 0}}, 3, VertexSize -> 1]
Out[26]=

Use no labeling for states/tokens:

In[27]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{1, 1, 0}, {1, 1, 1, 0}}, 3, "StateRenderingFunction" -> None, VertexSize -> 1]
Out[27]=

Also use no labeling for events:

In[28]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{1, 1, 0}, {1, 1, 1, 0}}, 3, "StateRenderingFunction" -> None, "EventRenderingFunction" -> None]
Out[28]=

Disabling vertex rendering yields an equivalent result:

In[29]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{1, 1, 0}, {1, 1, 1, 0}}, 3, "VertexRendering" -> False]
Out[29]=

Use raw event expressions as their labels:

In[30]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{1, 1, 0}, {1, 1, 1, 0}}, 3, "StateRenderingFunction" -> None, "EventRenderingFunction" -> Inherited]
Out[30]=

Graph Layout Options (2) 

Generate an example glocal branchial graph for a multiway Turing machine evolution:

In[31]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{1, 1, 0}, {0, 1, 1, 0}}, 4, VertexSize -> 3]
Out[31]=

Force a spring embedding (as opposed to the default spring electrical embedding):

In[32]:=
ResourceFunction[
 "TuringMachineGlocalBranchialGraph"][{2506, 3506}, {{1, 1, 0}, {0, 1, 1, 0}}, 4, GraphLayout -> "SpringEmbedding", VertexSize -> 3]
Out[32]=

Resource History

Source Metadata

Related Resources

License Information