4 research outputs found
Bar recursion is not computable via iteration
We show that the bar recursion operators of Spector and Kohlenbach,
considered as third-order functionals acting on total arguments, are not
computable in Goedel's System T plus minimization, which we show to be
equivalent to a programming language with a higher-order iteration construct.
The main result is formulated so as to imply the non-definability of bar
recursion in T + min within a variety of partial and total models, for instance
the Kleene-Kreisel continuous functionals. The paper thus supplies proofs of
some results stated in the book by Longley and Normann.
The proof of the main theorem makes serious use of the theory of nested
sequential procedures (also known as PCF Boehm trees), and proceeds by showing
that bar recursion cannot be represented by any sequential procedure within
which the tree of nested function applications is well-founded.Comment: 43 pages, 5 figure
Effects for Efficiency: Asymptotic Speedup with First-Class Control
We study the fundamental efficiency of delimited control. Specifically, we
show that effect handlers enable an asymptotic improvement in runtime
complexity for a certain class of functions. We consider the generic count
problem using a pure PCF-like base language and its extension with
effect handlers . We show that admits an asymptotically
more efficient implementation of generic count than any
implementation. We also show that this efficiency gap remains when
is extended with mutable state. To our knowledge this result is the first of
its kind for control operators
The recursion hierarchy for PCF is strict
We consider the sublanguages of Plotkin's PCF obtained by imposing some bound
k on the levels of types for which fixed point operators are admitted. We show
that these languages form a strict hierarchy, in the sense that a fixed point
operator for a type of level k can never be defined (up to observational
equivalence) using fixed point operators for lower types. This answers a
question posed by Berger. Our proof makes substantial use of the theory of
nested sequential procedures (also called PCF B\"ohm trees) as expounded in the
recent book of Longley and Normann
Foundations for programming and implementing effect handlers
First-class control operators provide programmers with an expressive and efficient
means for manipulating control through reification of the current control state as a first-class object, enabling programmers to implement their own computational effects and
control idioms as shareable libraries. Effect handlers provide a particularly structured
approach to programming with first-class control by naming control reifying operations
and separating from their handling.
This thesis is composed of three strands of work in which I develop operational
foundations for programming and implementing effect handlers as well as exploring
the expressive power of effect handlers.
The first strand develops a fine-grain call-by-value core calculus of a statically
typed programming language with a structural notion of effect types, as opposed to the
nominal notion of effect types that dominates the literature. With the structural approach,
effects need not be declared before use. The usual safety properties of statically typed
programming are retained by making crucial use of row polymorphism to build and
track effect signatures. The calculus features three forms of handlers: deep, shallow,
and parameterised. They each offer a different approach to manipulate the control state
of programs. Traditional deep handlers are defined by folds over computation trees,
and are the original con-struct proposed by Plotkin and Pretnar. Shallow handlers are
defined by case splits (rather than folds) over computation trees. Parameterised handlers
are deep handlers extended with a state value that is threaded through the folds over
computation trees. To demonstrate the usefulness of effects and handlers as a practical
programming abstraction I implement the essence of a small UNIX-style operating
system complete with multi-user environment, time-sharing, and file I/O.
The second strand studies continuation passing style (CPS) and abstract machine
semantics, which are foundational techniques that admit a unified basis for implementing deep, shallow, and parameterised effect handlers in the same environment. The
CPS translation is obtained through a series of refinements of a basic first-order CPS
translation for a fine-grain call-by-value language into an untyped language. Each refinement moves toward a more intensional representation of continuations eventually
arriving at the notion of generalised continuation, which admit simultaneous support for
deep, shallow, and parameterised handlers. The initial refinement adds support for deep
handlers by representing stacks of continuations and handlers as a curried sequence of
arguments. The image of the resulting translation is not properly tail-recursive, meaning some function application terms do not appear in tail position. To rectify this the
CPS translation is refined once more to obtain an uncurried representation of stacks
of continuations and handlers. Finally, the translation is made higher-order in order to
contract administrative redexes at translation time. The generalised continuation representation is used to construct an abstract machine that provide simultaneous support for
deep, shallow, and parameterised effect handlers. kinds of effect handlers.
The third strand explores the expressiveness of effect handlers. First, I show that
deep, shallow, and parameterised notions of handlers are interdefinable by way of typed
macro-expressiveness, which provides a syntactic notion of expressiveness that affirms
the existence of encodings between handlers, but it provides no information about the
computational content of the encodings. Second, using the semantic notion of expressiveness I show that for a class of programs a programming language with first-class
control (e.g. effect handlers) admits asymptotically faster implementations than possible in a language without first-class control