Meditations on First Philosophy
The first recorded mention of the idea was by Zhuangzi, and it is also discussed in Hinduism, which makes extensive use of the argument in its writings. It was formally introduced to Western philosophy by Descartes in the 17th century in his "Meditations on First Philosophy". Stimulus, usually an auditory one, becomes a part of a dream, eventually then awakening the dreamer.