JM Barrie might be most famous for his classic story of a flying boy who never grows up, but the author was also far ahead of his time when it came to cognitive psychology, according to a Cambridge academic who argues in a new book that the Peter Pan author’s whimsical stories deliberately explore the nature of cognition.

Neuroscientist Rosalind Ridley, of Newnham College in Cambridge, claims in the just-published Peter Pan and the Mind of JM Barrie that the author’s work identifies key stages of child development. One scene she spotlights in Peter Pan in Kensington Gardens, published in 1906, sees a girl giving a tearful Peter her handkerchief, which he is confused by. “So she showed him, that is to say she wiped her eyes, and then gave it back to him, saying: ‘Now you do it,’ but instead of wiping his own eyes he wiped hers, and she thought it would be best to pretend that this is what she had meant,” writes Barrie.

According to Ridley, Barrie is here illustrating his observation and understanding of a fundamental stage of child development: having a “theory of mind”, or the ability to understand that one’s knowledge, beliefs and feelings may not be the same as someone else’s. This is learned naturally by most children around the age of three or four, but the term was not used until the late 1970s. In 1985, psychologists would show that failure to employ theory of mind is a symptom of autism, Asperger’s syndrome and some psychiatric conditions.

Other apparently fanciful ideas included in Barrie’s Peter Pan stories include Peter’s lack of understanding of hide and seek, and his inability to comprehend what emotional love is. “These whimsical ideas comprise deliberate errors of cognition, that is to say, errors in the way we normally structure our thoughts, leading to the suspicion that Barrie was deliberately exploring the nature of cognition in these stories,” writes Ridley in the book, newly out fromCambridge Scholars Publishing.

“Barrie’s whimsicalities serve to compare the cognitive abilities of babies, children, and fairies (who represent children’s imagination) to those of adult humans. He is demonstrating that children need to develop cognitively, that is to say, they need to acquire skills of thinking, rather than that they are little adults who need merely to acquire factual information in order to grow up. He was very forward thinking in this respect and much of his motivation seems to have been a plea for a greater understanding of the mental and emotional needs of children.”

Cognitive psychology, she writes, was in its infancy when Barrie was writing, and “in many cases, his accurate observation of animal and human behaviour precedes the analysis of these behaviours by the scientific community”.

Calling Barrie a “naturalist of the mind”, she shows how he explores the nature of consciousness, from closely observed details about human behaviour such as contagious yawning (Wendy’s “light blinked and gave such a yawn that the other two yawned also”), to the important role of sleep in consolidating and rationalising memory, which Barrie compares to “tidying drawers”: “When you wake in the morning, the naughtiness and evil passions with which you went to bed have been folded up small and placed at the bottom of your mind; and on top, beautifully aired, are spread out your prettier thoughts, ready for you to put on.”

As a modern psychologist, I could see things that I knew hadn’t been ‘discovered’ until the 1980s. It was remarkable

Dr Rosalind Ridley

Ridley told the Guardian that, on reading Peter Pan in Kensington Gardens as an adult and applying her academic experience as a neuroscientist, she found Barrie’s prescience “quite extraordinary”.

“As a modern psychologist, I could see things in it that I knew hadn’t been ‘discovered’ until I was a student, or in the 1980s. It was quite remarkable,” she said. “I read up about it, and although there was a lot about Peter Pan, who’s an iconic figure, and people talked about Barrie’s interest in children, I really found very little about cognitive psychology.”

She concluded that the work of Charles Darwin had been a pivotal influence on Barrie’s work. “At that time, animals were thought of as beasts, there was a big gap between humans and animals. And then along came Darwin, showing us that we were animals mentally as well as physically. I think Barrie is completely suffused with this,” she said. “I’ve thought a great deal about what his motivation was, and I’m convinced he was doing it on purpose. Some of the quirky whimsicalities appear more than once: he seems to be making a point. A little version of [the girl with the handkerchief story] appears two to three times. He must have known it was weird, and interesting, and that it meant something. He wasn’t being trivial.”

The stories of Peter Pan were created by Barrie between 1897 and 1902, to amuse the boys of the Llewelyn Davies family, whom Barrie had met while walking in Kensington Gardens, and whose guardian he later became when their parents died. Ridley said that the tale of a boy who never grows up is also linked to Barrie’s tragic childhood: the author’s elder brother died in a skating accident when he was a child.

“A lot of it is to do with reshaping his childhood. So he’s personally motivated, but is also scientifically motivated. In those days, they thought of children as being tiny people with no knowledge, that all you had to do was educate them. Barrie is making out that tiny children are more animal-like,” she told the Guardian.

In her book, she shows how the narrative of Peter Pan works on different levels. It is a coming-of-age story, a fantasy for children and adults, and the myth of a golden age, but was also invented by the author “essentially for himself in order to explore and perhaps make some sense of his own emotional difficulties, to investigate the interplay of the world of facts and the world of the imagination and to rediscover the heightened experiences of infancy”.