During REM sleep our brains make up and work though simulated scenarios, while putting our bodies into paralysis so we don't thrash about dangerously.... Senzai and Scanziani show what in going on in mouse brains. Here is the first paragraph (abstract) of their open source text:
Vivid dreams mostly occur during a phase of sleep called REM1–5. During REM sleep, the brain’s internal representation of direction keeps shifting like that of an awake animal moving through its environment6–8. What causes these shifts, given the immobility of the sleeping animal? Here we show that the superior colliculus of the mouse, a motor command center involved in orienting movements9–15, issues motor commands during REM sleep, e.g. turn left, that are similar to those issued in the awake behaving animal. Strikingly, these motor commands, despite not being executed, shift the internal representation of direction as if the animal had turned. Thus, during REM sleep, the brain simulates actions by issuing motor commands that, while not executed, have consequences as if they had been. This study suggests that the sleeping brain, while disengaged from the external world, uses its internal model of the world to simulate interactions with it.