Function Repository Resource:

MultiwayOperatorSystem

Source Notebook

Simulate the evaluation of a formal operator expression as a multiway system

Contributed by: Jonathan Gorard

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

generates the results of n steps in the multiway evaluation of a formal operator expression with the specified rules, starting from initial conditions init.

ResourceFunction["MultiwayOperatorSystem"][rules,init,n,"prop"]

gives the property "prop" for the specified multiway operator expression evaluation.

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

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

Details and Options

Argument and option patterns for ResourceFunction["MultiwayOperatorSystem"] match those of the resource function MultiwaySystem.
Rule and state specifications for ResourceFunction["MultiwayOperatorSystem"] are operator rules and operator expressions.
The event selection function sel in ResourceFunction["MultiwayOperatorSystem"][rulessel,] can be any function. Additionally, it can have the following forms:
"Sequential"applies the first possible replacement (sequential substitution system)
"Random"applies a random replacement
{"Random",n}applies n randomly chosen replacements
ResourceFunction["MultiwayOperatorSystem"][rules,init] is interpreted as ResourceFunction["MultiwayOperatorSystem"][rules,{init}].
In ResourceFunction["MultiwayOperatorSystem"][rules,init,n,"prop"], the following properties can be requested:
"AllStatesList"the list of states generated at each successive step (default)
"StatesCountsList"the number of distinct states generated at each successive step
"AllStatesListUnmerged"the list of all states without any merging
"PredecessorRulesList"the list of states and their corresponding predecessor states at each successive step
"EvolutionGraph"graph formed by the evolution process, with no merging between different time steps
"EvolutionGraphStructure"evolution graph without labeling
"EvolutionGraphFull"graph formed by the evolution process, including equivalent events
"EvolutionGraphFullStructure"full evolution graph without labeling
"EvolutionGraphUnmerged"graph formed by the evolution process, with no merging of equivalent states
"EvolutionGraphUnmergedStructure"unmerged evolution graph without labeling
"EvolutionGraphWeighted"graph formed by the evolution process, with edges weighted by event multiplicity
"EvolutionGraphWeightedStructure"weighted evolution graph without labeling
"StatesGraph"graph of how each distinct state leads to other states
"StatesGraphStructure"states graph without labeling
"AllEventsList"the list of all events that occur at each successive step
"EvolutionEventsGraph"graph showing the evolution process with updating events explicitly included
"EvolutionEventsGraphStructure"evolution events graph without labeling
"CausalGraph"graph of all causal relations between updating events
"CausalGraphStructure"causal graph without labeling
"EvolutionCausalGraph"combined graph of evolution process and causal relationships between events
"EvolutionCausalGraphStructure"evolution causal graph without labeling
"CausalGraphInstances"list of distinct causal graphs for all possible choices of event sequences
"CausalGraphStructureInstances"causal graph instances without labeling
"EvolutionCausalGraphInstances"list of distinct evolution causal graphs for all possible choices of event sequences
"EvolutionCausalGraphStructureInstances"evolution causal graph instances without labeling
"BranchPairsList"list of all branch pairs (i.e. critical pairs) generated in the states graph
"NewBranchPairsList"list of all new branch pairs generated at each successive step
"EvolutionBranchPairsList"list of all branch pairs generated in the evolution graph
"NewEvolutionBranchPairsList"list of all new evolution branch pairs generated at each successive step
"BranchPairEventsList"list of all events yielding branch pairs
"NewBranchPairEventsList"list of all events yielding new branch pairs at each successive step
"EvolutionBranchPairEventsList"list of all events yielding evolution branch pairs
"NewEvolutionBranchPairsEventsList"list of all events yielding new evolution branch pairs at each successive step
"BranchialGraph"graph of branch pair ancestry at a given step
"BranchialGraphStructure"branchial graph without labeling
"AllStatesBranchialGraph"graph of branch pair ancestry across all steps
"AllStatesBranchialGraphStructure"all states branchial graph without labeling
"EvolutionBranchialGraph"graph of evolution branch pair ancestry at a given step
"EvolutionBranchialGraphStructure"evolution branchial graph without labeling
"AllStatesEvolutionBranchialGraph"graph of evolution branch pair ancestry across all steps
"AllStatesEvolutionBranchialGraphStructure"all states evolution branchial graph without labeling
"EventBranchialGraph"graph of branch pair event ancestry at a given time step
"EventBranchialGraphStructure"event branchial graph without labeling
"AllEventsBranchialGraph"graph of branch pair event ancestry across all steps
"AllEventsBranchialGraphStructure"all events branchial graph without labeling
"EvolutionEventBranchialGraph"graph of evolution branch pair event ancestry at a given step
"EvolutionEventBranchialGraphStructure"evolution event branchial graph without labeling
"AllEventsEvolutionBranchialGraph"graph of evolution branch pair event ancestry across all steps
"AllEventsEvolutionBranchialGraphStructure"all events evolution branchial graph without labeling
"BranchPairResolutionsList"association of all resolved and unresolved branch pairs up to a given step
"EvolutionBranchPairResolutionsList"association of all resolved and unresolved evolution branch pairs up to a given step
"CausalInvariantQ"whether the system is causal invariant (all branch pairs converge)
"EvolutionCausalInvariantQ"whether the system is evolution causal invariant (all evolution branch pairs converge)
"KnuthBendixCompletion"list of Knuth–Bendix completion rules required to force causal invariance
"EvolutionKnuthBendixCompletion"list of Knuth–Bendix completion rules required to force evolution causal invariance
"StateWeights"list of weights for all vertices in the states graph
Except for "AllStatesListUnmerged", "EvolutionGraphUnmerged" and states containing state IDs, identical states are always merged at each step.
In "StatesGraph", all instances of a given state at any step are merged. Different updating events that connect the same states will only be shown as separate edges if "IncludeEventInstances" is set to 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["MultiwayOperatorSystem"] include:
"IncludeStepNumber"Falsewhether to label states and events with their respective step numbers
"IncludeStateID"Falsewhether to label states and events with unique IDs
"IncludeInitializationEvents"Falsewhether to include pseudoevents that set up initial conditions
"IncludeEventInstances"Falsewhether to show distinct updating events that connect the same states as separate edges
"IncludeStateWeights"Falsewhether to weight state vertices by their rate of occurrence at a particular time step
"IncludeStatePathWeights"Falsewhether to weight state vertices by the number of distinct evolution paths that lead to them
"StateRenderingFunction"Automatichow to label states that appear in graphs
"EventRenderingFunction"Automatichow to label events that appear in graphs
MaxItemsInfinityhow many instances of a causal graph or evolution causal graph to return
"GivePredecessors"Falsewhether to label branch pairs with their predecessor state
"GiveResolvents"Falsewhether to label branch pairs with their resolvent state
"IncludeSelfPairs"Falsewhether to include trivial branch pairs
"IncludeFullBranchialSpace"Falsewhether to show all possible states in a given branchial graph
"LineThickness"1absolute line thickness for graph edges
Possible settings for "StateRenderingFunction" and "EventRenderingFunction" include:
Inheriteduse the explicit vertex name as the label
Noneuse no label for the vertex
"shape"use a shape from the VertexShapeFunction collection
funcapply the function func to the name of the vertex
For "CausalGraphInstances" and "EvolutionCausalGraphInstances", the option MaxItemsn can be used to get only the first n possible instances of causal graphs.
Axiom schemas and higher-order logic axioms can be represented using operator patterns.

