Hugh Pickens writes "The sense of humor is a ubiquitous human trait, yet rare or non-existent in the rest of the animal kingdom. But why do humans have a sense of humor in the first place? Cognitive scientist (and former programmer) Matthew Hurley says humor (or mirth, in research-speak) is intimately linked to thinking and is a critical task in human cognition because a sense of humor keeps our brains alert for the gaps between our quick-fire assumptions and reality. 'We think the pleasure of humor, the emotion of mirth, is the brain's reward for discovering its mistaken inferences,' says Hurley, co-author of Inside Jokes: Using Humor to Reverse-Engineer the Mind. With humor, the brain doesn't just discover a false inference — it almost simultaneously recovers and corrects itself. For example, read the gag that's been voted the funniest joke in the world by American men. So why is this joke funny? Because it is misleading, containing a small, faulty assumption that opens the door to a costly mistake. Humor is 'when you catch yourself in an error, like looking for the glasses that happen to be on the top of your head. You've made an assumption about the state of the world, and you're behaving based on that assumption, but that assumption doesn't hold at all, and you get a little chuckle.'"