The internal logic of a topos