Why We Have Such Mixed-Up Dreams (My Guess)
During the day, our subconscious mind handles events from moment to moment, as it takes in large amounts of sensory input and reacts to it and forms short-term memories and so on. Meanwhile, a more conscious part of our mind watches all of that and summarizes it into a story line that it can use for reasoning and planning and rationalizing why we must have done what we did and so on. These story line summaries also become longer-term memories that use only a small fraction of the memory that the many short-term memories use, and so we can afford to save these summaries much longer.
While we're sleeping, a "garbage collector" in our brains goes through memory and discards most of the new short-term memories, plus older memories that no longer have many links (1) to information that we're still using. This is needed for freeing up space for future memories. To cover everything, the garbage collector goes through memory in some physically sequential way that's not related to the order in which the memories were formed. (2) Yet the part of our mind that watches and summarizes everything that's going on happens to still be doing that, now watching the garbage collection. Maybe that's simply because there hasn't been enough evolutionary pressure to turn off this action during garbage collection. Or perhaps it's because occasionally it spots an actual relationship between memories that it happens to be covering at about the same time, which it can then link together. In any case, the summarizer is still assuming that the things that it's seeing are a connected sequence of events, though most of the time this is not true. So it serializes unrelated events into a story that we perceive as a dream, even though it's jumping around from one time and place to another in a nonsensical way. Therefore in a dream we may be doing some recent activity inside the home where we lived as a child, and then suddenly jump to some other time and place and activity.
Experiments have been done where subjects are awakened as soon as a monitor detects that they are beginning to dream, and this results in mental difficulties after a while. But that's probably because it disrupted the crucial garbage collection that's happening then, while the dreams that we happen to construct at the same time are not important themselves.
(1) In computer software, there is a clear distinction between memories that have one or more links with information that is still being used and other memories that have no such links. The memories with zero links can be discarded forever. But in our brains, it is never certain that any particular memory will never again be useful, so our brains tend to remember everything that they can. But a brain can hold only a certain amount of information, and so over time it continues to prune memories that have fewer remaining links to other things. This is mostly new memories, but also includes older memories that have lost links over time. So the garbage collection in our brains must traverse our entire memory.
(2) When a computer or a brain forms memories, it saves them into whatever memory locations it happens to come across first that are free, often placing them adjacent to older existing memories. When garbage collection is done later, it instead goes through all memory in a physically sequential order that encounters memories that are not in the order in which the events happened and the memories were formed.
This is all just my wild guess.
More Random Cruft
from Ken