Typechecking theorems and updating type information