The activation synthesis theory of dreaming was first suggested by J. Allan Hobson and Robert McCarley in 1977, and has since been elaborated on due to newer research and more advanced brain imaging techniques. The theory proposes that the content of dreams is synthesized in cortical areas, by fitting experiental data to spontaneous activity taking place in deeper areas of the brain during sleep.
Source:
Hobson J. A., McCarley R.W. (1977) “The brain as a dream state generator: an activation-synthesis hypothesis of the dream process”. Am J Psychiatry. Dec;134(12):1335-48
See lectures related to dreaming: