Operational semantics
Operational semantics is a category of formal programming language semantics in which certain desired properties of a program, such as correctness, safety or security, are verified by constructing proofs from logical statements about its execution and procedures, rather than by attaching mathematical meanings to its terms (denotational semantics).[src] Operational semantics are classified in two categories: structural operational semantics (or small-step semantics) formally describe how the individual steps of a computation take place in a computer-based system; by opposition natural semantics (or big-step semantics) describe how the overall results of the executions are obtained.[src] Other approaches to providing a formal semantics of programming languages include axiomatic semantics, denotational semantics, and algebraic semantics.[src] The operational semantics for a programming language describes how a valid program is interpreted as sequences of computational steps.[src] These sequences then are the meaning of the program.[src] In the context of functional programming, the final step in a terminating sequence returns the value of the program.…[src]
Operational semantics is a category of formal programming language semantics in which certain desired properties of a program, such as correctness, safety or security, are verified by constructing proofs from logical statements about its execution and procedures, rather than by attaching mathematical meanings to its terms (denotational semantics).[src] Operational semantics are classified in two categories: structural operational semantics (or small-step semantics) formally describe how the individual steps of a computation take place in a computer-based system; by opposition natural semantics (or big-step semantics) describe how the overall results of the executions are obtained.[src] Other approaches to providing a formal semantics of programming languages include axiomatic semantics, denotational semantics, and algebraic semantics.[src] The operational semantics for a programming language describes how a valid program is interpreted as sequences of computational steps.[src] These sequences then are the meaning of the program.[src] In the context of functional programming, the final step in a terminating sequence returns the value of the program.[src] (In general there can be many return values for a single program, because the program could be nondeterministic, and even for a deterministic program there can be many computation sequences since the semantics may not specify exactly what sequence of operations arrives at that value.) Perhaps the first formal incarnation of operational semantics was the use of the lambda calculus to define the semantics of Lisp.[src] Abstract machines in the tradition of the SECD machine are also closely related.[src] \frac{\langle E,s\rangle \Rightarrow V}{\langle L:=E\,,\,s\rangle\longrightarrow (s\uplus (L\mapsto V))} Informally, the rule says that "if the expression E in state s reduces to value V , then the program L:=E will update the state s with the assignment L=V ".[src] The semantics of sequencing can be given by the following three rules: 1.[src] \frac{\langle C_1,s\rangle \longrightarrow s'} {\langle C_1;C_2 \,,s\rangle\longrightarrow \langle C_2, s'\rangle} 2.[src] \frac{\langle C_1,s\rangle \longrightarrow \langle C_1',s'\rangle} {\langle C_1;C_2 \,,s\rangle\longrightarrow \langle C_1';C_2\,, s'\rangle} 3.[src] \frac{} {\langle \mathbf{skip} ,s\rangle\longrightarrow s} Informally, the first rule says that, if program C_1 in state s finishes in state s' , then the program C_1;C_2 in state s will reduce to the program C_2 in state s' .[src] (You can think of this as formalizing "You can run C_1 , and then run C_2 using the resulting memory store.) The second rule says that if the program C_1 in state s can reduce to the program C_1' with state s' , then the program C_1;C_2 in state s will reduce to the program C_1';C_2 in state s' .[src] (You can think of this as formalizing the principle for an optimizing compiler: "You are allowed to transform C_1 as if it were stand-alone, even if it is just the first part of a program.") The semantics is structural, because the meaning of the sequential program C_1;C_2 , is defined by the meaning of C_1 and the meaning of C_2 .[src] If we also have Boolean expressions over the state, ranged over by B , then we can define the semantics of the while command: \frac{\langle B,s\rangle \Rightarrow \mathbf{true}}{\langle\mathbf{while}\ B\ \mathbf{ do }\ C,s\rangle\longrightarrow \langle C;\mathbf{while}\ B\ \mathbf{do}\ C,s\rangle} \quad \frac{\langle B,s\rangle \Rightarrow \mathbf{false}}{\langle\mathbf{while}\ B\ \mathbf{ do }\ C,s\rangle\longrightarrow s} Such a definition allows formal analysis of the behavior of programs, permitting the study of relations between programs.[src] Important relations include simulation preorders and bisimulation.[src] These are especially useful in the context of concurrency theory.[src] Thanks to its intuitive look and easy-to-follow structure, SOS has gained great popularity and has become a de facto standard in defining operational semantics.[src] As a sign of success, the original report (so-called Aarhus report) on SOS (Plotkin81) has attracted more than 1000 citations according to the CiteSeer making it one of the most cited technical reports in Computer Science.[src] \mathbf{let\ rec}\ x = v_1\ \mathbf{in}\ x \leftarrow v_2;\ e\ \ \longrightarrow\ \ \mathbf{let\ rec}\ x = v_2\ \mathbf{in}\ e To get an assignment statement into such a position it is “bubbled up” through function applications and the right-hand side of assignment statements until it reaches the proper point.[src] Since intervening \mathbf{let} expressions may declare distinct variables, the calculus also demands an extrusion rule for \mathbf{let} expressions.[src] Most published uses of reduction semantics define such “bubble rules” with the convenience of evaluation contexts.[src] For example, the grammar of evaluation contexts in a simple call by value language can be given as E ::= [\,\ \big|\ v\ E\ \big|\ E\ e\ \big|\ x \leftarrow E \ \big|\ \mathbf{let\ rec}\ x = v\ \mathbf{in}\ E\ \big|\ E;\ e where e denotes arbitrary expressions and v denotes fully-reduced values.[src] Each evaluation context includes exactly one hole [\,] into which a term is plugged in a capturing fashion.[src] The shape of the context indicates with this hole where reduction may occur.[src] To describe “bubbling” with the aid of evaluation contexts, a single axiom suffices: E[\,x \leftarrow v;\ e\,]\ \ \longrightarrow\ \ x \leftarrow v;\ E[\,e\,] \qquad \text{(lift assignments)} This single reduction rule is the lift rule from Felleisen and Hieb's lambda calculus for assignment statements.[src] The evaluation contexts restrict this rule to certain terms, but it is freely applicable in any term, including under lambdas.[src] Following Plotkin, showing the usefulness of a calculus derived from a set of reduction rules demands (1) a Church-Rosser lemma for the single-step relation, which induces an evaluation function, and (2) a Curry-Feys standardization lemma for the transitive-reflexive closure of the single-step relation, which replaces the non-deterministic search in the evaluation function with a deterministic left-most/outermost search.[src] Felleisen showed that imperative extensions of this calculus satisfy these theorems.[src] Consequences of these theorems are that the equational theory—the symmetric-transitive-reflexive closure—is a sound reasoning principle for these languages.[src] However, in practice, most applications of reduction semantics dispense with the calculus and use the standard reduction only (and the evaluator that can be derived from it).[src] Reduction semantics are particularly useful given the ease by which evaluation contexts can model state or unusual control constructs (e.g., first-class continuations).[src] In addition, reduction semantics have been used to model object-oriented languages, contract systems, exceptions, futures, call-by-need, and many other language features.[src] A thorough, modern treatment of reduction semantics that discusses several such applications at length is given by Matthias Felleisen, Robert Bruce Findler and Matthew Flatt in Semantics Engineering with PLT Redex.[src] ===Big-step semantics=== ====Natural semantics==== Big-step structural operational semantics is also known under the names natural semantics, relational semantics and evaluation semantics.[src] Big-step operational semantics was introduced under the name natural semantics by Gilles Kahn when presenting Mini-ML, a pure dialect of ML.[src] One can view big-step definitions as definitions of functions, or more generally of relations, interpreting each language construct in an appropriate domain.[src] Its intuitiveness makes it a popular choice for semantics specification in programming languages, but it has some drawbacks that make it inconvenient or impossible to use in many situations, such as languages with control-intensive features or concurrency.[src] A big-step semantics describes in a divide-and-conquer manner how final evaluation results of language constructs can be obtained by combining the evaluation results of their syntactic counterparts (subexpressions, substatements, etc.).[src] Gordon D.[src] Plotkin.[src] A Structural Approach to Operational Semantics.[src] (1981) Tech.[src] Rep.[src] DAIMI FN-19, Computer Science Department, Aarhus University, Aarhus, Denmark.[src] (Reprinted with corrections in J.[src] Log.[src] Algebr.[src] Program.[src] 60-61: 17-139 (2004), (preprint).[src] Gordon D.[src] Plotkin.[src] The Origins of Structural Operational Semantics.[src] J.[src] Log.[src] Algebr.[src] Program.[src] 60-61:3-15, 2004.[src] (preprint).[src] Dana S.[src] Scott.[src] Outline of a Mathematical Theory of Computation, Programming Research Group, Technical Monograph PRG–2, Oxford University, 1970.[src] Adriaan van Wijngaarden et al.[src] Revised Report on the Algorithmic Language ALGOL 68.[src] IFIP.[src] 1968.[src] * Matthew Hennessy.[src] Semantics of Programming Languages.[src] Wiley, 1990.[src] [https://www.cs.tcd.ie/matthew.hennessy/splexternal2015/resources/sembookWiley.pdf available online.[src] ==External links==[src]
78 sentences · 78 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Operational semantics." encyclopegia.org, 2026, https://encyclopegia.org/wiki/operational-semantics. Accessed 26 November 2026.
Chicago
"Operational semantics." encyclopegia.org. Accessed November 26, 2026. https://encyclopegia.org/wiki/operational-semantics.
APA
encyclopegia.org. (2026). Operational semantics. Retrieved November 26, 2026, from https://encyclopegia.org/wiki/operational-semantics
Accessed November 26, 2026 · CC BY-SA 4.0 · citation page · JSON