Examples

Basic Examples (14) 

Show basic multiway operator evaluation for a simple commutative operator system:

In[1]:=
ResourceFunction["MultiwayOperatorSystem"][f[x_, y_] :> f[y, x], f[f[a, b], f[c, d]], 3]
Out[1]=

For an operator corresponding to group multiplication:

In[2]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2]
Out[2]=

Generate a graph showing how each state is obtained from the others:

In[3]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "StatesGraph"]
Out[3]=

Show the structure of the graph, without labels:

In[4]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "StatesGraphStructure"]
Out[4]=

Show four steps without labels:

In[5]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 4, "StatesGraphStructure"]
Out[5]=

Generate the list of all updating events applied at each step:

In[6]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "AllEventsList"]
Out[6]=

Generate a graph of the evolution history, with updating events included:

In[7]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "EvolutionEventsGraph"]
Out[7]=

Show the structure of the graph, without labels:

In[8]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "EvolutionEventsGraphStructure"]
Out[8]=

Generate the causal graph, showing dependencies between updating events:

In[9]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 3, "CausalGraph"]
Out[9]=

Show the structure of the graph, without labels:

In[10]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 3, "CausalGraphStructure"]
Out[10]=

Generate the evolution events graph, with causal connections included:

In[11]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "EvolutionCausalGraph"]
Out[11]=

