I don't know. But I had an interesting dream once, long ago. When (I think at least) I was fully asleep, a nightmare started. Something in my head, a voice, simply said "it's not real, replace it with something else". And the scenery changed. Shortly after that I woke up.
I am not sure what that was, but it's not the only time something interesting has happened in my dreams. I think I problem-solve in my sleep sometimes. I know after working on one very difficult month-long take-home exam for a senior-level math class, I basically dreamed my way to the correct solution on one problem. I didn't dream the entire solution, just the approach towards it.
The funny thing is: I don't usually remember most of my dreams. So these two incidents are very VERY strange and rare for me.