Evaluating continuation computations #
ContT.eval finishes a continuation computation by handing it the
trivial continuation pure — [Cha14b]'s Lowering, Haskell's
evalCont, the LOWER of [BS14]. The eval_* simp lemmas
mirror ContT's run_* set: a chain of binds evaluates in bind order
and the applicative combination left-to-right, which is what lets bind
order model quantifier scope. ContT.reset evaluates and re-lifts,
delimiting scope the way scope islands do. For the linguistic
applications see Studies/BumfordCharlow2024.lean and
Studies/Charlow2020.lean.
References #
Interaction with the monad operations #
Evaluating lifted computations #
theorem
ContT.eval_seq_monadLift
{r α β : Type u}
{m : Type u → Type v}
[Monad m]
[LawfulMonad m]
(f : α → β → r)
(x : m α)
(y : m β)
:
(f <$> monadLift x <*> monadLift y).eval = f <$> x <*> y
Lifting, combining, and evaluating is just combining in m:
scopal combination subsumes applicative combination.