Refactor the theory specific parts of definition expansion into the theory solvers.


In the process of doing this I may have fixed some bugs or some potential bugs so there
may be some user visible results of this refactoring.