 Ibn Khaldun's "Muqaddimah" (1377) states that "confused dreams" are "pictures of the imagination that are stored inside by perception and to which the ability to think is applied, after (man) has retired from sense perception.