Is Artificial Intelligence possible? Alan Turing famously paraphrased this question as "Can a machine think?", but I think this is the wrong question, because the answer is obviously yes. For over half a century, machines have been performing feats of logic and arithmetic that in any other age would have been considered remarkable acts of cogitation. We even have some useless machines, called neural nets, whose thought processes are almost as obscure and impenetrable as our own. Indeed, such is the amount of evidence for electronic thought that one senses a 'God of the gaps' phenomenon at work among opponents of AI, the criteria for 'intelligent thought' shrinking into ever-smaller crevices. No amount of such evidence will convince the true skeptic that machines are intelligent: they can think all they like, but machines will always lack that spark of humanity.

To satisfy these people, I propose a different question: Can a machine laugh? For if anything is the spark of humanity, it is surely laughter, long-cherished as a uniquely human ability (even though dogs and other social mammals do it too). No matter how well it plays chess, we're far more likely to believe a machine is intelligent if it cracks up at Father Loves Beaver. We tend to judge other humans intelligent if they laugh when we do, and especially intelligent if they laugh only when we do. In some human societies, a sense of humour is held sacred like nothing else. In the British Isles, people would sooner admit to incest than admit to having no sense of humour. Indeed, a sense of humour is considered much the same thing as a sense of humanity. Such traits as compassion, humaneness and so on are ranked far behind, and 'intelligent thought' doesn't even get a look in.

Before I attempt to answer my question, we should first clarify something about laughter. Laughter is a physiological phenomenon, natural and spontaneous; infants can laugh before they can speak. In humans and other laughing animals, laughter often accompanies play; children laugh more than adults, and more easily. Laughter is usually a form of communication -- people rarely laugh alone. It usually communicates playful intent, and by extension is a non-threatening, friendly communication. It's hard to laugh with someone you dislike.

Perhaps surprisingly, laughter is usually not associated with humour. Studies have revealed that most human laughter is not prompted by funny things: in observations, laughter most often followed harmless utterances like "Hello John!", "I saw Karen at the bank yesterday", "See you Wednesday!" and the like, reinforcing the idea that laughter is a form of friendly communication. The physical act of laughter isn't even always associated with pleasure; certain people suffer from uncontrollable laughter, extended laughing fits accompanied by feelings of fear and nervousness.

With this information in mind, I hope we can convince the AI skeptic that laughter itself can be considered a secondary problem. I propose an amendment to my question: Can a machine identify something funny? If yes, it could then call on its laughter module to execute a smirk, a giggle, or a guffaw as appropriate, and we would then have a machine with a rudimentary sense of humour, certainly enough to watch the average sitcom.

What makes something funny? There are two main, related, theories. The first is that humour results from incongruity. The funny is the unexpected, the surprising: the chimp in the White House, the fart in a cathedral. To know what is unexpected, one has to know what is expected, and this requires an awareness of shared cultural and social information. In a way, humour can be a conservative influence, reinforcing the existing cultural and social state more than it undermines, drawing a clear line between the normal and the deviant, the accepted and the taboo. The more rules there are for accepted standards, and the more rigidly they apply, the more room for humour. It's striking how many jokes in the British Empire are about sexual mores -- were cocks and tits as intrinsically funny in Ancient Greece?

Of course, while 'incongruity' may be necessary for comedy, it is not in itself sufficient. There is often a fine line between funny incongruity and incongruity which is unremarkable or horrific. This line is socially and culturally determined, and is increasingly being explored by 'dark' comedies, such as The League of Gentlemen with its hilarious cow-disembowelling visual gags. To those outside the intended audience, such as myself, such humour can appear to miss the line completely; for others it defines the line, thus defining one's sense of humanity as the ability to laugh at dead animals.

The other theory of humour, compatible with the first, is that it is a device for establishing superiority in some social interaction. As the submissive dog puts his tail between his legs, so the fool makes jokes for his master. In a different context, laughing at some other group or individual helps foster a sense of group superiority, identity, and togetherness. Humour flatters one's intelligence and status; it marks one out as belonging to a group. In this sense, all jokes are in-jokes, and this can be observed in real life. Humour often has difficulty crossing national boundaries, linguistic boundaries, and boundaries of age or even gender. Such concepts as 'British' humour or 'American' humour tend to reinforce national identity. On a related note, studies have shown that people tend to perceive comedy as funnier when they are in a group of people laughing. People tend to find something funny if other people find it funny too. As agents realised long ago, hype makes comedy funnier.

It should now be clear that identifying humour, and laughing at it, is a kind of learned social behaviour, much like hypnosis. Children laugh easily and laugh at almost anything, but as we grow up we learn to discriminate, to acquire a sense of humour, to take on certain social roles -- clown, audience, victim -- as appropriate. Much like hypnosis, comedy works only if you believe in it. Watch an episode of Little Britain while thinking David Walliams is an unfunny, talentless twat, and you won't laugh once. Try it!

In the world of Artificial Intelligence, this kind of learned behaviour is well within the reach of existing machine learning techniques. It would not be especially difficult to build a simple multi-agent system with agents that could identify certain input stimuli, based on some familiar algorithm, as incongruous. If the incongruity falls within a certain 'sense of humour' band -- initially randomized and different for each agent -- the agent could laugh, communicating to other agents that it sees something funny. Based on their own humour band and some other algorithm, the other agents could then choose to laugh or not, and the more agents who laugh, the more the bands are adjusted. Eventually the agents will agree on a sense of humour, perhaps increasingly refined, and even form subgroups with shared senses of humour, all of which can change over time.

And so the answer is yes, machines can identify humour! The above is a very simple model, of course: we can extend it to include different threshholds for different stimuli, different generations of agents, and many other arbitrarily complex interactions. Eventually I have no doubt that one could train such a system to laugh in all the right places at Arrested Development, or maybe even The Office. I fear the AI skeptic would still not be convinced, and claim that these are not intelligent beings, but just a bunch of laughing machines. But then I felt much the same that time I went to see Notting Hill.