Categories and Types in Logic, Language, and Physics