16,156 research outputs found
Feat: Functional Enumeration of Algebraic Types
In mathematics, an enumeration of a set S is a bijective function from (an initial segment of) the natural numbers to S. We define "functional enumerations" as efficiently computable such bijections. This paper describes a theory of functional enumeration and provides an algebra of enumerations closed under sums, products, guarded recursion and bijections. We partition each enumerated set into numbered, finite subsets.
We provide a generic enumeration such that the number of each part corresponds to the size of its values (measured in the number of constructors). We implement our ideas in a Haskell library called testing-feat, and make the source code freely available. Feat provides efficient "random access" to enumerated values. The primary application is property-based testing, where it is used to define both random sampling (for example QuickCheck generators) and exhaustive enumeration (in the style of SmallCheck). We claim that functional enumeration is the best option for automatically generating test cases from large groups of mutually recursive syntax tree types. As a case study we use Feat to test the pretty-printer of the Template Haskell library (uncovering several bugs)
Tracing monadic computations and representing effects
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 the computation, we can find new
functionality in existing monads, notably when working with non-terminating
computations.Comment: In Proceedings MSFP 2012, arXiv:1202.240
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
Dynamic Matrix Ansatz for Integrable Reaction-Diffusion Processes
We show that the stochastic dynamics of a large class of one-dimensional
interacting particle systems may be presented by integrable quantum spin
Hamiltonians. Generalizing earlier work \cite{Stin95a,Stin95b} we present an
alternative description of these processes in terms of a time-dependent
operator algebra with quadratic relations. These relations generate the Bethe
ansatz equations for the spectrum and turn the calculation of time-dependent
expectation values into the problem of either finding representations of this
algebra or of solving functional equations for the initial values of the
operators. We use both strategies for the study of two specific models: (i) We
construct a two-dimensional time-dependent representation of the algebra for
the symmetric exclusion process with open boundary conditions. In this way we
obtain new results on the dynamics of this system and on the eigenvectors and
eigenvalues of the corresponding quantum spin chain, which is the isotropic
Heisenberg ferromagnet with non-diagonal, symmetry-breaking boundary fields.
(ii) We consider the non-equilibrium spin relaxation of Ising spins with
zero-temperature Glauber dynamics and an additional coupling to an
infinite-temperature heat bath with Kawasaki dynamics. We solve the functional
equations arising from the algebraic description and show non-perturbatively on
the level of all finite-order correlation functions that the coupling to the
infinite-temperature heat bath does not change the late-time behaviour of the
zero-temperature process. The associated quantum chain is a non-hermitian
anisotropic Heisenberg chain related to the seven-vertex model.Comment: Latex, 23 pages, to appear in European Physical Journal
- …