refactor: generalize some `simp` methods

We are going to reuse these methods to implement a symbolic/partial evaluator.
3 files changed