Show the structure of the graph, without labels:

In[12]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "EvolutionCausalGraphStructure"]
Out[12]=

Specify an event selection function that picks a random event at each step:

In[13]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]} -> "Random", g[x, y], 3, "StatesGraph"]
Out[13]=

Generate causal graphs for all possible choices of event sequences:

In[14]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "CausalGraphInstances"]
Out[14]=

Show the structures of the graphs, without labels:

In[15]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "CausalGraphStructureInstances"]
Out[15]=

Generate the list of all branch pairs (i.e. critical pairs):

In[16]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, e, 2, "BranchPairsList"]
Out[16]=

Generate the association showing which branch pairs converged and which did not:

In[17]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, e, 2, "BranchPairResolutionsList"]
Out[17]=

Prove that group theory is not causal invariant:

In[18]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, e, 3, "CausalInvariantQ"]
Out[18]=

Generate a graph showing branch pair ancestry:

In[19]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 3, "BranchialGraph"]
Out[19]=

Show the structure of the graph, without labels:

In[20]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 3, "BranchialGraphStructure"]
Out[20]=

Generate a graph showing branch pair ancestry for the same evaluation:

In[21]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 3, "EventBranchialGraphStructure"]
Out[21]=

Prevent identical states from being merged by including step numbers and state IDs:

In[22]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "StatesGraph", "IncludeStepNumber" -> True, "IncludeStateID" -> True, AspectRatio -> 1/4]
Out[22]=

List the states:

In[23]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "AllStatesList", "IncludeStepNumber" -> True, "IncludeStateID" -> True]
Out[23]=

Generate a graph of the full the evolution history, with all events included:

In[24]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "EvolutionGraphFullStructure"]
Out[24]=

Generate a graph of the full evolution history, with no merging of equivalent states:

In[25]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "EvolutionGraphUnmergedStructure"]
Out[25]=

Generate a graph of evolution history, with edges weighted by event multiplicity:

In[26]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "EvolutionGraphWeightedStructure", EdgeLabels -> "EdgeWeight"]
Out[26]=

Generate a states graph with vertices weighted by their rate of occurrence on each time step:

In[27]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "StatesGraph", "IncludeStateWeights" -> True, VertexLabels -> "VertexWeight"]
Out[27]=

Show the structure of the graph, without labels:

In[28]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "StatesGraphStructure", "IncludeStateWeights" -> True, VertexLabels -> "VertexWeight"]
Out[28]=

Generate a states graph with vertices weighted by the number of distinct evolution paths that lead to them:

In[29]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "StatesGraph", "IncludeStatePathWeights" -> True, VertexLabels -> "VertexWeight"]
Out[29]=

Show the structure of the graph, without labels:

In[30]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "StatesGraphStructure", "IncludeStatePathWeights" -> True, VertexLabels -> "VertexWeight"]
Out[30]=

Scope (12) 

Operator axiom systems (6) 

