There's a lot of psychology surrounding jokes, and I mean more than the usual stuff that deals with expectation and surprise and joy. Take, for example, the following joke:
A guy has a talking dog. He brings it to a talent scout. “This dog can speak English,” he claims to the unimpressed agent. “Okay, Sport,” the guys says to the dog, “what’s on the top of a house?” “Roof!” the dog replies. “Oh, come on…” the talent agent responds. “All dogs go ‘roof’.” “No, wait,” the guy says. He asks the dog “what does sandpaper feel like?” “Rough!” the dog answers. The talent agent gives a condescending blank stare. He is losing his patience. “No, hang on,” the guy says. “This one will amaze you. ” He turns and asks the dog: “Who, in your opinion, was the greatest baseball player of all time?” “Ruth!” goes the dog. And the talent scout, having seen enough, boots them out of his office onto the street. And the dog turns to the guy and says “Maybe I shoulda said DiMaggio?”
This is not the first time I've heard the joke, but it's the first time I've made a connection with something else: logic. Those of you who took some psychology might recognize the Wason selection task:
You are shown a set of four cards placed on a table each of which has a number on one side and a colored patch on the other side. The visible faces of the cards show 3, 8, red and brown. Which cards should you turn over in order to test the truth of the proposition that if a card shows an even number on one face, then its opposite face shows a primary color?
Wikipedia gives the solution as well as interpretations of the test:
The correct response is that the cards showing 8 and brown must be inverted, but no other card. [...] If we turn over the card labelled "3" and find that it is red, this does not invalidate the rule. Likewise, if we turn over the red card and find that it has the label "3", this also does not make the rule false. On the other hand, if the brown card has the label "4", this invalidates the rule: It has an even number, and does not have a primary colour. [...]
[...] By contrast, some (though not all) Wason tasks prove much easier when they are presented in a context of social relations. For example, if the rule "Only people over 18 are allowed to drink alcohol" is set up as a card game with age on one side and beverage on the other, the cards might be 17, beer, 22, coke. Most people have no difficulty in selecting the correct cards (17 and beer) that must be turned over to test the rule. [...]
It turns out that for the talent scout to determine whether the dog can speak, similar logic is applied. The proposition to validate in this case is, "if the dog could say words outside of homonyms with 'woof', then the dog could speak." Notice that the antecedent is specific to "words" that normal dogs couldn't speak. If the talent scout had believed the dog could talk based on the questions in the joke, it would be the equivalent of him turning over the card labeled 3. The scout would, in other words, be affirming the consequent.
But I don't suppose joke listeners think about all that.