Math 2.0

Computer science Definition

Operational semantics

Builds on Binary relation

Definition

Let LL be a language given by a grammar. Let ๐’ž\mathcal{C} be a set of configurations, such as programs or pairs โŸจp,sโŸฉ\langle p, s \rangle of a program pp and a state ss. Let โ„ฑโІ๐’ž\mathcal{F} \subseteq \mathcal{C} be a subset of final configurations. A small-step operational semantics of LL is a binary relation โ†’\to on ๐’ž\mathcal{C}, called the transition relation. It is defined as the least relation closed under a set of inference rules that follow the syntax of LL. No final configuration has a transition. A program pp evaluates to a final configuration cc if pโ†’โˆ—cp \to^* c, where โ†’โˆ—\to^* is the reflexive transitive closure of โ†’\to. A big-step operational semantics is instead a relation pโ‡“vp \Downarrow v between configurations and final configurations. It is again the least relation closed under a set of inference rules.

Remarks

Example: take the expressions e::=nโˆฃe+ee ::= n \mid e + e with numerals nn, and let the final configurations be the numerals. Take three rules. First, n1+n2โ†’nn_1 + n_2 \to n, where nn is the sum of n1n_1 and n2n_2. Second, if e1โ†’e1โ€ฒe_1 \to e_1' then e1+e2โ†’e1โ€ฒ+e2e_1 + e_2 \to e_1' + e_2. Third, if e2โ†’e2โ€ฒe_2 \to e_2' then n1+e2โ†’n1+e2โ€ฒn_1 + e_2 \to n_1 + e_2'. Then (1+2)+4โ†’3+4โ†’7(1 + 2) + 4 \to 3 + 4 \to 7, by the second rule and then the first. The matching big-step rules are nโ‡“nn \Downarrow n, and e1+e2โ‡“ne_1 + e_2 \Downarrow n if e1โ‡“n1e_1 \Downarrow n_1, e2โ‡“n2e_2 \Downarrow n_2 and nn is the sum of n1n_1 and n2n_2.

Non-example: adding the rule nโ†’nn \to n for every numeral nn breaks the condition that final configurations have no transitions. With it, 7โ†’7โ†’7โ†’โ‹ฏ7 \to 7 \to 7 \to \cdots, so a finished computation could still step forever, and termination could no longer be read off the relation.

A configuration cโˆ‰โ„ฑc \notin \mathcal{F} with no transition is stuck. For deterministic languages the small-step and big-step forms usually agree: pโ†’โˆ—vp \to^* v with vv final if and only if pโ‡“vp \Downarrow v.

Reading path

To understand this page from the ground up, read these 2 pages in order. The foundations come first.

Show the path as a graph
Each page uses the pages above it. The colour of the bar on a box shows how strong the evidence is, and the box also gives it as text. The list has the same pages.
  • no evidence level
  1. Binary relation concept
  2. Operational semantics definition

Further reading

  1. Web https://en.wikipedia.org/wiki/Operational_semantics
About this page
TagBFPS9ZT8QR
URIm2://BFPS9ZT8QR
Kinddefinition
WritingW0 stub
MSC68Q55, 68N15
DefinesOperational semantics
UsesBinary relation
Changed3 November 2026

Markdown ยท JSON ยท Edit on GitHub

What this page needs for W1

  • a source with a locator (0 of 1)

The writing levels say how complete the text of a page is. They do not measure its truth.

What links here

No page links to this page yet.