Filters








90 Hits in 1.8 sec

Tabling with Sound Answer Subsumption [article]

Alexander Vandenbroucke, Maciej Piróg, Benoit Desouter, Tom Schrijvers
2016 arXiv   pre-print
Tabling is a powerful resolution mechanism for logic programs that captures their least fixed point semantics more faithfully than plain Prolog. In many tabling applications, we are not interested in the set of all answers to a goal, but only require an aggregation of those answers. Several works have studied efficient techniques, such as lattice-based answer subsumption and mode-directed tabling, to do so for various forms of aggregation. While much attention has been paid to expressivity and
more » ... fficient implementation of the different approaches, soundness has not been considered. This paper shows that the different implementations indeed fail to produce least fixed points for some programs. As a remedy, we provide a formal framework that generalises the existing approaches and we establish a soundness criterion that explains for which programs the approach is sound. This article is under consideration for acceptance in TPLP.
arXiv:1608.00787v1 fatcat:vhk2d3l4y5bcxdkvio3yrrjwei

Monads for Behaviour

Maciej Piróg, Jeremy Gibbons
2013 Electronical Notes in Theoretical Computer Science  
The monads used to model effectful computations traditionally concentrate on the 'destination'-the final results of the program. However, sometimes we are also interested in the 'journey'-the intermediate course of a computation-especially when reasoning about non-terminating interactive systems. In this article we claim that a necessary property of a monad for it to be able to describe the behaviour of a program is complete iterativity. We show how an ordinary monad can be modified to disclose
more » ... more about its internal computational behaviour, by applying an associated transformer to a completely iterative monad. To illustrate this, we introduce two new constructions: a coinductive cousin of Cenciarelli and Moggi's generalised resumption transformer, and States-a State-like monad that accumulates the intermediate states. { properties of coproducts } M (id + gr ΣK 2 ) · M (id + gr ΣK 2 + id ΣK 2 ) · M (id + Ση K K + Σ(η K K · µ K ) + ΣKµ K ) · flat Id+ΣK,ΣK 2 +ΣK 3 · M (α + id ΣK 2 + id ΣK 3 ) · flat K+ΣK 2 ,ΣK 3 · M (α K + id ΣK 3 ) · α K 2
doi:10.1016/j.entcs.2013.09.019 fatcat:jbgafplr7jfjbgwania3lzrl6y

String diagrams for free monads (functional pearl)

Maciej Piróg, Nicolas Wu
2016 SIGPLAN notices  
This construction appears in functional programming (Piróg and Gibbons 2012; Schrijvers et al. 2014 ) as FreeT f m, but it is not unquestionably trivial to prove that it is indeed a monad.  ...  Example: the generalised resumption monad As an application of the properties described above, we reconstruct the resumption monad-more specifically, a generalisation proposed by Piróg et al. (2015) .  ... 
doi:10.1145/3022670.2951947 fatcat:oxckyyqapnc7vmhnuatu2nyv34

The Coinductive Resumption Monad

Maciej Piróg, Jeremy Gibbons
2014 Electronical Notes in Theoretical Computer Science  
Resumptions appear in many forms as a convenient abstraction, such as in semantics of concurrency and as a programming pattern. In this paper we introduce generalised resumptions in a category-theoretic, coalgebraic context and show their basic properties: they form a monad, they come equipped with a corecursion scheme in the sense of Adámek et al.'s notion of completely iterative monads (cims), and they enjoy a certain universal property, which specialises to the coproduct with a free cim in the category of cims.
doi:10.1016/j.entcs.2014.10.015 fatcat:4duducsswbgkvmcy7sxamh7whu

Unifying Guarded and Unguarded Iteration [chapter]

Sergey Goncharov, Lutz Schröder, Christoph Rauch, Maciej Piróg
2017 Lecture Notes in Computer Science  
Piróg and J. Gibbons. The coinductive resumption monad. In Mathematical Foundations of Programming Semantics, MFPS 2014, vol. 308 of ENTCS, pp. 273-288, 2014. 26. M. Piróg and J. Gibbons.  ... 
doi:10.1007/978-3-662-54458-7_30 fatcat:scousnbo2rf3xew4viatzgt6de

A systematic derivation of the STG machine verified in Coq

