Humor is the way in which people see that some things are amusing or the ability to be amused by things. Humor and jokes are an interesting phenomenon in human causal reasoning and cognition based on false causality that lead to an amusing surprise.
A humor is a surprisingly realized false causality on the basis of semantic ambiguities in reasoning and comprehension. The essence of a humor is a revealed false causality.
Nice question. Suslov (1992) has an elegant computational theory of humor and joke parsing based on surprisal that is pleasurable (http://arxiv.org/pdf/0711.2058.pdf). For modelling the online comprehension of a joke, he characterizes the divergence from the top 'path' that you initially choose when taking your first parse of the meaning of an utterance and the final path you must eventually take to compute the meaning, as the 'funniness' of the joke. The pleasure lies in the re-computation you have to do when the 'punch line' is delivered, which is something we needn't do when parsing normal utterances. We enjoy being led down the garden path of a predictable parse path, and then have it violated by the joke-teller.
He also mentions tickling as a case-in-point in pleasurable unpredictability. One cannot tickle oneself for the reason that you can predict your own motion without expectation violation, whereas you cannot predict another person's motion when they are deliberately moving erratically. It is not the speed, movement and feel of tickling that is funny per se, it's the fact you cannot *predict* these things easily from one moment to the next that makes this pleasurable. I suppose his account comes with an overarching caveat that surprisal can also be bad (seeing a predator you haven't seen before is scary), but when in a situation where the violation of expectation is not threatening (and is guaranteed to be over), it can be pleasurable.
I think this is a good way to go about modelling punchline-based jokes, and the notion of surprisal, perhaps using information theoretic methods, could be a way to explore other forms of humor. For example it could be possible to model situational comic irony as a sharp violation of at least one predictable element of a situation- it's not simply the fact that you are encountering a new subtype of a familiar situation that makes it funny (this happens all the time), it's the fact that the situation has a predictable set of features, and in a funny situation, at least one of these elements is sufficiently differently valued (and surprising) given the prior expected distribution of values, that makes it funny.