Add machinery to test Tree transformations. Introduces isHomomorphic.

Rework exhaustive match detections.