MultiwayOperatorSystem supports all forms of operator axiom systems, including standard Boolean algebra:

In[31]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{And[a_, b_] :> And[b, a], Or[a_, b_] :> Or[b, a], And[a_, Or[b_, Not[b_]]] :> a, Or[a_, And[b_, Not[b_]]] :> a, a_ :> Module[{b = Unique[]}, And[a, Or[b, Not[b]]]], a_ :> Module[{b = Unique[]}, Or[a, And[b, Not[b]]]], And[a_, Or[b_, c_]] :> Or[And[a, b], And[a, c]], Or[And[a_, b_], And[a_, c_]] :> And[a, Or[b, c]], Or[a_, And[b_, c_]] :> And[Or[a, b], Or[a, c]], And[Or[a_, b_], Or[a_, c_]] :> Or[a, And[b, c]]}, And[x, y], 2, "StatesGraphStructure"]
Out[31]=

Wolfram's minimal axiom system for Boolean algebra:

In[32]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{Nand[Nand[Nand[b_, c_], a_], Nand[b_, Nand[Nand[b_, a_], b_]]] :> a, a_ :> Module[{b = Unique[], c = Unique[]}, Nand[Nand[Nand[b, c], a], Nand[b, Nand[Nand[b, a], b]]]]}, Nand[a, b], 2, "StatesGraphStructure"]
Out[32]=

Ring theory:

In[33]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[a_, g[b_, c_]] :> g[g[a, b], c], g[g[a_, b_], c_] :> g[a, g[b, c]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]], g[a_, b_] :> g[b, a], f[a_, f[b_, c_]] :> f[f[a, b], c], f[f[a_, b_], c_] :> f[a, f[b, c]], f[a_, g[b_, c_]] :> g[f[a, b], f[a, c]], g[f[a_, b_], f[a_, c_]] :> f[a, g[b, c]]}, f[a, b], 3, "StatesGraphStructure"]
Out[33]=

Modified Presburger arithmetic:

In[34]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{plus[x_, 0] :> x, x_ :> plus[x, 0], plus[x_, neg[x_]] :> 0, 0 :> Module[{x = Unique[]}, plus[x, neg[x]]], plus[plus[x_, y_], z_] :> plus[x, plus[y, z]], plus[x_, plus[y_, z]] :> plus[plus[x, y], z]}, plus[a, b], 3, "StatesGraphStructure"]
Out[34]=

Tarski's axioms of Euclidean geometry:

In[35]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/60b4d672-e0b0-4b31-a127-877168dc58bc"]
Out[35]=

Note that, in the above, one of the axioms (the axiom of continuity) is actually an axiom schema, which here we represent using a second-order axiom involving operator patterns phi_ and psi_:

In[36]:=
Implies[And[phi_[x_], psi_[y_]], between[a_, x_, y_]] :> Module[{b = Unique[]}, Implies[And[phi[x], phi[y]], between[x, b, y]]]
Out[36]=

Axiom schemas and higher-order logics (2) 

Axiom schemas or higher-order axioms can be represented using operator patterns, such as phi_ in the following specification of the axiom (schema) of induction in Peano arithmetic:

In[37]:=
And[phi_[0], Implies[phi_[n_], phi_[succ[n_]]]] :> phi[n]
Out[37]=

For instance, use this axiom to prove by induction that prop[m] is true for all m:

In[38]:=
ResourceFunction["MultiwayOperatorSystem"][
 And[phi_[0], Implies[phi_[n_], phi_[succ[n_]]]] :> phi[n], And[prop[0], Implies[prop[m], prop[succ[m]]]], 1]
Out[38]=
In[39]:=
Last[%]
Out[39]=

Rules and initial conditions (2) 

MultiwayOperatorSystem accepts both individual operator axioms and lists of operator axioms:

