Core_lambdae.AstSyntax and runtime values of the explicit-environment core calculus.
Recursive type variables use de Bruijn indices: TVar 0 denotes the nearest enclosing TMu. Whole types should be closed; Fold stores only a mu body.
Equality accepts matching primitive types; arithmetic and ordering use integers, and Cat concatenates strings.
type exp = | Query| Proj of exp * int| Lit of lit| Unit| Lam of typ * expThe body runs with the argument appended to the captured environment.
*)| Box of exp * expEvaluate the second expression under the first expression's value.
*)| Clos of exp * typ * expCaptured environment, argument type, body; the environment is a value.
*)| App of exp * exp| Mrg of exp * expThe right operand sees the left operand's value appended to its ambient environment.
*)| Lrec of string * exp| Rproj of exp * string| Binop of binop * exp * exp| If of exp * exp * exp| Inl of typ * expInl (b, e) supplies the other summand b.
| Inr of typ * expInr (a, e) supplies the other summand a.
| Case of exp * exp * expEach branch receives the injection payload at index zero.
*)| Flam of typ * typ * expArgument type, result type, body. The body sees its argument at index zero and the recursive function at index one.
*)| Fclos of exp * typ * typ * expRecursive closure with a captured value environment.
*)| Fold of typ * expFold (body, e) has type TMu body; the annotation is the mu body.
| Unfold of exp| Hostfn of string * typ * typHost capability name, argument type, result type. Application uses Eval.host_dispatch; the annotation does not validate the host code.
Environments are values, conventionally a left-associated Mrg chain rooted at Unit. Query denotes the whole environment. Positional index zero selects the right component of a merge; further indices follow its left spine, never selecting the terminal base itself.
val is_value : exp -> boolThe runtime value predicate, including recursively valued environments and payloads. It does not check types or closure bodies.