[Haskell-cafe] Denotational semantics for the lay man.

>> I've recently had the opportunity to explain in prose what denotational >> semantics are to a person unfamiliar with it. I was trying to get across >> the concept of distilling the essence out of some problem domain. I >> wasn't able to get the idea across so I'm looking for some simple ways >> to explain it. Trying to explain things to a layperson is often a useful exercise. So here goes my attempt: Semantics are all about relating two partially understood structures to each other, in the hope of reaching a better understanding of both. Often, the plan is to translate a problem systematically from a less well-understood domain to a domain whose tools are more amenable to solving the problem, then to translate the solution back to the original domain (and originally, just about anything was better understood than programming). In the beginning, the meaning of a program was what it caused a certain machine to do - nothing to relate to but experience. Then there were specifications of how conforming machines were supposed to execute a given program, so one could compare a given machine against the specification. Mathematicians tried to relate programs to mathematical objects (traditionally functions), which they thought they understood better, only to learn a thing or two about both programs and functions. Programs for concrete machines were related to programs for abstract machines, or concrete program runs to abstract program executions, in order to focus only on those aspects of program executions relevant to the problem at hand. Programs were related to conditions in a logic, to allow reasoning about programs, or programming from proofs. And so on.. The two main questions are always: how well do the semantics model reality, and how well do programs express the semantics? It helps if the mappings back and forth preserve all relevant structure and elide any irrelevant details. Claus anecdotal semantics: "you know, once I wrote this program, and it just fried the printer.." barometric semantics: I think it is getting clearer.. conventional semantics: usually, this means.. detonational semantics: what does this button do? existential semantics: I'm sure it means something. forensic semantics: I think this was meant to prevent.. game semantics: let the dice decide historical semantics: I'm sure this used to work idealistic semantics: this can only mean.. jovial semantics: oh, sure, it can mean that. knotty semantics: hm, this part over here probably means.. looking glass semantics: when I use a program, it means just what I choose it to mean, neither more nor less musical semantics: it don't mean a thing if it ain't got that swing. nihilistic semantics: this means nothing. optimistic semantics: this could mean.. probabilistic semantics: often, this means that.. quantum semantics: you can't ask what it means. reactionary semantics: this means something else. sherlockian semantics: since it cannot possibly mean anything else, .. transitional semantics: for the moment, this means that.. utilitarian semantics: this means we can use it to.. venerable semantics: this has always meant.. weary semantics: <sigh> I guess that means.. xenophobic semantics: for us here, this means.. yogic semantics: we shall meditate on the meaning of this. zen semantics: ah!