Text this: Treatise on Intuitionistic Type Theory