The `if (other.size() > size())` check was bogus; we can still have an
overlap of the second kind if the other term is longer than this term.
Remove this check, and rewrite the algorithm to be clearer in general.
Also move a all headers other than RequirementMachine.h there, since
I don't expect they will be used outside of the rewrite system
implementation itself.