Across a range of inferences involving not just language but mathematics, logic problems, and spatial reasoning, sleep has been shown to enhance the formation and understanding of abstract relations, so much so that people often wake having solved a problem that was unsolvable the night before.
Daniel Levitin