It's not really a theory, it's a known effect of REM-related brain activity. Although, when it comes to sleep and the brain, nothing seems to be certain.