The old expression, “you can’t teach an old dog new tricks,” may need to be retired. Not only can old dogs learn new tricks, they can teach us something about our own mental abilities as we age.

A new study finds that aging dogs not only learn new information, they can even apply logic to it. But, like humans, their mental strengths may shift a bit with age.

The researchers used Border Collies, known to be some of the smartest canines around. The dogs ranged from five months to 13 years in age, and came (along with their owners) into the lab to be tested in three areas — learning, logical reasoning and memory.

In the first test, the dogs were trained, with a treat reward, to touch a touchscreen when they saw a particular type of image. This became a “positive” image. Another type of image was not linked to a reward, so was a “negative” image. When the two types of images were presented at once, older dogs took longer than the younger ones to choose the positive images to gain their reward. This suggests that their learning had slowed somewhat.

The older the dog, the better it performed; younger dogs were unable to master the new, more discriminating, task.

“Older dogs required more trials than younger ones before they were able to solve the task correctly,” said study author Lisa Wallis in a press release. “The test also showed that older dogs are less flexible in their way of thinking than younger ones. As in people, older dogs find it more difficult to change old habits or what they have learned.”

But other things, like logical reasoning, seemed to improve. The researchers next presented a new or novel image along with one of the previous “negative” ones. The idea was, according to the researchers, that the dogs would choose the novel image by process of elimination. They would rule out the negative one based on their knowledge that it offered no reward.

Interestingly, the older dogs were better at this task. Whether this signals flexibility in thinking or rigidity is somewhat up for grabs, but they were definitely better at the task.

“The older the dog, the better it performed, while younger dogs were unable to master this task. This is probably due to the fact that older dogs more stubbornly insist on what they have learned before and are less flexible than younger animals,” said Friederike Range, another researcher.

In the final test, which took place six months later, the authors found that all dogs, regardless of age, retained most of the information they’d learned earlier. That is, when they were tested again, they generally remembered which images were positive and which were negative.

So older dogs may take a little longer to learn than puppies, but they seem to be able to reason better than younger dogs. The same may be true of humans. The brain isn’t as sponge-like as it is when we’re young, but our reasoning capacities may improve with age and experience.

In any case, don’t write your old dog off just because he’s old — he can still learn a trick or two, and certainly remembers those tricks over time.

The study was carried out at the University of Veterinary Medicine in Vienna, Austria, and is published in the journal, Age.