ImposeConstraint: Force a tree to match a constraint
Description
Modify a tree such that it matches a specified constraint.
This is at present a somewhat crude implementation that attempts to retain
much of the structure of tree whilst guaranteeing compatibility with
each entry in constraint.