Topos theory for spaces of connected components