Add type checker. Fix normalization with non-empty context

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
Normalize level expressions

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
Fix bugs in type checker

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>