440 research outputs found
Notions of Monad Strength
Over the past two decades the notion of a strong monad has found wide
applicability in computing. Arising out of a need to interpret products in
computational and semantic settings, different approaches to this concept have
arisen. In this paper we introduce and investigate the connections between
these approaches and also relate the results to monad composition. We also
introduce new methods for checking and using the required laws associated with
such compositions, as well as provide examples illustrating problems and issues
that arise.Comment: In Proceedings Festschrift for Dave Schmidt, arXiv:1309.455
How functional programming mattered
In 1989 when functional programming was still considered a niche topic, Hughes wrote a visionary paper arguing convincingly ‘why functional programming matters’. More than two decades have passed. Has functional programming really mattered? Our answer is a resounding ‘Yes!’. Functional programming is now at the forefront of a new generation of programming technologies, and enjoying increasing popularity and influence. In this paper, we review the impact of functional programming, focusing on how it has changed the way we may construct programs, the way we may verify programs, and fundamentally the way we may think about programs
Interaction Trees: Representing Recursive and Impure Programs in Coq
"Interaction trees" (ITrees) are a general-purpose data structure for
representing the behaviors of recursive programs that interact with their
environments. A coinductive variant of "free monads," ITrees are built out of
uninterpreted events and their continuations. They support compositional
construction of interpreters from "event handlers", which give meaning to
events by defining their semantics as monadic actions. ITrees are expressive
enough to represent impure and potentially nonterminating, mutually recursive
computations, while admitting a rich equational theory of equivalence up to
weak bisimulation. In contrast to other approaches such as relationally
specified operational semantics, ITrees are executable via code extraction,
making them suitable for debugging, testing, and implementing software
artifacts that are amenable to formal verification.
We have implemented ITrees and their associated theory as a Coq library,
mechanizing classic domain- and category-theoretic results about program
semantics, iteration, monadic structures, and equational reasoning. Although
the internals of the library rely heavily on coinductive proofs, the interface
hides these details so that clients can use and reason about ITrees without
explicit use of Coq's coinduction tactics.
To showcase the utility of our theory, we prove the termination-sensitive
correctness of a compiler from a simple imperative source language to an
assembly-like target whose meanings are given in an ITree-based denotational
semantics. Unlike previous results using operational techniques, our
bisimulation proof follows straightforwardly by structural induction and
elementary rewriting via an equational theory of combinators for control-flow
graphs.Comment: 28 pages, 4 pages references, published at POPL 202
Modular Probabilistic Models via Algebraic Effects
Probabilistic programming languages (PPLs) allow programmers to construct
statistical models and then simulate data or perform inference over them. Many
PPLs restrict models to a particular instance of simulation or inference,
limiting their reusability. In other PPLs, models are not readily composable.
Using Haskell as the host language, we present an embedded domain specific
language based on algebraic effects, where probabilistic models are modular,
first-class, and reusable for both simulation and inference. We also
demonstrate how simulation and inference can be expressed naturally as
composable program transformations using algebraic effect handlers
- …