Improve AST simplification.
Three major changes: 1) Teach the AST simplifier to reason about a couple of additional common simplification patterns (especially around conditionals). 2) Avoid using unification. This makes the code generators slightly faster. 3) Ensure the AST generator is deterministic.