Dream world (plot device)
Dream worlds are a commonly used plot device in fictional works, most notably in science fiction and fantasy fiction. The use of a dream world creates a situation whereby a character (or group of characters) is placed in a marvelous and unpredictable environment and must overcome several personal problems to leave it. The dream world also commonly serves to teach some moral or religious lessons to the character experiencing it  a lesson that the other characters will be unaware of, but one that will influence decisions made regarding them. When the character is reintroduced into the real world (usually when they wake up), the question arises as to what exactly constitutes reality due to the vivid recollection and experiences of the dream world.
Dream worlds contrast with fantasy worlds, in which the world has existence independent of the characters in it.  The use of "dream frames" to contain a fantasy world, and so explain away its marvels, has been bitterly criticized and has been become much less prevalent.

# Fictional dream worlds
Dream frames were frequently used in medieval allegory to justify the narrative; The Book of the Duchess and Piers Plowman are two such dream visions.
An early example of a fictional dreamworld is the forest in Shakespeare's A Midsummer Night's Dream, which is like a collective dream world of the lovers that venture into it.
One of the best-known dream worlds is Wonderland from Alice in Wonderland.  In the 1939 movie, Oz from The Wonderful Wizard of Oz was altered from a fantasy world (in the novel) to a dream world of Dorothy's.
In the film version of Peter Pan, Neverland is a dream world from which Wendy wakes (her brothers, Michael and John, are still asleep). In the 1980s, the Nightmare on Elm Street series of horror films introduced a dark dream realm inhabited by the supernatural serial killer Freddy Krueger.
Other fictional dreamworlds include the Dreamlands of H.P. Lovecraft's Dream Cycle; Down Town, the land of nightmares where all people who are in comas go in the movie Monkeybone, and The Neverending Story's world of Fantastica, which includes places like The Desert of Lost Dreams, The Sea of Possibilities, and the Swamps of Saddness.
Dreamworlds also appear in  Rozen Maiden, in the Outback(s) of The Maxx; in Dream Land, the main setting of many Kirby games, in the webcomic The Dreamland Chronicles, in the Maginaryworld from Sonic Shuffle, and in Nightopia and Nightmare (collectively known in a place called the "Night Dimension") from NiGHTS into Dreams... and its upcoming sequel for the Wii, Nights: Journey of Dreams. The Life and Times of Juniper Lee and the movie Sailor Moon Super S the Movie: Black Dream Hole also have dream realms. The film "Waking Life" takes place entirely in a dream realm. Star Trek: Voyager episode "Waking Moments" uses several dream realms and false awakenings.
The American Dragon Jake Long episode Dreamscape takes place mainly in a dream realm. Similarly, the Xiaolin Showdown episode of the same title also uses the dream world in its plotline.
In Clamp manga series such as X/1999, Tsubasa: Reservoir Chronicle and xxxHolic, the dream world is very important to the events that occur within each story. It is later revealed in xxxHolic that the dream world itself is its own world, as part of the Clamp multiverse. The Ben 10 episode "Perfect Day" has the titular character being trapped in a dream world in order for a group of villains to remove the Omnitrix from his wrist.