make context a parameter (rather than index) in well-typed terms
Added missing 'instance' keyword
Include the full type checker