[Haskell-cafe] Denotational semantics for the lay man.
claus.reinke at talk21.com
Tue Jan 18 01:44:40 CET 2011
>> 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.
"you know, once I wrote this program, and it just fried the printer.."
I think it is getting clearer..
usually, this means..
what does this button do?
I'm sure it means something.
I think this was meant to prevent..
let the dice decide
I'm sure this used to work
this can only mean..
oh, sure, it can mean that.
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
it don't mean a thing if it ain't got that swing.
this means nothing.
this could mean..
often, this means that..
you can't ask what it means.
this means something else.
since it cannot possibly mean anything else, ..
for the moment, this means that..
this means we can use it to..
this has always meant..
<sigh> I guess that means..
for us here, this means..
we shall meditate on the meaning of this.
More information about the Haskell-Cafe