“Many of these ideas have been out there,” says Lewis. “Some people argued that slow wave sleep is important for creativity and others argued that it’s REM. We’re saying it’s both.” Essentially, non-REM sleep extracts concepts, and REM sleep connects them.

Crucially, they build on one another. The sleeping brain goes through one cycle of non-REM and REM sleep every 90 minutes or so. Over the course of a night—or several nights—the hippocampus and neocortex repeatedly sync up and decouple, and the sequence of abstraction and connection repeats itself. “An analogy would be two researchers who initially work on the same problem together, then go away and each think about it separately, then come back together to work on it further,” Lewis writes.

“The obvious implication is that if you’re working on a difficult problem, allow yourself enough nights of sleep,” she adds. “Particularly if you’re trying to work on something that requires thinking outside the box, maybe don’t do it in too much of a rush.”

Parts of this framework are based on strong data, but others are still conjectures that need to be tested. For example, there isn’t much evidence to support Lewis’s hunch that the hippocampus prods the neocortex into replaying related memories during non-REM sleep. “I realize it’s a little bit of a stretch,” she admits, but she notes that in several studies, slow-wave improves the ability to identify common concepts. In one widely used task, people have to learn a word list—night, dark, coal—that revolves around an unseen theme. If they sleep afterwards, they’re more likely to (falsely) remember that they also learned the theme word—in this case, “black.” However, Jessica Payne from the University of Notre Dame notes that in one of her experiments, SWS had the opposite effect.

Still, that “small disagreement” aside, Payne feels that Lewis is mostly on the right track, especially when it comes to the role of REM sleep in combining conceptual knowledge “in ways that can be preposterous and creative,” she says. “I think the general idea is going to be right.”

There’s another weakness to Lewis’s framework that she finds more troubling: People can be deprived of REM sleep without suffering from any obvious mental problems. One Israeli man, for example, lost most REM sleep after a brain injury; “he’s a high-functioning lawyer and he writes puzzles for his local newspaper,” Lewis says. “That is definitely a problem for us.”

“I’m sure [the theory] isn’t 100 percent right,” she adds, laughing, “but we just got back a set of results that really strongly support it.” Her team tried to get sleeping volunteers to replay memories during slow wave sleep and REM sleep, and found different effects in each. Those results should be published in the near-future. In the meantime, the team is also developing ways of boosting or suppressing the two sleep stages to see how that affects people’s problem-solving skills. This is all part of a five-year project, and they’re just in their first year.

Lewis is also working with Mark van Rossum from the University of Nottingham to create an artificial intelligence that learns in the way she thinks the sleeping brain does, with “a stage for abstraction and a stage for linking things together,” she says.

“So you’re building an AI that sleeps?” I ask her.

“Yes,” she says.

I wonder if it will dream of electric sheep.

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.