reorganized my research from 2 yrs ago.
https://github.com/yuuki15/24
① 5 * 2 + 1 - 1
② 5 * 2 * 1 * 1
③ 5 / (1 - (1 / 2))
all of the above equals 10.
but you'd see ① and ② similar, ③ quite different.
i was working on formulating this difference.
converts an expr by certain rules like
A * 1 * 1 ⟹ A + 1 - 1.
i called the result the yuuki normal form (YNF).
defines exprs the same iff they have the same YNF.
i implemented this using Perl extended regexes.
https://github.com/yuuki15/24/blob/1c5d42beb24144c3fdcccb39f032eb6842395b05/normalize.pl#L87
it is needed to eliminate duplicate solutions to the 24 puzzle.
found that certain 19 rules can normalize an expr.
however, it didn't work for exprs whose value is 0 (or the 0 puzzle).
(due to an infinite loop.)
the Ezpr data structure described in this blog may be the best approach.
https://blog.plover.com/math/24-puzzle-2.html
other prior studies are organized in my repo.
https://github.com/yuuki15/24#bibliography