Ad hoc parsers and a sanity check
Print the original TeX expression T.
Parse T expression into {Lisp, then Macsyma} and then ask Macsyma to produce, from that, a TeX expression S.
This does not really work though. Humans are easily fooled. Simplifications can make identical expressions look different. Semantically different expressions can print the same. Much that can be uttered in TeX cannot be said in current computer algebra systems (cross-refs? Provenance? English footnotes).