In[40]:=
ResourceFunction["MultiwayOperatorSystem"][f[x_, y_] :> f[y, x], f[f[a, b], f[c, d]], 2, "StatesGraph"]
Out[40]=
In[41]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{f[x_, y_] :> f[y, x], f[f[x_, y_], f[z_, w_]] :> f[g[x], g[w]]}, f[f[a, b], f[c, d]], 2, "StatesGraph"]
Out[41]=

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

In[42]:=
ResourceFunction["MultiwayOperatorSystem"][f[x_, y_] :> f[y, x], f[f[a, b], f[c, d]], 2, "StatesGraph"]
Out[42]=
In[43]:=
ResourceFunction["MultiwayOperatorSystem"][
 f[x_, y_] :> f[y, x], {f[f[a, b], f[c, d]], f[f[d, c], f[b, a]]}, 2, "StatesGraph"]
Out[43]=

Event selection functions (2) 

Apply only the first possible event at each step:

In[44]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]} -> "Sequential", g[x, y], 3, "StatesGraph"]
Out[44]=

Apply the first and last possible events at each step:

In[45]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]} -> ({First[#], Last[#]} &), g[x, y], 6, "StatesGraphStructure"]
Out[45]=

Options (23) 

State node rendering (3) 

By default, states are labeled by their contents:

In[46]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "StatesGraph"]
Out[46]=

Use no labeling for states:

In[47]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "StatesGraph", "StateRenderingFunction" -> None]
Out[47]=

"StatesGraphStructure" yields the same result:

In[48]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "StatesGraphStructure"]
Out[48]=

Use raw state names as node labels:

In[49]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "StatesGraph", "StateRenderingFunction" -> Inherited]
Out[49]=

Use a named shape as each state label:

In[50]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "StatesGraph", "StateRenderingFunction" -> "Square"]
Out[50]=

Event node rendering (2) 

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

In[51]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "EvolutionEventsGraph"]
Out[51]=

Use no labels for states or events:

In[52]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "EvolutionEventsGraph", "StateRenderingFunction" -> None,
  "EventRenderingFunction" -> None]
Out[52]=

"EvolutionEventsGraphStructure" yields an equivalent result:

In[53]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "EvolutionEventsGraphStructure"]
Out[53]=

Use raw event expressions as their labels:

In[54]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "EvolutionEventsGraph", "StateRenderingFunction" -> None,
  "EventRenderingFunction" -> Inherited]
Out[54]=

Initialization events (2) 

By default, "AllEventsList" does not include initialization events:

In[55]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "AllEventsList"]
Out[55]=

The option "IncludeInitializationEvents" allows one to override this default:

In[56]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "AllEventsList", "IncludeInitializationEvents" -> True]
Out[56]=

Initialization events have special default rendering:

In[57]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "EvolutionEventsGraph", "IncludeInitializationEvents" -> True]
Out[57]=

Graph layout options (2) 

Place arrows in the middle of edges:

In[58]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "StatesGraph", EdgeShapeFunction -> GraphElementData["ShortFilledArrow", "ArrowSize" -> 0.03], VertexSize -> 1]
Out[58]=

Force the initial state node to be at the top:

In[59]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "StatesGraph", GraphLayout -> {"LayeredDigraphEmbedding", "RootVertex" -> ToString[g[x, y]]}]
Out[59]=

Step numbers and state IDs (4) 

By default, equivalent states are merged across all time steps:

In[60]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "StatesGraph"]
Out[60]=
In[61]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "AllStatesList"]
Out[61]=

Merging of equivalent states across different time steps can be prevented by including step numbers:

In[62]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "StatesGraph", "IncludeStepNumber" -> True]
Out[62]=

List the states:

In[63]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "AllStatesList", "IncludeStepNumber" -> True]
Out[63]=

Merging of equivalent states at the same time step can be prevented by also including state IDs:

In[64]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "StatesGraph", "IncludeStepNumber" -> True, "IncludeStateID" -> True, GraphLayout -> "SpringElectricalEmbedding"]
Out[64]=

List the states:

