diff --git a/Documentation/Generators/GenerateMultihistory.md b/Documentation/Generators/GenerateMultihistory.md index 095f5138..b36bec2e 100644 --- a/Documentation/Generators/GenerateMultihistory.md +++ b/Documentation/Generators/GenerateMultihistory.md @@ -12,11 +12,17 @@ In[] := multihistory = GenerateMultihistory[ MultisetSubstitutionSystem[{a_, b_} :> {a + b}], MaxDestroyerEvents -> 3, MaxEvents -> 10] @ {1, 2, 3, 4} ``` - +Out[] = Multihistory[... MultisetSubstitutionSystem v0 ...] ```wl In[] := #["ExpressionsEventsGraph", VertexLabels -> Placed[Automatic, After]] & @ SetReplaceTypeConvert[WolframModelEvolutionObject] @ multihistory ``` - +Out[] = Graph[...
+       {1, 2} -> {3 (* token 5 *)}, {2, 1} -> {3 (* token 6 *)}, {1, 3 (* init *)} -> {4}, <<7>>
+     ...] diff --git a/Documentation/Generators/GenerateSingleHistory.md b/Documentation/Generators/GenerateSingleHistory.md index 56267c89..264f1f22 100644 --- a/Documentation/Generators/GenerateSingleHistory.md +++ b/Documentation/Generators/GenerateSingleHistory.md @@ -11,14 +11,24 @@ In[] := multihistory = GenerateSingleHistory[ MultisetSubstitutionSystem[{a_, b_} :> {a + b, a - b, a * b}], MaxEvents -> 10] @ {1, 2} ``` - +Out[] = Multihistory[... MultisetSubstitutionSystem v0 ...] ```wl In[] := #["ExpressionsEventsGraph", VertexLabels -> Placed[Automatic, After]] & @ SetReplaceTypeConvert[WolframModelEvolutionObject] @ multihistory ``` - +Out[] = Graph[...
+       token-event graph where all tokens have out degrees less or equal than 1:
+       {1, 2 (* init *)} -> {3, -1, 2 (* gen 1 *)},
+       {3, -1} -> {2 (* gen 2 *), 4 (* gen 2 *), -3},
+       {2 (* gen 1 *), 2 (* gen 2 *)} -> {4 (* gen 3 sum *), 0, 4 (* gen 3 product *)},
+       <<7>>
+     ...] Note that there is a distinction between single-history and single-path systems. Single-path systems are defined as ones where there is only one event possible from every state. A Turing machine would be an example of a single-path system. diff --git a/Documentation/Generators/MaxDestroyerEvents.md b/Documentation/Generators/MaxDestroyerEvents.md index 1e9b7e7c..4f5e2325 100644 --- a/Documentation/Generators/MaxDestroyerEvents.md +++ b/Documentation/Generators/MaxDestroyerEvents.md @@ -10,7 +10,9 @@ In[] := #["ExpressionsEventsGraph", VertexLabels -> Placed[Automatic, After]] & GenerateMultihistory[MultisetSubstitutionSystem[{a_, b_} :> {a + b}], MaxDestroyerEvents -> 1] @ {1, 2, 3} ``` - +Out[] = Graph[... {1, 2} -> {3 (* gen 1 *)}, {3 (* init *), 3 (* gen 1 *)} -> 6 ...] If unset (which defaults to [`Infinity`](https://reference.wolfram.com/language/ref/Infinity.html)), it will generate a full multihistory object subject to other selection and stopping parameters: @@ -22,7 +24,9 @@ In[] := #["ExpressionsEventsGraph", VertexLabels -> Placed[Automatic, After]] & MultisetSubstitutionSystem[{a_, b_} :> {a + b}], MaxDestroyerEvents -> Infinity, MaxGeneration -> 1] @ {1, 2, 3} ``` - +Out[] = Graph[... {1, 2} -> {3 (* 1 + 2 *)}, {2, 1} -> {3 (* 2 + 1 *)}, {1, 3 (* init *)} -> {4}, <<3>> ...] If set to a finite number, it will generate a partial multihistory: @@ -32,6 +36,8 @@ In[] := #["ExpressionsEventsGraph", VertexLabels -> Placed[Automatic, After]] & GenerateMultihistory[MultisetSubstitutionSystem[{a_, b_} :> {a + b}], MaxDestroyerEvents -> 5] @ {1, 2, 3} ``` - +Out[] = Graph[... token-event graph containing tokens with out degrees up to 5 ...] Note that results generally depend on the event order in this case, similar to single histories. diff --git a/Documentation/Generators/MaxEvents.md b/Documentation/Generators/MaxEvents.md index de319417..5550029f 100644 --- a/Documentation/Generators/MaxEvents.md +++ b/Documentation/Generators/MaxEvents.md @@ -9,6 +9,8 @@ In[] := #["ExpressionsEventsGraph"] & @ GenerateMultihistory[MultisetSubstitutionSystem[{a_, b_} /; a < b :> {a + b}], MaxEvents -> 9] @ {1, 2, 3, 4} ``` - +Out[] = Graph[... token-event graph with 9 events ...] Compare to [`MaxGeneration`](MaxGeneration.md), which controls the depth of the evaluation instead. diff --git a/Documentation/Generators/MaxGeneration.md b/Documentation/Generators/MaxGeneration.md index 0f98f09e..5e16baca 100644 --- a/Documentation/Generators/MaxGeneration.md +++ b/Documentation/Generators/MaxGeneration.md @@ -19,7 +19,11 @@ In[] := #["ExpressionsEventsGraph", MaxEvents -> 3] @ {1, 2, 3} ``` - +Out[] = Graph[...
+       token-event graph with 9 tokens arranged in 3 layers, and 3 events in 2 layers in between
+     ...] Restricting the number of generations to one will prevent the last two events from occurring. Note, however, that another event is created instead: @@ -30,7 +34,9 @@ In[] := #["ExpressionsEventsGraph"] & @ SetReplaceTypeConvert[WolframModelEvolut MaxGeneration -> 1, MaxEvents -> 3] @ {1, 2, 3} ``` - +Out[] = Graph[... token-event graph with 2 layers of tokens and a single layer of events ...] `MaxGeneration` is an event selection parameter, not a stopping condition. That is, the evolution of the system won't stop if a match (tentative event) with a generation greater than the constraint is encountered. Instead, it will ignore diff --git a/Documentation/Generators/MinEventInputs.md b/Documentation/Generators/MinEventInputs.md index 3df2a702..7f49aaf3 100644 --- a/Documentation/Generators/MinEventInputs.md +++ b/Documentation/Generators/MinEventInputs.md @@ -12,7 +12,11 @@ In[] := #["ExpressionsEventsGraph", VertexLabels -> Placed[Automatic, After]] & MultisetSubstitutionSystem[{a___} :> {Total[{a}]}], MinEventInputs -> 0, MaxEvents -> 10] @ {1, 2, 3} ``` - +Out[] = Graph[...
+       {} -> {0}, {1 (* init *)} -> {1 (* gen 1 *)}, {2 (* init *)} -> {2 (* gen 1 *)}, <<7>>
+     ...] and `MinEventInputs -> 2`: @@ -23,4 +27,6 @@ In[] := #["ExpressionsEventsGraph", VertexLabels -> Placed[Automatic, After]] & MultisetSubstitutionSystem[{a___} :> {Total[{a}]}], MinEventInputs -> 2, MaxEvents -> 10] @ {1, 2, 3} ``` - +Out[] = Graph[... {1, 2} -> {3 (* 1 + 2 *)}, {2, 1} -> {3 (* 2 + 1 *)}, {1, 3 (* init *)} -> {4}, <<7>> ...] diff --git a/Documentation/Generators/README.md b/Documentation/Generators/README.md index fda37823..8357c384 100644 --- a/Documentation/Generators/README.md +++ b/Documentation/Generators/README.md @@ -26,7 +26,9 @@ In[] := #["ExpressionsEventsGraph", VertexLabels -> Placed[Automatic, After]] & GenerateSingleHistory[MultisetSubstitutionSystem[{a_, b_} /; a < b :> {a + b}]] @ {1, 2, 3, 4} ``` - +Out[] = Graph[... {1, 2} -> {3 (* gen 1 *)}, {3 (* init *), 4} -> {7}, {3 (* gen 1 *), 7} -> {10} ...] We can also use a more general [`GenerateMultihistory`](GenerateMultihistory.md) and specify [`MaxDestroyerEvents`](MaxDestroyerEvents.md) manually. @@ -38,7 +40,15 @@ In[] := #["ExpressionsEventsGraph", VertexLabels -> Placed[Automatic, After]] & MultisetSubstitutionSystem[{a_, b_} /; a < b :> {a + b}], MaxDestroyerEvents -> 2] @ {1, 2, 3, 4} ``` - +Out[] = Graph[...
+       {1, 2} -> {3 (* gen 1 *)},
+       {1, 3 (* init *)} -> {4 (* gen 1 *)},
+       {2, 3 (* init *)} -> {5},
+       {3 (* gen 1 *), 4 (* init *)} -> {7},
+       {4 (* init *), 5} -> {9}
+     ...] The same generators support multiple systems. In addition to [`MultisetSubstitutionSystem`](/Documentation/Systems/MultisetSubstitutionSystem.md), other examples include diff --git a/Documentation/Systems/AtomicStateSystem.md b/Documentation/Systems/AtomicStateSystem.md index c6a17132..5bcbd1a2 100644 --- a/Documentation/Systems/AtomicStateSystem.md +++ b/Documentation/Systems/AtomicStateSystem.md @@ -9,7 +9,9 @@ In[] := #["ExpressionsEventsGraph", VertexLabels -> Placed[Automatic, After]] & GenerateMultihistory[AtomicStateSystem[{n_ :> n + 1, n_ :> n - 1}], MaxGeneration -> 4][0] ``` - +Out[] = Graph[... 0 -> Rule 1 -> 1, 0 -> Rule 2 -> -1, 1 -> Rule 1 -> 2, <<26>>, -3 -> Rule 2 -> -4 ...] Note that spacelike separation is not possible in the `AtomicStateSystem`. As a result, branching due to overlaps of different subsets of input tokens cannot occur. And, since events cannot produce branchlike-separated outputs and there diff --git a/Documentation/Systems/MultisetSubstitutionSystem.md b/Documentation/Systems/MultisetSubstitutionSystem.md index 4bc0d889..18860ee3 100644 --- a/Documentation/Systems/MultisetSubstitutionSystem.md +++ b/Documentation/Systems/MultisetSubstitutionSystem.md @@ -22,7 +22,9 @@ In[] := #["ExpressionsEventsGraph", VertexLabels -> Placed[Automatic, After]] & GenerateSingleHistory[MultisetSubstitutionSystem[{a_, b_} /; a < b :> {a + b}]] @ {1, 2, 3, 4} ``` - +Out[] = Graph[... {1, 2} -> {3 (* gen 1 *)}, {3 (* init *), 4} -> {7}, {3 (* gen 1 *), 7} -> {10} ...] Arbitrary Wolfram Language patterns are supported including [conditions](https://reference.wolfram.com/language/ref/Condition.html) such as `{a_ /; a > 0, b_}` and @@ -38,7 +40,12 @@ In[] := #["ExpressionsEventsGraph", VertexLabels -> Placed[Automatic, After]] & MinEventInputs -> 2, MaxEventInputs -> 4] @ {1, 2, 3, 4} ``` - +Out[] = Graph[...
+       generation 1: {1, 2} -> {3}, {1, 4} -> {5}, {2, 3} -> {5}, {3, 4} -> {7}, {1, 2, 4} -> {7},
+       generation 2: {2, 5} -> {7}, {3 (* gen 1 *), 4} -> {7}
+     ...] Note, however, that the system cannot recognize if the code on the right-hand side is nondeterministic, so only the first output will be used for each assignment of pattern variables. diff --git a/Documentation/TypeSystem/$SetReplaceTypeGraph.md b/Documentation/TypeSystem/$SetReplaceTypeGraph.md index 7ea6c86c..9ccc95c7 100644 --- a/Documentation/TypeSystem/$SetReplaceTypeGraph.md +++ b/Documentation/TypeSystem/$SetReplaceTypeGraph.md @@ -8,7 +8,12 @@ In[] := $SetReplaceTypeGraph ``` - +Out[] = Graph[...
+       AtomicStateSystem v0 -> MultisetSubstitutionSystem v0,
+       MultisetSubstitutionSystem v0 -> WolframModelEvolutionObject v2
+     ...] It is a [`Graph`](https://reference.wolfram.com/language/ref/Graph.html) representation of a directed hypergraph with types and properties as vertices and implementations of translations and properties as edges. diff --git a/Documentation/TypeSystem/$SetReplaceTypes.md b/Documentation/TypeSystem/$SetReplaceTypes.md index dbb53cf4..b95237fd 100644 --- a/Documentation/TypeSystem/$SetReplaceTypes.md +++ b/Documentation/TypeSystem/$SetReplaceTypes.md @@ -6,4 +6,10 @@ In[] := $SetReplaceTypes ``` - +Out[] = {
+       SetReplaceType[... AtomicStateSystem v0 ...],
+       SetReplaceType[... MultisetSubstitutionSystem v0 ...],
+       SetReplaceType[... WolframModelEvolutionObject v2 ...]
+     } diff --git a/Documentation/TypeSystem/SetReplaceObjectQ.md b/Documentation/TypeSystem/SetReplaceObjectQ.md index 5ee491c9..7e7e82e3 100644 --- a/Documentation/TypeSystem/SetReplaceObjectQ.md +++ b/Documentation/TypeSystem/SetReplaceObjectQ.md @@ -3,7 +3,9 @@ **`SetReplaceObjectQ`** yields [`True`](https://reference.wolfram.com/language/ref/True.html) for *SetReplace* objects and [`False`](https://reference.wolfram.com/language/ref/False.html) otherwise: - +In[] := SetReplaceObjectQ @ Multihistory[... MultisetSubstitutionSystem v0 ...] ```wl Out[] = True diff --git a/Documentation/TypeSystem/SetReplaceObjectType.md b/Documentation/TypeSystem/SetReplaceObjectType.md index 458ed16f..d88506d8 100644 --- a/Documentation/TypeSystem/SetReplaceObjectType.md +++ b/Documentation/TypeSystem/SetReplaceObjectType.md @@ -3,4 +3,9 @@ **`SetReplaceObjectType`** yields [the type](/Documentation/Types/README.md) of an object. Note that the type specification usually contains its version: - +
+       In[] := SetReplaceObjectType @ Multihistory[... MultisetSubstitutionSystem v0 ...]
+       Out[] = SetReplaceType[... MultisetSubstitutionSystem v0 ...]
+     diff --git a/Documentation/TypeSystem/SetReplaceTypeConvert.md b/Documentation/TypeSystem/SetReplaceTypeConvert.md index acfe2033..a81100f1 100644 --- a/Documentation/TypeSystem/SetReplaceTypeConvert.md +++ b/Documentation/TypeSystem/SetReplaceTypeConvert.md @@ -11,8 +11,20 @@ For example, one can convert an [`AtomicStateSystem` multihistory](/Documentation/Types/Multihistory/AtomicStateSystem0.md) to a [`MultisetSubstitutionSystem` multihistory](/Documentation/Types/Multihistory/MultisetSubstitutionSystem0.md): - +
+       In[] := SetReplaceTypeConvert[MultisetSubstitutionSystem] @ Multihistory[... AtomicStateSystem v0 ...]
+       Out[] = Multihistory[... MultisetSubstitutionSystem v0 ...]
+     To convert to a specific version of a type, one can use the full type specification: - +
+       In[] := SetReplaceTypeConvert[
+         SetReplaceType[MultisetSubstitutionSystem, 0]
+       ] @ Multihistory[... AtomicStateSystem v0 ...]
+       Out[] = Multihistory[... MultisetSubstitutionSystem v0 ...]
+     diff --git a/Documentation/Types/Multihistory/AtomicStateSystem0.md b/Documentation/Types/Multihistory/AtomicStateSystem0.md index 3a42eb16..9adc75ae 100644 --- a/Documentation/Types/Multihistory/AtomicStateSystem0.md +++ b/Documentation/Types/Multihistory/AtomicStateSystem0.md @@ -8,7 +8,9 @@ In[] := GenerateMultihistory[AtomicStateSystem[a_ :> a + 1], MaxEvents -> 10][0] ``` - +Out[] = Multihistory[... AtomicStateSystem v0 ...] Internally, [`AtomicStateSystem`](/Documentation/Systems/AtomicStateSystem.md) is implemented by running a special case of the [`MultisetSubstitutionSystem`](/Documentation/Systems/MultisetSubstitutionSystem.md). The object contains a diff --git a/Documentation/Types/Multihistory/MultisetSubstitutionSystem0.md b/Documentation/Types/Multihistory/MultisetSubstitutionSystem0.md index e1cc0778..fdcb1321 100644 --- a/Documentation/Types/Multihistory/MultisetSubstitutionSystem0.md +++ b/Documentation/Types/Multihistory/MultisetSubstitutionSystem0.md @@ -8,7 +8,9 @@ object is returned by [generators](/Documentation/Generators/README.md) of the In[] := GenerateMultihistory[MultisetSubstitutionSystem[{a_, b_} :> {a + b}], MaxEvents -> 10] @ {1, 2, 3} ``` - +Out[] = Multihistory[... MultisetSubstitutionSystem v0 ...] It is implemented as an [`Association`](https://reference.wolfram.com/language/guide/Associations.html) of [data structures](https://reference.wolfram.com/language/ref/DataStructure.html) containing information about the rules, diff --git a/Documentation/Types/Multihistory/README.md b/Documentation/Types/Multihistory/README.md index 0402f7a1..038fb979 100644 --- a/Documentation/Types/Multihistory/README.md +++ b/Documentation/Types/Multihistory/README.md @@ -9,7 +9,9 @@ For example, for a [`MultisetSubstitutionSystem`](/Documentation/Systems/Multise In[] := GenerateMultihistory[MultisetSubstitutionSystem[{a_, b_} :> {a + b}], MaxEvents -> 10] @ {1, 2, 3} ``` - +Out[] = Multihistory[... MultisetSubstitutionSystem v0 ...] You will be able to use [`properties`](/Documentation/Properties/README.md) to extract information about multihistories, but we have not implemented any properties yet.