Type theory in type theory