ErgoTree Evaluation
Evaluation of is specified by its translation to , whose terms form a subset of terms. Thus, typing rules of form a subset of typing rules of .
Here we specify evaluation semantics of , which is based on call-by-value (CBV) lambda calculus. Evaluation of is specified using denotational semantics. To do that, we first specify denotations of types, then typed terms and then equations of denotational semantics.
▶Definition 1
Definition 1
The following terms are called values:
All terms are called producers. (This is because, when evaluated, they produce a value.)
We now describe and explain a denotational semantics for the language. The key principle is that each type denotes a set whose elements are the denotations of values of the type .
Thus the type denotes the 2-element set , because there are two values of type . Likewise the type denotes because a value of type must be of the form , where each is value of type .
Given a value of type , we write for the element of that it denotes. Given a close term of type , we recall that it produces a value of type . So will denote an element of .
A value of type is of the form . This, when applied to a value of type gives a value of type . So denotes. It is true that the syntax appears to allow us to apply to any term of type . But will be evaluated before it interracts with , so is really only applied to the value that produces.
▶Definition 2
Definition 2
A context is a finite sequence of identifiers with valuetypes. Sometimes we omit the identifiers and write as a list of value types.
- Given a context , an environment (list of bindings for identifiers) associates to each as value of type . So the environment denotes an element of , and we write for this set.
- Given a term , we see that , together with environment, gives a closed term of type . So denotes a function from to .
In summary, the denotational semantics is organized as follows.
- A type denotes a set
- A context denotes the set
- A term denotes a function :