What’s the logic of dreaming?