Programming with enumerable sets of structures

We present an efficient, modular, and feature-rich framework for automated generation and validation of complex structures, suitable for tasks that explore a large space of structured values. Our framework is capable of exhaustive, incremental, parallel, and memoized enumeration from not only finite but also infinite domains, while providing fine-grained control over the process. Furthermore, the framework efficiently supports the inverse of enumeration (checking whether a structure can be generated and fast-forwarding to this structure to continue the enumeration) and lazy enumeration (achieving exhaustive testing without generating all structures). The foundation of efficient enumeration lies in both direct access to encoded structures, achieved with well-known and new pairing functions, and dependent enumeration, which embeds constraints into the enumeration to avoid backtracking. Our framework defines an algebra of enumerators, with combinators for their composition that preserve exhaustiveness and efficiency. We have implemented our framework as a domain-specific language in Scala. Our experiments demonstrate better performance and shorter specifications by up to a few orders of magnitude compared to existing approaches.

[1]  Martin Odersky,et al.  An Overview of the Scala Programming Language , 2004 .

[2]  Johan Jeuring,et al.  Enumerating Well-Typed Terms Generically , 2009, AAIP.

[3]  Sarfraz Khurshid,et al.  Korat: automated testing based on Java predicates , 2002, ISSTA '02.

[4]  S. L. Gerhart,et al.  Toward a theory of test data selection , 1975, IEEE Transactions on Software Engineering.

[5]  Sarfraz Khurshid,et al.  Efficient solving of structural constraints , 2008, ISSTA '08.

[6]  Sarfraz Khurshid,et al.  Test generation through programming in UDITA , 2010, 2010 ACM/IEEE 32nd International Conference on Software Engineering.

[7]  B. Pierce,et al.  QuickChick: Property-based testing for Coq , 2014 .

[8]  Sarfraz Khurshid,et al.  Software assurance by bounded exhaustive testing , 2004, IEEE Transactions on Software Engineering.

[9]  Joe B. Wells,et al.  Graph-Based Proof Counting and Enumeration with Applications for Program Fragment Synthesis , 2004, LOPSTR.

[10]  Darko Marinov,et al.  A Comparison of Constraint-Based and Sequence-Based Generation of Complex Input Data Structures , 2010, 2010 Third International Conference on Software Testing, Verification, and Validation Workshops.

[11]  Sarfraz Khurshid,et al.  TestEra: Specification-Based Testing of Java Programs Using SAT , 2004, Automated Software Engineering.

[12]  Philippe Flajolet,et al.  Computer Algebra Libraries for Combinatorial Structures , 1995, J. Symb. Comput..

[13]  Corina S. Pasareanu,et al.  Test input generation for red-black trees using abstraction , 2005, ASE.

[14]  Viktor Kuncak,et al.  Constraints as control , 2012, POPL '12.

[15]  Paul Tarau Deriving a Fast Inverse of the Generalized Cantor N-tupling Bijection , 2012, ICLP.

[16]  Robert Glück,et al.  Principles of Inverse Computation and the Universal Resolving Algorithm , 2002, The Essence of Computation.

[17]  Viktor Kuncak,et al.  An overview of the Leon verification system: verification by translation to recursive functions , 2013, SCALA@ECOOP.

[18]  Shinya Kawanaka,et al.  biXid: a bidirectional transformation language for XML , 2006, ICFP '06.

[19]  Amr Sabry,et al.  Backtracking, interleaving, and terminating monad transformers: (functional pearl) , 2005, ICFP '05.

[20]  Colin Runciman,et al.  Smallcheck and lazy smallcheck: automatic exhaustive testing for small values , 2008, Haskell '08.

[21]  Sarfraz Khurshid,et al.  Parallel test generation and execution with Korat , 2007, ESEC-FSE '07.

[22]  Shin-Cheng Mu,et al.  An Injective Language for Reversible Computation , 2004, MPC.

[23]  Rajeev Alur,et al.  Representation dependence testing using program inversion , 2010, FSE '10.

[24]  Bertrand Meyer,et al.  Experimental assessment of random testing for object-oriented software , 2007, ISSTA '07.

[25]  Bertrand Meyer,et al.  ARTOO , 2008, 2008 ACM/IEEE 30th International Conference on Software Engineering.

[26]  Viktor Kuncak,et al.  SciFe: Scala framework for efficient enumeration of data structures with invariants , 2014, SCALA@ECOOP.

[27]  Ivan Kuraj,et al.  Interactive Code Generation , 2013 .

[28]  John Hughes,et al.  Generalising monads to arrows , 2000, Sci. Comput. Program..

[29]  Claus Brabrand,et al.  Dual syntax for XML languages , 2005, Inf. Syst..

[30]  Brian J. Ross,et al.  Running programs backwards: The logical inversion of imperative computation , 1997, Formal Aspects of Computing.

[31]  Sarfraz Khurshid,et al.  Bounded exhaustive test input generation from hybrid invariants , 2014, OOPSLA 2014.

[32]  Arnold L. Rosenberg,et al.  Efficient pairing functions-and why you should care , 2002, Proceedings 16th International Parallel and Distributed Processing Symposium.

[33]  Darko Marinov,et al.  Automated testing of refactoring engines , 2007, ESEC-FSE '07.

[34]  RuncimanColin,et al.  Smallcheck and lazy smallcheck , 2008 .

[35]  KiselyovOleg,et al.  Backtracking, interleaving, and terminating monad transformers , 2005 .

[36]  John Hughes,et al.  QuickCheck Testing for Fun and Profit , 2007, PADL.

[37]  Martin Odersky,et al.  An Overview of the Scala Programming Language (2. Edition) , 2006 .

[38]  Martin Erwig,et al.  Inductive graphs and functional graph algorithms , 2001, J. Funct. Program..

[39]  Ruzica Piskac,et al.  Complete completion using types and weights , 2013, PLDI.

[40]  Michael D. Ernst,et al.  Randoop: feedback-directed random testing for Java , 2007, OOPSLA '07.

[41]  David R. Hanson,et al.  Generators in Icon , 1981, TOPL.

[42]  Lukas Bulwahn,et al.  The New Quickcheck for Isabelle - Random, Exhaustive and Symbolic Testing under One Roof , 2012, CPP.

[43]  Fabio Fioravanti,et al.  Generation of Test Data Structures Using Constraint Logic Programming , 2012, TAP@TOOLS.

[44]  Sebastian Fischer,et al.  EasyCheck - Test Data for Free , 2008, FLOPS.

[45]  Meng Wang,et al.  Feat: functional enumeration of algebraic types , 2012, Haskell.

[46]  Jean Goubault,et al.  Implementing Functional Languages with Fast Equality, Sets and Maps: an Exercise in Hash Consing , 1992 .

[47]  Lawton Nichols,et al.  Automated Data Structure Generation: Refuting Common Wisdom , 2015, 2015 IEEE/ACM 37th IEEE International Conference on Software Engineering.

[48]  Daniel Jackson,et al.  Alloy: a lightweight object modelling notation , 2002, TSEM.

[49]  Koen Claessen,et al.  QuickCheck: a lightweight tool for random testing of Haskell programs , 2000, ICFP.

[50]  Viktor Kuncak,et al.  Synthesis modulo recursive functions , 2013, OOPSLA.

[51]  Martin Odersky,et al.  Instant pickles: generating object-oriented pickler combinators for fast and extensible serialization , 2013, OOPSLA.