281 research outputs found
Probabilistic call by push value
We introduce a probabilistic extension of Levy's Call-By-Push-Value. This
extension consists simply in adding a " flipping coin " boolean closed atomic
expression. This language can be understood as a major generalization of
Scott's PCF encompassing both call-by-name and call-by-value and featuring
recursive (possibly lazy) data types. We interpret the language in the
previously introduced denotational model of probabilistic coherence spaces, a
categorical model of full classical Linear Logic, interpreting data types as
coalgebras for the resource comonad. We prove adequacy and full abstraction,
generalizing earlier results to a much more realistic and powerful programming
language
Call-By-Push-Value
Submitted for the degree of Doctor of PhilosophyCall-by-push-value (CBPV) is a new programming language paradigm, based on the slogan “a value is, a computation does”. We claim that CBPV provides the semantic primitives from which the call-by-value and call-by-name paradigms are built. The primary goal of the thesis is to present the evidence for this claim, which is found in a remarkably wide range of semantics: from operational semantics, in big-step form and in machine form, to denotational models using
domains, possible worlds, continuations and games.
In the first part of the thesis, we come to CBPV and its equational theory by looking critically at the call-by-value and call-by-name paradigms in the presence of general computational effects. We give a Felleisen/Friedman-style CK-machine semantics, which explains how CBPV can be
understood in terms of push/pop instructions.
In the second part we give simple CBPV models for printing, divergence, global store, errors, erratic choice and control effects, as well as for various combinations of these effects. We develop the store model into a possible world model for cell generation, and (following Steele) we develop
the control model into a “jumping implementation” using a continuation language called Jump-With-Argument (JWA).
We present a pointer game model for CBPV, in the style of Hyland and Ong. We see that the
game concepts of questioning and answering correspond to the CBPV concepts of forcing and producing respectively. We observe that this game semantics is closely related to the jumping implementation.
In the third part of the thesis, we study the categorical semantics for the CBPV equational theory. We present and compare 3 approaches:
models using strong monads, in the style of Moggi;
models using value/producer structures, in the style of Power and Robinson;
models using (strong) adjunctions.
All the concrete models in the thesis are seen to be adjunction models
Taylor expansion for Call-By-Push-Value
The connection between the Call-By-Push-Value lambda-calculus introduced by Levy and Linear Logic introduced by Girard has been widely explored through a denotational view reflecting the precise ruling of resources in this language. We take a further step in this direction and apply Taylor expansion introduced by Ehrhard and Regnier. We define a resource lambda-calculus in whose terms can be used to approximate terms of Call-By-Push-Value. We show that this approximation is coherent with reduction and with the translations of Call-By-Name and Call-By-Value strategies into Call-By-Push-Value
Recurrence extraction for functional programs through call-by-push-value
The main way of analyzing the complexity of a program is that of extracting
and solving a recurrence that expresses its running time in terms of the size
of its input. We develop a method that automatically extracts such recurrences
from the syntax of higher-order recursive functional programs. The resulting
recurrences, which are programs in a call-by-name language with recursion,
explicitly compute the running time in terms of the size of the input. In order
to achieve this in a uniform way that covers both call-by-name and
call-by-value evaluation strategies, we use Call-by-Push-Value (CBPV) as an
intermediate language. Finally, we use domain theory to develop a denotational
cost semantics for the resulting recurrences.Comment: POPL 202
Extended Call-by-Push-Value: Reasoning About Effectful Programs and Evaluation Order
Traditionally, reasoning about programs under varying evaluation regimes (call-by-value, call-by-name etc.) was done at the meta-level, treating them as term rewriting systems. Levy’s call-by-push-value (CBPV) calculus provides a more powerful approach for reasoning, by treating CBPV terms as a common intermediate language which captures both call-by-value and call-by-name, and by allowing equational reasoning about changes to evaluation order between or within programs.
We extend CBPV to additionally deal with call-by-need, which is non-trivial because of shared reductions. This allows the equational reasoning to also support call-by-need. As an example, we then prove that call-by-need and call-by-name are equivalent if nontermination is the only side-effect in the source language.
We then show how to incorporate an effect system. This enables us to exploit static knowledge of the potential effects of a given expression to augment equational reasoning; thus a program fragment might be invariant under change of evaluation regime only because of knowledge of its effects
Normalization by Evaluation for Call-by-Push-Value and Polarized Lambda-Calculus
We observe that normalization by evaluation for simply-typed lambda-calculus
with weak coproducts can be carried out in a weak bi-cartesian closed category
of presheaves equipped with a monad that allows us to perform case distinction
on neutral terms of sum type. The placement of the monad influences the normal
forms we obtain: for instance, placing the monad on coproducts gives us
eta-long beta-pi normal forms where pi refers to permutation of case
distinctions out of elimination positions. We further observe that placing the
monad on every coproduct is rather wasteful, and an optimal placement of the
monad can be determined by considering polarized simple types inspired by
focalization. Polarization classifies types into positive and negative, and it
is sufficient to place the monad at the embedding of positive types into
negative ones. We consider two calculi based on polarized types: pure
call-by-push-value (CBPV) and polarized lambda-calculus, the natural deduction
calculus corresponding to focalized sequent calculus. For these two calculi, we
present algorithms for normalization by evaluation. We further discuss
different implementations of the monad and their relation to existing
normalization proofs for lambda-calculus with sums. Our developments have been
partially formalized in the Agda proof assistant
Normalization by evaluation for call-by-push-value and polarized lambda calculus
We observe that normalization by evaluation for simply-typed lambda-calculus with weak coproducts can be carried out in a weak bi-cartesian closed category of presheaves equipped with a monad that allows us to perform case distinction on neutral terms of sum type. The placement of the monad influences the normal forms we obtain: for instance, placing the monad on coproducts gives us eta-long beta-pi normal forms where pi refers to permutation of case distinctions out of elimination positions. We further observe that placing the monad on every coproduct is rather wasteful, and an optimal placement of the monad can be determined by considering polarized simple types inspired by focalization. Polarization classifies types into positive and negative, and it is sufficient to place the monad at the embedding of positive types into negative ones. We consider two calculi based on polarized types: pure call-by-push-value (CBPV) and polarized lambda-calculus, the natural deduction calculus corresponding to focalized sequent calculus. For these two calculi, we present algorithms for normalization by evaluation. We further discuss different implementations of the monad and their relation to existing normalization proofs for lambda-calculus with sums. Our developments have been partially formalized in the Agda proof assistant
Recommended from our members
Reasoning about effectful programs and evaluation order
Program transformations have various applications, such as in compiler optimizations. These transformations are often effect-dependent: replacing one program with another relies on some restriction on the side-effects of subprograms. For example, we cannot eliminate a dead computation that raises an exception, or a duplicated computation that prints to the screen. Effect-dependent program transformations can be described formally using effect systems, which annotate types with information about the side-effects of expressions.
In this thesis, we extend previous work on effect systems and correctness of effect-dependent transformations in two related directions.
First, we consider evaluation order. Effect systems for call-by-value languages are well-known, but are not sound for other evaluation orders. We describe sound and precise effect systems for various evaluation orders, including call-by-name. We also describe an effect system for Levy's call-by-push-value, and show that this subsumes those for call-by-value and call-by-name. This naturally leads us to consider effect-dependent transformations that replace one evaluation order with another. We show how to use the call-by-push-value effect system to prove the correctness of transformations that replace call-by-value with call-by-name, using an argument based on logical relations. Finally, we extend call-by-push-value to additionally capture call-by-need. We use our extension to show a classic example of a relationship between evaluation orders: if the side-effects are restricted to (at most) nontermination, then call-by-name is equivalent to call-by-need.
The second direction we consider is non-invertible transformations. A program transformation is non-invertible if only one direction is correct. Such transformations arise, for example, when considering undefined behaviour, nondeterminism, or concurrency. We present a general framework for verifying noninvertible effect-dependent transformations, based on our effect system for call-by-push-value. The framework includes a non-symmetric notion of correctness for effect-dependent transformations, and a denotational semantics based on order-enriched category theory that can be used to prove correctness
- …