Finnish psychologist Antti Revonsuo believes that dreams have a primary function of allowing extensive safe training in escaping dangerous situations. His research (as reported in Psychology Today, Nov-Dec 2007), shows that two-thirds of all dreams are threat dreams, totaling 300 to 1000 per year.
Studies of humans in a primitive environment, such as the Mehinaku hunter-gatherers of the Amazon, show that they dream extensively of common dangerous threats, and ways of escaping them.
Sleep research at Harvard Medical School shows that people learning a new skill in the morning do not have improved results later the same day without practice, but do have improved results without practice after sleeping.
This may not be the only function of dreaming, but simulation-based training appears to be a massively important, genetically-established way for humans to learn.
But we knew that all along, didn’t we?
http://www.psychologytoday.com/articles/index.php?term=pto-20071029-000003&print=1