IN “Oryx and Crake,” Margaret Atwood’s novel about humanity’s final days on earth, a boy named Jimmy becomes obsessed with Alex, an African gray parrot with extraordinary cognitive and linguistic skills. Hiding out in the library, Jimmy watches historical TV documentaries in which the bird deftly distinguishes between blue triangles and yellow squares and invents a perfect new word for almond: cork-nut.

But what Jimmy finds most endearing is Alex’s bad attitude. As bored with the experiments as Jimmy is with school, the parrot would abruptly squawk, “I’m going away now,” then refuse to cooperate further.

Except for the part about Jimmy and the imminent apocalypse (still, fingers crossed, a few decades away), all of the above is true. Until he was found dead 10 days ago in his cage at a Brandeis University psych lab, Alex was the subject of 30 years of experiments challenging the most basic assumptions about animal intelligence.

He is survived by his trainer, Irene Pepperberg, a prominent comparative psychologist, and a scientific community divided over whether creatures other than human are more than automatons, enjoying some kind of inner life.

Skeptics have long dismissed Dr. Pepperberg’s successes with Alex as a subtle form of conditioning — no deeper philosophically than teaching a pigeon to peck at a moving spot by bribing it with grain. But the radical behaviorists once said the same thing about people: that what we take for thinking, hoping, even theorizing, is all just stimulus and response.

Was Alex only parroting when he showed off for Alan Alda on “Scientific American Frontiers” (one of the PBS productions the fictional Jimmy might have seen)?

“What color smaller?” Dr. Pepperberg asked the parrot as she held up two keys. “Green,” he responded. Alex also seemed to understand concepts like “bigger,” “different” and “same.” Presented with a tray of colored cutouts — the numerals 1 to 6 — he could tell you which one was gray: “Four.”

Many linguists argue that only human brains have the ability to nest ideas within ideas to form the infinitely recursive architecture of thought: When you’re done eating breakfast would you look in the box at the back of the table for the yellow rubber glove with the middle finger turned inside out?

Alex could pull together a few simple concepts. Show him a group of objects and he could tell you, “What color is wood and four-corner?” or, “What shape is paper and purple?” Dr. Pepperberg was hoping to train Alex to spin his own recursions, informing her that the nut was “in the blue cup that’s on the tray” or “in the yellow box on the chair.”

“I wish we had gotten further,” Dr. Pepperberg wrote in an e-mail message. “We were just beginning to get him to designate things like ‘in’ and ‘on.’ ”

The deepest recursion is consciousness — knowing that you know and that you know that you know. In his recent book, “I Am a Strange Loop,” Douglas Hofstadter proposed that the richness of a creature’s mental representations be used to take the measure of its soul.

The unit Dr. Hofstadter whimsically proposed is the “huneker,” named for James Huneker, a music critic who wrote that Chopin’s 11th Étude, in A minor, (Op. 25) was so majestic that “small-souled men, no matter how agile their fingers, should not attempt it.”

If your average person’s soulfulness weighs in at 100 hunekers with a hamster down near 10, Alex hovered somewhere above the halfway mark. But there were moments when he seemed to reach for the top.

In an talk on Edge.org, Dr. Pepperberg told of an effort to teach the parrot about phonemes using colored tokens marked with letter combinations like sh and ch.

“What sound is green?”

“Ssshh,” Alex answered correctly, and then demanded a nut. Instead he got another question.

Dr. Pepperberg was flabbergasted. “Not only could you imagine him thinking, ‘Hey, stupid, do I have to spell it for you?’ ” she said. “This was in a sense his way of saying to us, ‘I know where you’re headed! Let’s get on with it.’ ”

She is quick to concede the impossibility of proving that the bird was actually verbalizing its internal deliberations. Only Alex knew for sure.

Next to infinity, one of the hardest concepts to grasp is zero. Toward the end of his life Alex may have been coming close.

In a carnival shell game, an experimenter would put a nut under one of three cups and then shuffle them around. Alex would pick up the cup where the prize was supposed to be. If it wasn’t there he’d go a little berserk — a small step, maybe, toward understanding nothingness.

A bigger leap came in an experiment about numbers, in which the parrot was shown groups of two, three and six objects. The objects within each set were colored identically, and Alex was asked, “What color three?”

Bingo. There was no group of five on the tray. It was another of those high huneker moments. Alex had learned the word “none” years before in a different context. Now he seemed to be using it more abstractly.

Dr. Pepperberg reported the result with appropriate understatement: “That zero was represented in some way by a parrot, with a walnut-sized brain whose ancestral evolutionary history with humans likely dates from the dinosaurs, is striking.”

In a well-known essay, “What Is it Like to Be a Bat?” the philosopher Thomas Nagel speculated about the elusiveness of subjectivity. What was it like to be Alex that last night in his cage? We’ll never know whether there really was a mind in there — slogging its way from the absence of a cork-nut to the absence of Alex, grasping at the zeroness of death.