Factored the typing context out in inferType

Rather than checking Term t (t, v) we check Term t v and maintain a v -> t
Added a splitScope function

Takes a scope with a sum of bound variables to a nested scope.
Implemented a function for compiling lambda patterns
Implemented basic lambda inference

This involved reimplementing inferPatternType among other things. Some of the
implementation may be off, but it's approaching a point where the type of an
actual term could be reported.