Hostname: page-component-8448b6f56d-m8qmq Total loading time: 0 Render date: 2024-04-23T08:57:17.776Z Has data issue: false hasContentIssue false

Fair enumeration combinators

Published online by Cambridge University Press:  30 August 2017

MAX S. NEW
Affiliation:
Northeastern University (e-mail: maxnew@ccs.neu.edu)
BURKE FETSCHER
Affiliation:
Northwestern University (e-mails: burke.fetscher@eecs.northwestern.edu, robby@eecs.northwestern.edu)
ROBERT BRUCE FINDLER
Affiliation:
Northwestern University (e-mails: burke.fetscher@eecs.northwestern.edu, robby@eecs.northwestern.edu)
JAY MCCARTHY
Affiliation:
UMass Lowell (e-mail: jay@racket-lang.org)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

Enumerations represented as bijections between the natural numbers and elements of some given type have recently garnered interest in property-based testing because of their efficiency and flexibility. There are, however, many ways of defining these bijections, some of which are better than others. This paper offers a new property of enumeration combinators called fairness that identifies enumeration combinators that are better suited to property-based testing. Intuitively, the result of a fair combinator indexes into its argument enumerations equally when constructing its result. For example, extracting the nth element from our enumeration of three-tuples indexes about $\sqrt[3]{n}$ elements into each of its components instead of, say, indexing $\sqrt[2]{n}$ into one and $\sqrt[4]{n}$ into the other two, as you would if a three-tuple were built out of nested pairs. Similarly, extracting the nth element from our enumeration of a three-way union returns an element that is $\frac{n}{3}$ into one of the argument enumerators. The paper presents a semantics of enumeration combinators, a theory of fairness, proofs establishing fairness of our new combinators and that some combinations of fair combinators are not fair. We also report on an evaluation of fairness for the purpose of finding bugs in programming-language models. We show that fair enumeration combinators have complementary strengths to an existing, well-tuned ad hoc random generator (better on short time scales and worse on long time scales) and that using unfair combinators is worse across the board.

Type
Articles
Copyright
Copyright © Cambridge University Press 2017 

References

Appel, A. W., Dockins, R. & Leroy, X. (2012) A list-machine benchmark for mechanized metatheory. J. Autom. Reson. 49 (3), 453491.Google Scholar
Bulwahn, L. (2012) The new quickcheck for Isabelle: Random, exhaustive and symbolic testing under one roof. In Proceedings of the International Conference on Certified Programs and Proofs.Google Scholar
Classen, K. & Hughes, J. (2000) QuickCheck: A lightweight tool for random testing of Haskell programs. In Proceedings of the International Conference on Functional Programming.CrossRefGoogle Scholar
Duregård, J., Jansson, P. & Wang, M. (2012) Feat: Functional enumeration of algebraic types. In Proceedings of the Haskell Symposium.Google Scholar
Felleisen, M., Findler, R. B. & Flatt, M. (2009) Semantics Engineering with PLT Redex. MIT Press.Google Scholar
Flatt, M. & PLT (2010) Reference: Racket. Technical Report PLT-TR-2010-1. PLT Design Inc. Available at: https://racket-lang.org/tr1/ Google Scholar
Kennedy, A. J. & Vytiniotis, D. (2010) Every bit counts: The binary representation of typed data and programs. J. Funct. Program. 22 (4–5).Google Scholar
Klein, C., Clements, J., Dimoulas, C., Eastlund, C., Felleisen, M., Flatt, M., McCarthy, J. A., Rafkind, J., Tobin-Hochstadt, S. & Findler, R. B. (2012) Run your research: On the effectiveness of lightweight mechanization. In Proceedings of the Symposium on Principles of Programming Languages.Google Scholar
Klein, C. & Findler, R. B. (2009) Randomized testing in PLT redex. In Proceedings of the Scheme and Functional Programming, pp. 26–36.Google Scholar
Klein, C., Findler, R. B. & Flatt, M. (2013) The racket virtual machine and randomized testing. Higher-Order Symbol. Comput. Google Scholar
Kuraj, I. & Kuncak, V. (2014) SciFe: Scala framework for efficient enumeration of data structures with invariants. In Proceedings of the Scala Workshop.Google Scholar
Kuraj, I., Kuncak, V. & Jackson, D. (2015) Programming with enumerable sets of structures. In Proceedings of the Object-Oriented Programming, Systems, Languages, and Applications.Google Scholar
Matthews, J., Findler, R. B., Flatt, M. & Felleisen, M. (2004) A visual environment for developing context-sensitive term rewriting systems. In Proceedings of the International Conference on Rewriting Techniques and Applications.Google Scholar
Miller, B. P., Fredriksen, L. & So, B. (1990) An empirical study of the reliability of UNIX utilities. Commun. ACM 33 (12).Google Scholar
Pałka, M. H. (2012) Testing an Optimising Compiler by Generating Random Lambda Terms. Licentiate of Philosophy Dissertation. Chalmers University of Technology and Göteborg University.CrossRefGoogle Scholar
Pałka, M. H., Claessen, K., Russo, A. & Hughes, J. (2011) Testing an optimising compiler by generating random lambda terms. In Proceedings of the International Workshop on Automation of Software Test.Google Scholar
Runciman, C., Naylor, M. & Lindblad, F. (2008) SmallCheck and lazy SmallCheck: Automatic exhaustive testing for small values. In Proceedings of the Haskell Symposium.Google Scholar
Szudzik, M. (2006) An elegant pairing function. Available at: http://szudzik.com/ElegantPairing.pdf.Google Scholar
Takikawa, A., Strickland, T. S. & Tobin-Hochstadt, S. (2013) Constraining delimited control with contracts. In Proceedings of the European Symposium on Programming, pp. 229–248.CrossRefGoogle Scholar
Tarau, P. (2012) Deriving a fast inverse of the generalized cantor N-tupling bijection. In Proceedings of the International Conference on Logic Programming.Google Scholar
Tarau, P. (2013) Compact serialization of prolog terms (with Catalan Skeletons, Cantor Tupling and Gödel Numberings). Theory Pract. Log. Program. 13 (4–5).CrossRefGoogle Scholar
Yang, X., Chen, Y., Eide, E. & Regehr, J. (2011) Finding and understanding bin C compilers. In Proceedings of the Programming Language Design and Implementation.Google Scholar
Supplementary material: File

New et al supplementary material

New et al supplementary material 1

Download New et al supplementary material(File)
File 45.8 KB
Submit a response

Discussions

No Discussions have been published for this article.