In[65]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "AllStatesList", "IncludeStepNumber" -> True, "IncludeStateID" -> True]
Out[65]=

Step numbers and IDs also apply to events:

In[66]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "EvolutionEventsGraph", "IncludeStepNumber" -> True, "IncludeStateID" -> True]
Out[66]=

See the events:

In[67]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "AllEventsList", "IncludeStepNumber" -> True, "IncludeStateID" -> True]
Out[67]=

Event instances (2) 

By default, multiple instances of equivalent updating events are merged in the states graph:

In[68]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "StatesGraph"]
Out[68]=

Merging of equivalent events can be prevented by including event instances:

In[69]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "StatesGraph", "IncludeEventInstances" -> True]
Out[69]=

State (path) weights (2) 

Vertices of a states graph can be weighted by their relative rate of occurrence at each time step:

In[70]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "StatesGraph", "IncludeStateWeights" -> True, VertexLabels -> "VertexWeight"]
Out[70]=

Vertices can also be weighted by the number of distinct evolution paths that lead to them:

In[71]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "StatesGraph", "IncludeStatePathWeights" -> True, VertexLabels -> "VertexWeight"]
Out[71]=

MaxItems (2) 

By default, "CausalGraphInstances" returns all possible causal graphs:

In[72]:=
ResourceFunction[
  "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 3, "CausalGraphInstances"] // Length
Out[72]=

The number of causal graphs returned can be limited using MaxItems:

In[73]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 3, "CausalGraphInstances", MaxItems -> 8]
Out[73]=

Predecessors and resolvents (2) 

By default, "BranchPairsList" returns only a list of branch pairs:

In[74]:=
ResourceFunction["MultiwayOperatorSystem"][f[x_, y_] :> f[y, x], f[f[a, b], f[c, d]], 2, "BranchPairsList"]
Out[74]=

Common predecessor states can be shown using "GivePredecessors":

In[75]:=
ResourceFunction["MultiwayOperatorSystem"][f[x_, y_] :> f[y, x], f[f[a, b], f[c, d]], 2, "BranchPairsList", "GivePredecessors" -> True]
Out[75]=

Similarly, "BranchPairResolutionsList" by default lists only resolved and unresolved branch pairs:

In[76]:=
ResourceFunction["MultiwayOperatorSystem"][f[x_, y_] :> f[y, x], f[f[a, b], f[c, d]], 2, "BranchPairResolutionsList"]
Out[76]=

Common resolvents of resolved branch pairs can be shown using "GiveResolvents":

In[77]:=
ResourceFunction["MultiwayOperatorSystem"][f[x_, y_] :> f[y, x], f[f[a, b], f[c, d]], 2, "BranchPairResolutionsList", "GiveResolvents" -> True]
Out[77]=

Show both common predecessors and common resolvents, where appropriate:

In[78]:=
ResourceFunction["MultiwayOperatorSystem"][f[x_, y_] :> f[y, x], f[f[a, b], f[c, d]], 2, "BranchPairResolutionsList", "GivePredecessors" -> True, "GiveResolvents" -> True]
Out[78]=

Full branchial space (2) 

By default, non-branch pair states are not shown as part of the branchial graph:

In[79]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "BranchialGraph"]
Out[79]=

They can be shown by using "IncludeFullBranchialSpace":

In[80]:=
ResourceFunction[
 "MultiwayOperatorSystem"][{g[x_, g[y_, z_]] :> g[g[x, y], z], g[g[x_, y_], z_] :> g[x, g[y, z]], g[a_, e] :> a, a_ :> g[a, e], g[a_, inv[a_]] :> e, e :> Module[{a = Unique[]}, g[a, inv[a]]]}, g[x, y], 2, "BranchialGraph", "IncludeFullBranchialSpace" -> True]
Out[80]=

Publisher

Jonathan Gorard

Version History

  • 1.0.0 – 02 September 2020

Source Metadata

Related Resources

License Information