Type systems and logic