17 research outputs found
Boltzmann samplers for random generation of lambda terms
Randomly generating structured objects is important in testing and optimizing
functional programs, whereas generating random -terms is more specifically
needed for testing and optimizing compilers. For that a tool called QuickCheck
has been proposed, but in this tool the control of the random generation is
left to the programmer. Ten years ago, a method called Boltzmann samplers has
been proposed to generate combinatorial structures. In this paper, we show how
Boltzmann samplers can be developed to generate lambda-terms, but also other
data structures like trees. These samplers rely on a critical value which
parameters the main random selector and which is exhibited here with
explanations on how it is computed. Haskell programs are proposed to show how
samplers are actually implemented
Desenvolvimento de um Gerador de Programas Aleatórios em Java
With great advances in the computer science area where technologicalsystems are becoming more and more complex, tests are hardto perform. The problem is even more serious in critical systems,such as flight control or nuclear systems, where an error can causecatastrophic damage in our society. Currently, two techniques areoften used for software validation: testing and software verification.This project aims the testing area, generating random programs tobe used as input to property-based tests, in order to detect errorsin systems and libraries, minimizing the possibility of errors. Morespecifically, Java programs will be automatically generated from existentclasses and interfaces, considering all syntactic and semanticconstraints of the language
Normal-order reduction grammars
We present an algorithm which, for given , generates an unambiguous
regular tree grammar defining the set of combinatory logic terms, over the set
of primitive combinators, requiring exactly normal-order
reduction steps to normalize. As a consequence of Curry and Feys's
standardization theorem, our reduction grammars form a complete syntactic
characterization of normalizing combinatory logic terms. Using them, we provide
a recursive method of constructing ordinary generating functions counting the
number of -combinators reducing in normal-order reduction steps.
Finally, we investigate the size of generated grammars, giving a primitive
recursive upper bound
Experience Report: Growing and Shrinking Polygons for Random Testing of Computational Geometry Algorithms
This paper documents our experience of adapting and using the QuickCheck-style approach for extensive randomised property-based testing of computational geometry algorithms.
The need in rigorous evaluation of computational geometry procedures has naturally arisen in our quest of organising a medium-size programming contest for second year university students—an experiment we conducted as an attempt to introduce them to computational geometry. The main effort in organising the event was implementation of a solid infrastructure for testing and ranking solutions. For this, we employed functional programming techniques. The choice of the language and the paradigm made it possible for us to engineer, from scratch and in a very short period of time, a series of robust geometric primitives and algorithms, as well as implement a scalable framework for their randomised testing.
We describe the main insights, enabling efficient random testing of geometric procedures, and report on our experience of using the testing framework, which helped us to detect and fix a number of issues not just in our programming artefacts, but also in the published algorithms we had implemented
Effect-driven QuickChecking of compilers
How does one test a language implementation with QuickCheck (aka. property-based testing)? One approach is to generate programs following the grammar of the language. But in a statically-typed language such as OCaml too many of these candidate programs will be rejected as ill-typed by the type checker. As a refinement Pałka et al. propose to generate programs in a goal-directed, bottom-up reading up of the typing relation. We have written such a generator. However many of the generated programs has output that depend on the evaluation order, which is commonly under-specified in languages such as OCaml, Scheme, C, C++, etc. In this paper we develop a type and effect system for conservatively detecting evaluation-order dependence and propose its goal-directed reading as a generator of programs that are independent of evaluation order. We illustrate the approach by generating programs to test OCaml's two compiler backends against each other and report on a number of bugs we have found doing so.</jats:p