dem0lecule I think you misunderstand, I did talk about two seperate things. Different parts of your brain are responsible for non-REM and REM sleep, and they serve different purposes. Non-REM sleep is your brain forming connections between things because it feels that they'd be useful, like dreaming you drive down a long and stop at lots of stop signs or having a dream that you continuously log into your E-mail.
REM sleep is your brain causing a simulation of different possible emotions. Your brain tests different emotions it wouldn't be able to deal with by taking different random memories and ideas and piecing them into a narrative, and this helps because your brain doesn't have any consequences to deal with. Some proof of this is scientists had a test where people had to piece words and ideas together. To show REM sleep helped cognitive functions and problem-solving abilities, they had people who had just had REM sleep before the experiment, against people who didn't just have REM sleep (They hooked them up to machines to see their brain activity, that's how they knew who was dreaming in REM-sleep, they prevented the others from having REM sleep by waking them up before they could achieve that stage of sleep) the people who had REM sleep solved the test 40% more often than those who did not.
Tankdown, in this thread I am merely talking about function of a NORMAL healthy indivisual. Some people are unable to have REM sleep, and close to all of them have some other form of mental illness, usually caused directly BY the inability to have REM sleep. This is how scientists conclude it must be an important function of the brain. If you have underlying mental illnesses, of course the same results cannot be expected.
Phobotech, yes, it is your brain testing out possible emotions it may have to deal with, with no consequences. It uses the images of death and such, in order to piece together the strong negative (or positive) emotions into a narrative.
Pied3, I do believe this is the most logical theory. And currently most scientists working in the field agree with me.
EnigmaticWolf, I respect your opinion, but your theory has no evidence to back it up, while mine has years of research on brain activity, responses to lack of REM-sleep, and more to back it up. I think you're approaching it from a more spiritual level.