maxitg / SetReplace

C++/Wolfram Language package for exploring set and graph rewriting systems
MIT License
216 stars 43 forks source link

Multiple matches to the same tokens #637

Closed maxitg closed 3 years ago

maxitg commented 3 years ago

The problem

An ordered list of tokens is not sufficient for describing a match in a MultisetSubstitutionSystem. For example, the following misses the match corresponding to {a -> Sequence[1, 2], b -> 3}:

In[] := #["ExpressionsEventsGraph", VertexLabels -> Automatic] &@
 SetReplaceTypeConvert[{WolframModelEvolutionObject, 2}]@
  GenerateMultihistory[
    MultisetSubstitutionSystem[{a__, b__} /; OrderedQ[{a, b}] :> {{a}, {b}}], {"MaxGeneration" -> 1,
     "MinEventInputs" -> 3, "MaxEventInputs" -> 3},
    None, {"InputCount", "SortedInputTokenIndices", "InputTokenIndices", "RuleIndex"}, {}][{1, 2, 3}]
image

Expected behavior

The system should generate two matches.

Version

In[] := SystemInformation["Small"]
Out[] = {"Kernel" -> {"SystemID" -> "MacOSX-x86-64", "ReleaseID" -> "12.2.0.0 (7198639, 202012124634)",
   "CreationDate" -> DateObject[{2020, 12, 12, 15, 32, 16}, "Instant", "Gregorian", -5.]},
 "FrontEnd" -> {"OperatingSystem" -> "MacOSX", "ReleaseID" -> "12.2.0.0 (7198639, 202012121918)",
   "CreationDate" -> DateObject[{2020, 12, 12, 15, 31, 58}, "Instant", "Gregorian", -5.]}}
In[] := $SetReplaceGitSHA

0bbd86717b3e76cf86f91812a6ada000e13d58e7

Additional context

This requires some rethinking of the multihistory data structure.