Maciej Pirog, Dariusz Biernacki
2010 SIGPLAN notices  
Shared Term Graph (STG) is a lazy functional language used as an intermediate language in the Glasgow Haskell Compiler (GHC). In this article, we present a natural operational semantics for STG and we mechanically derive a lazy abstract machine from this semantics, which turns out to coincide with Peyton-Jones and Salkild's Spineless Tagless G-machine (STG machine) used in GHC. Unlike other constructions of STG-like machines present in the literature, ours is based on a systematic and scalable
more » ... erivation method (inspired by Danvy et al.'s functional correspondence between evaluators and abstract machines) and it leads to an abstract machine that differs from the original STG machine only in inessential details. In particular, it handles non-trivial update scenarios and partial applications identically as the STG machine. The entire derivation has been formalized in the Coq proof assistant. Thus, in effect, we provide a machine checkable proof of the correctness of the STG machine with respect to the natural semantics.
doi:10.1145/2088456.1863528 fatcat:baui3tkym5cknahjhsik4chfoe

Tabling with Sound Answer Subsumption

ALEXANDER VANDENBROUCKE, MACIEJ PIRÓG, BENOIT DESOUTER, TOM SCHRIJVERS
2016 Theory and Practice of Logic Programming  
AbstractTabling is a powerful resolution mechanism for logic programs that captures their least fixed point semantics more faithfully than plain Prolog. In many tabling applications, we are not interested in the set of all answers to a goal, but only require an aggregation of those answers. Several works have studied efficient techniques, such as lattice-based answer subsumption and mode-directed tabling, to do so for various forms of aggregation.While much attention has been paid to
more » ... y and efficient implementation of the different approaches, soundness has not been considered. This paper shows that the different implementations indeed fail to produce least fixed points for some programs. As a remedy, we provide a formal framework that generalises the existing approaches and we establish a soundness criterion that explains for which programs the approach is sound.
doi:10.1017/s147106841600048x fatcat:ykooofmgf5c7pdor2pmeoojwtm

Equational Theories and Monads from Polynomial Cayley Representations [chapter]

Maciej Piróg, Piotr Polesiuk, Filip Sieczkowski
2019 Green Chemistry and Sustainable Technology  
We generalise Cayley's theorem for monoids by providing an explicit formula for a (multi-sorted) equational theory represented by the type P X → X, where P is an arbitrary polynomial endofunctor with natural coefficients. From the computational perspective, examples of effects given by such theories include backtracking nondeterminism (obtained with the original Cayley representation X → X), finite mutable state (obtained with n → X, for a constant n), and their different combinations (via n ×
more » ... → X or X n → X). Moreover, we show that monads induced by such theories are implementable using the type formers available in programming languages based on a polymorphic λ-calculus, both as compositions of algebraic datatypes and as continuation-like monads. We give a set-theoretic model of the latter in terms of Barr-dinatural transformations. We also introduce CayMon, a tool that takes a polynomial as an input and generates the corresponding equational theory together with the two implementations of the induced monad in Haskell.
doi:10.1007/978-3-030-17127-8_26 dblp:conf/fossacs/PirogPS19 fatcat:5v6j3zvhxfe3rcuuj7r5wiu2wu

Backtracking with cut via a distributive law and left-zero monoids

MACIEJ PIRÓG, SAM STATON
2017 Journal of functional programming  
Maciej Piróg and Sam Staton We argue that the choice of a presentation of a theory can lead to different implementations of the notion of computation, and that it can reveal interesting properties of the  ...  Piróg and Sam Staton The intended result of the program above is [111, 112, 121, 122, 131, 132, 211, 212, 221, 222] .  ... 
doi:10.1017/s0956796817000077 fatcat:ziro3piclvg6hgwrc5xvmxx6pq

Abstracting algebraic effects

Dariusz Biernacki, Maciej Piróg, Piotr Polesiuk, Filip Sieczkowski
2019 Proceedings of the ACM on Programming Languages (PACMPL)  
We use σ, τ to range over proper types (of kind T), as well as any general type where there is no 6:8 Dariusz Biernacki, Maciej Piróg, Piotr Polesiuk, and Filip Sieczkowski Well-formedness of types ∆ ⊢  ...  We can freely mix the two effects within one expression, and handle it by placing two handlers: handle handle if flip () then 7 else (error () + 1) with herr with hnondet 6:4 Dariusz Biernacki, Maciej  ... 
doi:10.1145/3290319 fatcat:unsyr2waf5bbpckcjbvlm4juqq

