Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Shared notation

This page defines the meta-notation reused across the other denotational-semantics pages. Read this first.

In plain terms

We use two complementary notations:

  • Inference rules, of the form , define a relation (typically a typing relation ) inductively as the smallest relation closed under the rules.
  • Semantic equations, of the form , define a function by structural recursion on the syntax. The double brackets emphasise that we are speaking of meaning, not surface text.

The DSL pages in this cluster present the type system as inference rules and the value semantics as semantic equations: the standard denotational idiom, in the sense of Scott and Strachey. Where evaluation can fail to terminate, we lift the value domain to so that is total.

A context (also called an environment) is a finite map from names to data. Typing contexts map variable names to types; evaluation contexts map variable names to values; theory contexts map sort names to their definitions.

Environments

Three environment kinds appear repeatedly:

  • : a typing environment mapping variable names to types. Notation: extends with a fresh binding .
  • : a value environment mapping variable names to values. Notation: extends with .
  • : a theory context mapping sort names to their definitions in a GAT. Used in the theory DSL and in the pushout construction.

A judgement of the form asserts that under typing context , the expression has type . We do not use a separate evaluation judgement in this cluster: evaluation is presented as the semantic function rather than as a relation.

Inference rules

An inference rule has the form

Each premise and the conclusion are judgements. The rule asserts that whenever the premises hold, the conclusion follows. A derivation is a tree of rule applications whose leaves are axioms (rules with no premises) and whose root is the judgement being proved.

Semantic functions

The semantic function for a syntactic category is written where is the semantic domain. The subscript is omitted when context determines the category.

Common semantic functions:

  • : the set of values of type .
  • : the meaning of expression under value environment , where adjoins a bottom element to handle non-terminating or budget-exceeded computations.
  • : the meaning of a lens as a triple of functions.
  • : the category-with-families generated by a GAT presentation.

The bottom element

In the expression language, evaluation is total within a step budget but the budget can be exceeded. We model this by adjoining a bottom element to the value domain: . Reaching corresponds to ExprError::StepLimitExceeded at runtime.

Equality

Equality between values, types, and theories is definitional unless otherwise stated. Equality between schemas is structural up to alpha-renaming of bound names. Equality between morphisms is judgemental: when and have the same source, the same target, and agree on every input.

See also

  • Expression language for the first user of these conventions.
  • The other pages in this cluster all build on these conventions.