A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Operational Semantics

Research Depth 93 in the knowledge graph I know this Set as goal
3topics build on this
439prerequisites beneath it
See this on the map →
Introduction to Predicate Logic (First-Order Logic)Programming Language Semantics+1 moreCertified CompilationDenotational Semantics and Fixed Points+1 more
small-step big-step structural-operational-semantics transition-rules evaluation-judgments sos

Core Idea

Operational semantics defines the meaning of programs by specifying how they execute, step by step. Small-step (structural) operational semantics defines a transition relation that reduces a program configuration by one computational step at a time, making evaluation order and intermediate states explicit. Big-step (natural) operational semantics defines a relation that maps a program directly to its final result, abstracting away intermediate steps. Both are formalized as inference rules that inductively define the evaluation relation. Operational semantics provides the rigorous mathematical foundation upon which Hoare logic, type soundness proofs, and abstract interpretation are built -- without a formal definition of what programs mean, reasoning about program correctness is informal at best.

Explainer

Programming languages need precise definitions of what their programs mean. Informal English descriptions are ambiguous -- does `x++ + x++` in C evaluate left-to-right, right-to-left, or is it undefined? Operational semantics answers such questions by defining a mathematical relation that specifies exactly how programs execute. There are two main styles, both formalized as sets of inference rules.

Small-step operational semantics (also called structural operational semantics or SOS, after Plotkin's 1981 framework) defines a transition relation `->` on configurations. A configuration pairs a program fragment with a state (variable assignments, heap, etc.). Each rule specifies one atomic computation step. For example, the rule for addition says: if both operands are integer values n1 and n2, then `n1 + n2 -> n` where n is their sum. If the left operand is not yet a value, a congruence rule says `e1 + e2 -> e1' + e2` whenever `e1 -> e1'`, specifying left-to-right evaluation order. Full program execution is the reflexive-transitive closure `->*` of the single-step relation: starting from the initial configuration, repeatedly apply transition rules until no rule applies (the program is stuck or has produced a final value).

Big-step operational semantics (also called natural semantics, after Kahn's 1987 formulation) defines an evaluation relation `=>` that maps a configuration directly to a final value. The rule for addition says: if `e1 => n1` and `e2 => n2`, then `e1 + e2 => n1 + n2`. The derivation tree for a big-step judgment mirrors the recursive call structure of an interpreter. Big-step semantics is often more concise and intuitive for deterministic, terminating languages -- it reads almost like a recursive interpreter specification. However, it cannot naturally express non-termination (there is simply no derivation for a diverging program) or distinguish stuck programs from diverging ones. It also struggles with concurrency and interleaving, where intermediate states matter.

The choice between small-step and big-step depends on what you need to reason about. Small-step is essential when intermediate states are observable or important: concurrency (interleaving of steps from different threads), type soundness proofs (progress: "well-typed programs can always take a step"), and reasoning about non-termination. Big-step is preferred for simple languages or when you only care about input-output behavior. Many formalizations use both: big-step for the deterministic core language, small-step for the concurrency and control-flow extensions. The two styles can be shown equivalent for terminating, deterministic programs: if `e =>* v` in big-step, then `e ->* v` in small-step, and vice versa.

Operational semantics is not just a theoretical exercise -- it is the foundation on which formal verification rests. Hoare logic's soundness theorem is stated with respect to the operational semantics: `{P} C {Q}` means that for all states sigma satisfying P, if `(C, sigma) ->* (skip, sigma')`, then sigma' satisfies Q. Abstract interpretation's soundness is proved by showing the abstract transfer functions over-approximate the concrete transitions defined by the operational semantics. Type soundness (via progress and preservation) is entirely a statement about the operational transition relation. Without a formal semantics, verification is informal reasoning about an informal object -- operational semantics makes it rigorous mathematics about a mathematical object. This is why Plotkin's SOS framework is one of the most cited papers in programming language theory: it gave the field its mathematical foundation.

Practice Questions 4 questions

Prerequisite Chain

Understanding ZeroThe Number ZeroCounting to FiveCounting to 10Counting to 20Counting a Set of Objects Up to 20Cardinality: The Last Number CountedMatching Numerals to QuantitiesSubitizing Small QuantitiesAddition Within 10Number Bonds to 10Addition Within 20Doubles and Near DoublesDoubles Facts Within 10Near Doubles Facts Within 20Mental Math Strategies for AdditionMental Math: Adding and Subtracting TensAddition Within 100Repeated Addition as MultiplicationMultiplication as Equal GroupsMultiplication: ArraysBasic Multiplication Facts (0s, 1s, 2s, 5s, 10s)Multiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Multiplication and Division Fact FamiliesRelationship Between Multiplication and DivisionDivision Facts as Inverse of MultiplicationRemainders and Quotients in DivisionDivision Word ProblemsMulti-Step Word ProblemsSolving Multi-Step Word ProblemsMultiplication Word ProblemsDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueIntegers and the Number LineComparing and Ordering IntegersAbsolute ValueAdding IntegersSubtracting IntegersMultiplying IntegersIntroduction to ExponentsOrder of OperationsInteger Order of OperationsVariable ExpressionsThe Distributive PropertyVariables and Expressions ReviewIntroduction to PolynomialsAdding and Subtracting PolynomialsMultiplying PolynomialsFactorialPermutationsCombinationsCounting Principles: Addition and Multiplication RulesIntroduction to Graph TheoryPropositional Logic FoundationsLogical EquivalencesBoolean AlgebraBoolean Type and Truth ValuesComparison Operators and Boolean TestsLogical Operators and Boolean AlgebraBoolean Algebra and Fundamental LawsLogic Gates FundamentalsImplementing Boolean Functions with GatesKarnaugh Map SimplificationCombinational Circuit DesignFlip-Flops and LatchesFinite State Machines (FSMs)Deterministic Finite Automata (DFA)Nondeterministic Finite Automata (NFA)Two-Way Finite AutomataNFA to DFA Conversion (Subset Construction)DFA Properties and Minimization AlgorithmsRegular Languages: Definition and CharacterizationContext-Free Grammars (CFGs)Context-Free Grammar Properties and AmbiguityParse Trees, Derivations, and Ambiguity in CFGsContext-Free Grammars in Compiler DesignCompiler Phases and OrganizationGrammar Design for CompilationDomain-Specific Language Design and ImplementationProgramming Language SemanticsOperational Semantics

Longest path: 94 steps · 439 total prerequisite topics

Prerequisites (3)

Leads To (3)