Cleans up inferencer code

* Adds more explicit type declarations
* Uses `let` syntax for less redundancy
* Extract out some boilerplate for returning a single equation