301 research outputs found

    Programming with Algebraic Effects and Handlers

    Full text link
    Eff is a programming language based on the algebraic approach to computational effects, in which effects are viewed as algebraic operations and effect handlers as homomorphisms from free algebras. Eff supports first-class effects and handlers through which we may easily define new computational effects, seamlessly combine existing ones, and handle them in novel ways. We give a denotational semantics of eff and discuss a prototype implementation based on it. Through examples we demonstrate how the standard effects are treated in eff, and how eff supports programming techniques that use various forms of delimited continuations, such as backtracking, breadth-first search, selection functionals, cooperative multi-threading, and others

    Intensional and Extensional Semantics of Bounded and Unbounded Nondeterminism

    Get PDF
    We give extensional and intensional characterizations of nondeterministic functional programs: as structure preserving functions between biorders, and as nondeterministic sequential algorithms on ordered concrete data structures which compute them. A fundamental result establishes that the extensional and intensional representations of non-deterministic programs are equivalent, by showing how to construct a unique sequential algorithm which computes a given monotone and stable function, and describing the conditions on sequential algorithms which correspond to continuity with respect to each order. We illustrate by defining may and must-testing denotational semantics for a sequential functional language with bounded and unbounded choice operators. We prove that these are computationally adequate, despite the non-continuity of the must-testing semantics of unbounded nondeterminism. In the bounded case, we prove that our continuous models are fully abstract with respect to may and must-testing by identifying a simple universal type, which may also form the basis for models of the untyped lambda-calculus. In the unbounded case we observe that our model contains computable functions which are not denoted by terms, by identifying a further "weak continuity" property of the definable elements, and use this to establish that it is not fully abstract

    Reasoning about the garden of forking paths

    Get PDF
    Lazy evaluation is a powerful tool for functional programmers. It enables the concise expression of on-demand computation and a form of compositionality not available under other evaluation strategies. However, the stateful nature of lazy evaluation makes it hard to analyze a program's computational cost, either informally or formally. In this work, we present a novel and simple framework for formally reasoning about lazy computation costs based on a recent model of lazy evaluation: clairvoyant call-by-value. The key feature of our framework is its simplicity, as expressed by our definition of the clairvoyance monad. This monad is both simple to define (around 20 lines of Coq) and simple to reason about. We show that this monad can be effectively used to mechanically reason about the computational cost of lazy functional programs written in Coq.Comment: 28 pages, accepted by ICFP'2

    A Compositional Cost Model for the Lambda-calculus

    Get PDF

    Biortogonalidad para corrección de compiladores y adecuación computacional

    Get PDF
    Tesis (Doctor en Ciencias de la Computación)--Universidad Nacional de Córdoba, Facultad de Matemática, Astronomía, Física y Computación, 2019.En esta tesis hemos estudiado en profundidad los métodos de biortogonalidad y step-indexing para probar tanto adecuación computacional como corrección de compiladores. Un primer aporte es la prueba de corrección de una semántica denotacional con respecto a una operacional para un lenguaje funcional lazy definido por John Launchbury corriegiendo ciertos ciertas irregularidades en algunas definiciones. Otra contribución es la prueba de adecuación computacional de una semántica operacional con respecto a una denotacional para un lenguaje funcional call-by-value con subtipado. Para este mismo lenguaje probamos la coincidencia entre una semántica denotacional extrínseca y una intrínseca, obteniendo como corolario la coherencia de la semántica intrínseca. Este aporte incluye la mecanización completa en Coq de todos los resultados; siendo, tanto como sabemos, la primera mecanización del teorema de bracketing propuesto por John Reynolds. Finalmente damos una prueba de corrección de un compilador para un lenguaje lazy con recursión generando código para una máquina abstracta, este aporte extiende significativamente un trabajo previo desarrollado por Leonardo Rodríguez. Incluimos también la mecanización completa en Coq.In this work we studied the techniques of biorthogonality and step-indexing for proving computational adequacy and compiler correctness. The first contribution is the proof of correction of a denotational semantics with respect to a operational semantics for a lazy language originally defined by John Launchbury fixing some definition irregularities. Another contribution is the proof of computational adequacy of the operational semantics with respect to a denotational semantics for a call-by-value functional language with subtyping. Also for this same language we prove the coincidence between an extrinsic and intrinsic denotational semantics. This contribution includes the complete mechanization in Coq of all the results; being, as far as we know, the first mechanization of Reynolds’ bracketing theorem. Finally we give a proof of the correction of a compiler for an abstract machine, this contribution significantly extends previous work developed by Leonardo Rodríguez. We also include the complete mechanization in Coq.Gadea, Alejandro Emilio. Universidad Nacional de Córdoba. Facultad de Matemática, Astronomía, Física y Computación; Argentina
    corecore