The issue is that while the symbolic code makes sure the most recent expression picked is least recent, it does not do anything with the expressions to the left of it.
This makes it different from LowLevel implementation which compares sorted indices of the matched subsets backwards.
Fixing this is not trivial, as it requires pattern matching constructions that might not exist in WL. Specifically, one would need to compare lengths of patterns across different alternatives.
Another way to solve this might be use multiple rules instead of alternatives in toNormalRules, evaluate all of them at each evolution step, and pick the best one at that point.
OS: macOS 10.15.2 (19C57)
Wolfram Language Version: "12.1.0 for Mac OS X x86 (64-bit) (December 16, 2019)"
Compare
and
The issue is that while the symbolic code makes sure the most recent expression picked is least recent, it does not do anything with the expressions to the left of it.
This makes it different from LowLevel implementation which compares sorted indices of the matched subsets backwards.
Fixing this is not trivial, as it requires pattern matching constructions that might not exist in WL. Specifically, one would need to compare lengths of patterns across different alternatives.
Another way to solve this might be use multiple rules instead of alternatives in
toNormalRules
, evaluate all of them at each evolution step, and pick the best one at that point.