Guarded and Unguarded Iteration for Generalized Processes [article]

Sergey Goncharov, Lutz Schröder, Christoph Rauch, Maciej Piróg
2019 arXiv   pre-print
Models of iterated computation, such as (completely) iterative monads, often depend on a notion of guardedness, which guarantees unique solvability of recursive equations and requires roughly that recursive calls happen only under certain guarding operations. On the other hand, many models of iteration do admit unguarded iteration. Solutions are then no longer unique, and in general not even determined as least or greatest fixpoints, being instead governed by quasi-equational axioms. Monads
more » ... support unguarded iteration in this sense are called (complete) Elgot monads. Here, we propose to equip (Kleisli categories of) monads with an abstract notion of guardedness and then require solvability of abstractly guarded recursive equations; examples of such abstractly guarded pre-iterative monads include both iterative monads and Elgot monads, the latter by deeming any recursive definition to be abstractly guarded. Our main result is then that Elgot monads are precisely the iteration-congruent retracts of abstractly guarded iterative monads, the latter being defined as admitting unique solutions of abstractly guarded recursive equations; in other words, models of unguarded iteration come about by quotienting models of guarded iteration.
arXiv:1712.09574v3 fatcat:q2k4zki6x5hdjhwgywzjps2i6y

Tracing monadic computations and representing effects

Maciej Piróg, Jeremy Gibbons
2012 Electronic Proceedings in Theoretical Computer Science  
In functional programming, monads are supposed to encapsulate computations, effectfully producing the final result, but keeping to themselves the means of acquiring it. For various reasons, we sometimes want to reveal the internals of a computation. To make that possible, in this paper we introduce monad transformers that add the ability to automatically accumulate observations about the course of execution as an effect. We discover that if we treat the resulting trace as the actual result of
more » ... e computation, we can find new functionality in existing monads, notably when working with non-terminating computations.
doi:10.4204/eptcs.76.8 fatcat:skczi4opgvaqphccsiy2gu7li4

Modules Over Monads and Their Algebras

Maciej Pirog, Nicolas Wu, Jeremy Gibbons, Marc Herbstritt
2015 Conference on Algebra and Coalgebra in Computer Science  
Modules over monads (or: actions of monads on endofunctors) are structures in which a monad interacts with an endofunctor, composed either on the left or on the right. Although usually not explicitly identified as such, modules appear in many contexts in programming and semantics. In this paper, we investigate the elementary theory of modules. In particular, we identify the monad freely generated by a right module as a generalisation of Moggi's resumption monad and characterise its algebras,
more » ... ending previous results by Hyland, Plotkin and Power, and by Filinski and Støvring. Moreover, we discuss a connection between modules and algebraic effects: left modules have a similar feeling to Eilenberg-Moore algebras, and can be seen as handlers that are natural in the variables, while right modules can be seen as functions that run effectful computations in an appropriate context (such as an initial state for a stateful computation).
doi:10.4230/lipics.calco.2015.290 dblp:conf/calco/PirogWG15 fatcat:wqg7gw4qvjh63a3yqpwpfr6sjm

Eilenberg–Moore Monoids and Backtracking Monad Transformers

Maciej Piróg
2016 Electronic Proceedings in Theoretical Computer Science  
[1] , and the resumption monad becomes the coinductive resumption monad described by Piróg and Gibbons [26] .  ... 
doi:10.4204/eptcs.207.2 fatcat:x44pue7ydfatjmljsquyiod26u

String diagrams for free monads (functional pearl)

Maciej Piróg, Nicolas Wu
2016 Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming - ICFP 2016  
This construction appears in functional programming (Piróg and Gibbons 2012; Schrijvers et al. 2014 ) as FreeT f m, but it is not unquestionably trivial to prove that it is indeed a monad.  ...  Example: the generalised resumption monad As an application of the properties described above, we reconstruct the resumption monad-more specifically, a generalisation proposed by Piróg et al. (2015) .  ... 
doi:10.1145/2951913.2951947 dblp:conf/icfp/PirogW16 fatcat:mces5ufbjfdadarzmqx7fmyyka
« Previous Showing results 1 — 15 out of 90 results