You may want to inform yourself about human rights in China.

On Denotational, Operational and Axiomatic Semantics

date: 2024-07-14
Bethsabée, 1889. Oil on canvas, 60.5×100 cm (23.8×39.3 in). Louvre, Paris

Bethsabée, 1889. Oil on canvas, 60.5×100 cm (23.8×39.3 in). Louvre, Paris by Jean-Léon Gérôme through wikimedia.orgPublic domain

The notion of the syntax of a programming language is usually well-understood: it’s essentially the grammar, the rules for writing “correct” sentences within this language. Amusingly, the way people usually describe semantics is much less clear, for example:

In programming language theory, semantics is the rigorous mathematical study of the meaning of programming languages. Semantics assigns computational meaning to valid strings in a programming language syntax. It is closely related to, and often crosses over with, the semantics of mathematical proofs.

Semantics describes the processes a computer follows when executing a program in that specific language. This can be done by describing the relationship between the input and output of a program, or giving an explanation of how the program will be executed on a certain platform, thereby creating a model of computation.

– Wikipédia entry for Semantics (computer science), 2024-07-14

I think1 it’s safe to say that the core idea behind semantics is to connect the syntax of a program with some abstract ideas: we would describe equally the semantics of a natural language, where we’d try to connect symbols to ideas. Now, if we want to reach anything meaningful through this connection, we want to be rigorous, formal, and so the connection, and the abstract ideas must be mathematically sound.

This – mathematically connecting (the syntax) of a program with some mathematical objects – is called “denotational semantics”.

Then, there are two common special cases of denotational semantics:

  1. Operational semantics, where we create a link between (the syntax of) a program and some algorithmic formalism;
  2. Axiomatic semantics, where we create a link between (the syntax of) a program and some logical formalism;

One is finally left but to wonder as to why things are usually presented so confusingly. It seems that it’s merely because of the historical development of the subject: different people pushed things in different directions, aimed at different goals; each found in their own direction different tools and results, and progressively segmented the domain between operational/denotational/axiomatic.

So conceptually, denotational semantics is the real deal, and the other two are mere instances.

Note: Of course in the case of operational semantics, if you consider the case of teaching programming or writing compilers, you don’t always have a strict, precise mathematical model of the hardware, and things are a bit looser. Still rigorous though. But it’s a good enough approximation, especially in the context where semantics is discussed in terms of “operational/denotational/axiomatic semantics.”


  1. The essence of what I am presenting in this short note seems to be confirmed by the second part of this reddit comment; feel free to correct me. ↩︎


Comments

By email, at mathieu.bivert chez:

email