Abstract
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).
- J. Christiansen and S. Fischer. Easycheck: test data for free. In FLOPS'08, pages 322--336. Springer, 2008. Google Scholar
Digital Library
- K. Claessen and J. Hughes. QuickCheck: a lightweight tool for random testing of Haskell programs. In ICFP '00, pages 268--279. ACM, 2000. Google Scholar
Digital Library
- P. Duchon, P. Flajolet, G. Louchard, and G. Schaeffer. Boltzmann samplers for the random generation of combinatorial structures. Combinatorics, Probability and Computing, 13 (4--5): 577--625, 2004. 10.1017/S0963548304006315. Google Scholar
Digital Library
- J. Duregård. Agata: Random generation of test data. Master's thesis, Chalmers University of Technology, 2009.Google Scholar
- J. Duregård and P. Jansson. Embedded parser generators. In Haskell '11, pages 107--117. ACM, 2011. Google Scholar
Digital Library
- P. Flajolet and B. Salvy. Computer algebra libraries for combinatorial structures. J. Symb. Comput., 20 (5/6): 653--671, 1995. Google Scholar
Digital Library
- M. Hanus et al. Curry: An Integrated Functional Logic Language, version 0.8.2 edition, 2006. Available from http://www.informatik.uni-kiel.de/~curry/report.html.Google Scholar
- M. H. Pałka, K. Claessen, A. Russo, and J. Hughes. Testing an optimising compiler by generating random lambda terms. In AST '11, pages 91--97. ACM, 2011. Google Scholar
Digital Library
- S. Peyton Jones, S. Marlow, and C. Elliot. Stretching the storage manager: weak pointers and stable names in Haskell. In IFL'99, LNCS. Springer, 1999. Google Scholar
Digital Library
- C. Runciman, M. Naylor, and F. Lindblad. Smallcheck and lazy smallcheck: automatic exhaustive testing for small values. In Haskell '08, pages 37--48. ACM, 2008. Google Scholar
Digital Library
- G. J. Uszkay and J. Carette. Available from http://hackage.haskell.org/package/gencheck.Google Scholar
- J. Wang. Generating random lambda calculus terms. Technical report, Boston University, 2005.Google Scholar
- A. R. Yakushev and J. Jeuring. Enumerating well-typed terms generically. In AAIP 2009, volume 5812 of LNCS, pages 93--116. Springer, 2009.Google Scholar
- B. A. Yorgey. Species and functors and types, oh my! In Haskell '10, pages 147--158. ACM, 2010. Google Scholar
Digital Library
Index Terms
Feat: functional enumeration of algebraic types
Recommendations
Feat: functional enumeration of algebraic types
Haskell '12: Proceedings of the 2012 Haskell SymposiumIn 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 ...
SciFe: Scala framework for efficient enumeration of data structures with invariants
SCALA '14: Proceedings of the Fifth Annual Scala WorkshopWe introduce SciFe, a tool for automated generation of complex structures, suitable for tasks such as automated testing and synthesis. SciFe is capable of exhaustive, memoized enumeration of values from finite or infinite domains. SciFe is based on the ...
Studies on finite Sturmian words
Several properties of finite Sturmian words are proved. The inverse of the Richomme-Séébold bijection between factor sets of given length of Sturmian sequences and left special Sturmian words is constructed (using circular factors of Christoffel words) ...







Comments