Some rules can match the same set of inputs in different ways. For example, consider the
rule {{a, b}, {a, c}} -> {{b, c}} starting with an initial condition {{1, 2}, {1, 3}}. There are two possible ways
to match it: <|a -> 1, b -> 2, c -> 3|> and <|a -> 1, b -> 3, c -> 2|>. In this case, these matches yield different
results, {2, 3} and {3, 2} respectively:
In[] := WolframModel[{{a, b}, {a, c}} -> {{b, c}}, {{1, 2}, {1, 3}},
"EventSelectionFunction" ->
"MultiwaySpacelike"]["ExpressionsEventsGraph",
VertexLabels -> Automatic]In the case above the outputs are different, however sometimes they are the same (more precisely, isomorphic):
In[] := WolframModel[{{a, b}, {a, c}} -> {{b, c}, {c, b}}, {{1, 2}, {1, 3}},
"EventSelectionFunction" ->
"MultiwaySpacelike"]["ExpressionsEventsGraph",
VertexLabels -> Automatic]EventDeduplication option can be used in a case like this to combine these two identical events into one:
In[] := WolframModel[{{a, b}, {a, c}} -> {{b, c}, {c, b}}, {{1, 2}, {1, 3}},
"EventSelectionFunction" -> "MultiwaySpacelike",
"EventDeduplication" -> "SameInputSetIsomorphicOutputs"]["ExpressionsEventsGraph",
VertexLabels -> Automatic]The outputs of the rule need not be identical, but should be isomorphic with respect to renaming of new atoms:
In[] := WolframModel[{{a, b}, {a, c}} -> {{b, d}, {c, d}}, {{1, 2}, {1, 3}},
"EventSelectionFunction" -> "MultiwaySpacelike",
"EventDeduplication" -> "SameInputSetIsomorphicOutputs"]["ExpressionsEventsGraph",
VertexLabels -> Automatic]![Out[] = ... {{1, 2}, {1, 3}} -> {{2, 3}} and {{1, 2}, {1, 3}} -> {{3, 2}} ...](/maxitg/SetReplace/raw/7b4fabdc33857213970323e2e94d4b9fefdf46ed/Documentation/Images/TwoMatchOrdersDifferentOutcomes.png)
![Out[] = ... {{1, 2}, {1, 3}} -> {{2, 3}, {3, 2}} and {{1, 3}, {1, 2}} -> {{3, 2}, {2, 3}} ...](/maxitg/SetReplace/raw/7b4fabdc33857213970323e2e94d4b9fefdf46ed/Documentation/Images/TwoMatchOrdersSameOutcome.png)
![Out[] = ... {{1, 2}, {1, 3}} -> {{2, 3}, {3, 2}} ...](/maxitg/SetReplace/raw/7b4fabdc33857213970323e2e94d4b9fefdf46ed/Documentation/Images/TwoIdentifiedMatchOrders.png)
![Out[] = ... {{1, 2}, {1, 3}} -> {{2, 4}, {3, 4}} ...](/maxitg/SetReplace/raw/7b4fabdc33857213970323e2e94d4b9fefdf46ed/Documentation/Images/TwoIsomorphicMatchOrders.png)