skip to main content
article

Speculate: discovering conditional equations and inequalities about black-box functions by reasoning from test results

Published:07 September 2017Publication History
Skip Abstract Section

Abstract

This paper presents Speculate, a tool that automatically conjectures laws involving conditional equations and inequalities about Haskell functions. Speculate enumerates expressions involving a given collection of Haskell functions, testing to separate those expressions into apparent equivalence classes. Expressions in the same equivalence class are used to conjecture equations. Representative expressions of different equivalence classes are used to conjecture conditional equations and inequalities. Speculate uses lightweight equational reasoning based on term rewriting to discard redundant laws and to avoid needless testing. Several applications demonstrate the effectiveness of Speculate.

References

  1. 2017. Haskell’s Data.Dynamic library documentation. https://hackage.haskell. org/package/base/docs/Data-Dynamic.html . (2017).Google ScholarGoogle Scholar
  2. Franz Baader and Tobias Nipkow. 1999. Term Rewriting and All That. Cambridge University Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Leo Bachmair, Nachum Dershowitz, and David A. Plaisted. 1989. Completion Without Failure. In Resolution Of Equations In Algebraic Structures. Vol. 2. Academic Press, Boston, 1–30.Google ScholarGoogle Scholar
  4. Rudy Braquehais and Colin Runciman. 2016. FitSpec: refining property sets for functional testing. In Haskell’16. ACM, 1–12. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Lukas Bulwahn. 2012. Smart Testing of Functional Programs in Isabelle. In LPAR 2012 (LNCS 7180). Springer, 153–167. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Koen Claessen and John Hughes. 2000. QuickCheck: A Lightweight Tool for Random Testing of Haskell Programs. In ICFP’00. ACM, 268–279. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Koen Claessen, Moa Johansson, Dan Rosén, and Nicholas Smallbone. 2012. HipSpec: Automating inductive proofs of program properties. In Workshop on Automated Theory eXploration: ATX 2012.Google ScholarGoogle Scholar
  8. Koen Claessen, Nicholas Smallbone, and John Hughes. 2010. QuickSpec: Guessing Formal Specifications Using Testing. In TAP 2010. Springer, 6–21. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. John Horton Conway. 1971. Regular algebra and finite machines. Chapman and Hall.Google ScholarGoogle Scholar
  10. Jonas Duregård, Patrik Jansson, and Meng Wang. 2012. Feat: functional enumeration of algebraic types. In Haskell’12. ACM, 61–72. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Michael D. Ernst, Jeff H. Perkins, Philip J. Guo, Stephen Mccamant, Carlos Pacheco, Matthew S. Tschantz, and Chen Xiao. 2006. The Daikon system for dynamic detection of likely invariants. Science of Computer Programming 69, 1 (2006), 35–45. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Moa Johansson, Dan Rosén, Nicholas Smallbone, and Koen Claessen. 2014. Hipster: Integrating Theory Exploration in a Proof Assistant. Springer.Google ScholarGoogle Scholar
  13. Donald Knuth and Peter Bendix. 1983. Simple Word Problems in Universal Algebras. In Automation of Reasoning. Springer, 342–376.Google ScholarGoogle Scholar
  14. Dexter Kozen. 1994. A completeness theorem for Kleene algebras and the algebra of regular events. Information and Computation 110, 2 (1994), 366–390. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Fredrik Lindblad. 2007. Property Directed Generation of First-Order Test Data. In TFP’07. 105–123.Google ScholarGoogle Scholar
  16. Jason S. Reich, Matthew Naylor, and Colin Runciman. 2013. Advances in Lazy SmallCheck. In IFL’13. Springer, 53–70.Google ScholarGoogle Scholar
  17. Colin Runciman, Matthew Naylor, and Fredrik Lindblad. 2008. SmallCheck and Lazy SmallCheck: Automatic Exhaustive Testing for Small Values. In Haskell’08. ACM, 37–48. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Arto Salomaa. 1966. Two complete axiom systems for the algebra of regular events. Journal of the ACM (JACM) 13, 1 (1966), 158–169. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Tim Sheard and Simon Peyton Jones. 2002. Template Meta-programming for Haskell. In Haskell’02. ACM, 1–16. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Nicholas Smallbone. 2011. Property-based testing for functional programs. Licentiate Thesis. Chalmers University of Technology.Google ScholarGoogle Scholar
  21. Nicholas Smallbone. 2013. Lightweight verification of functional programs. Ph.D. Dissertation. Chalmers University of Technology.Google ScholarGoogle Scholar
  22. Nicholas Smallbone and Moa Johansson. 2017. Quick specifications for the busy programmer. (2017). http://www.cse.chalmers.se/~nicsma/papers/quickspec2.pdf Accepted for publication in JFP, Cambridge University Press.Google ScholarGoogle Scholar
  23. The GHC Team. 1992–2017. The Glasgow Haskell Compiler. https://www.haskell. org/ghc/ . (1992–2017).Google ScholarGoogle Scholar
  24. Michael Walker and Colin Runciman. 2017. Cheap Remarks about Concurrent Programs. (2017). Accepted for presentation at TFP’17.Google ScholarGoogle Scholar

Index Terms

  1. Speculate: discovering conditional equations and inequalities about black-box functions by reasoning from test results

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 52, Issue 10
        Haskell '17
        October 2017
        211 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/3156695
        • Editor:
        • Andy Gill
        Issue’s Table of Contents
        • cover image ACM Conferences
          Haskell 2017: Proceedings of the 10th ACM SIGPLAN International Symposium on Haskell
          September 2017
          211 pages
          ISBN:9781450351829
          DOI:10.1145/3122955

        Copyright © 2017 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 7 September 2017

        Check for updates

        Qualifiers

        • article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!