skip to main content
10.1145/3462172.3462192acmotherconferencesArticle/Chapter ViewAbstractPublication PagesiflConference Proceedingsconference-collections
research-article

Template-based Theory Exploration: Discovering Properties of Functional Programs by Testing

Published: 23 July 2021 Publication History

Abstract

We present RoughSpec, a template-based extension of the theory exploration tool QuickSpec. QuickSpec uses testing to automatically discover equational properties about functions in a Haskell program. These properties can help the user understand the program or be used as a source of possible lemmas in proofs of the program’s correctness. In RoughSpec, the user supplies templates, which describe families of laws such as associativity and distributivity, and we only consider properties that match the templates. This restriction limits the search space and ensures that only relevant properties are discovered. In this way, we sacrifice broad search for more direction towards desirable property patterns, which makes theory exploration tractable and scalable. We also combine RoughSpec with QuickSpec, using QuickSpec to perform a complete search for smaller term sizes, while using templates for larger, more complex properties, in order to leverage the strengths of both systems.

References

[1]
Rudy Braquehais and Colin Runciman. 2017. Speculate: discovering conditional equations and inequalities about black-box functions by reasoning from test results. In Proceedings of the 10th ACM SIGPLAN International Symposium on Haskell. 40–51.
[2]
Bruno Buchberger. 2000. Theory exploration with Theorema. Analele Universitatii Din Timisoara, ser. Matematica-Informatica 38, 2(2000), 9–32.
[3]
Bruno Buchberger, Adrian Craciun, Tudor Jebelean, Laura Kovács, Temur Kutsia, Koji Nakagawa, Florina Piroi, Nikolaj Popov, Judit Robu, Markus Rosenkranz, and Wolfgang Windsteiger. 2006. Theorema: Towards computer-aided mathematical theory exploration. Journal of Applied Logic 4 (12 2006), 470–504. https://doi.org/10.1016/j.jal.2005.10.006
[4]
Koen Claessen and John Hughes. 2000. QuickCheck: a lightweight tool for random testing of Haskell programs. In Proceedings of ICFP. 268–279.
[5]
Lucas Dixon and Jacques D. Fleuriot. 2003. IsaPlanner: A Prototype Proof Planner in Isabelle. LNCS (LNAI) 2741, 279–283. https://doi.org/10.1007/978-3-540-45085-6_22
[6]
Lucas Dixon and Moa Johansson. 2007. IsaPlanner 2: A Proof Planner for Isabelle.
[7]
Jonathan Heras, Ekaterina Komendantskaya, Moa Johansson, and Ewen Maclean. 2013. Proof-Pattern Recognition and Lemma Discovery in ACL2. In Proceedings of LPAR. https://doi.org/10.1007/978-3-642-45221-5_27
[8]
C. A. R. Hoare. 1976. Proof of correctness of data representations. In Language Hierarchies and Interfaces, Friedrich L. Bauer, E. W. Dijkstra, A. Ershov, M. Griffiths, C. A. R. Hoare, W. A. Wulf, and Klaus Samelson (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 183–193.
[9]
John Hughes. 1995. The Design of a Pretty-printing Library. In Advanced Functional Programming, J. Jeuring and E. Meijer (Eds.). Springer Verlag, LNCS 925, 53–96.
[10]
John Hughes. 2020. How to Specify It. In Trends in Functional Programming, William J. Bowman and Ronald Garcia (Eds.). Springer International Publishing, Cham, 58–83.
[11]
Andrew Ireland and Alan Bundy. 1996. Productive Use of Failure in Inductive Proof. Journal of Automated Reasoning 16 (1996), 79–111.
[12]
Moa Johansson. 2017. Automated theory exploration for interactive theorem proving: An introduction to the Hipster system. In Proceedings of ITP(LNCS, Vol. 10499). Springer, 1–11.
[13]
Moa Johansson, Lucas Dixon, and Alan Bundy. 2011. Conjecture Synthesis for Inductive Theories. Journal of Automated Reasoning 47, 3 (01 Oct 2011), 251–289. https://doi.org/10.1007/s10817-010-9193-y
[14]
R. L. McCasland, A. Bundy, and P. F. Smith. 2017. MATHsAiD: Automated mathematical theory exploration. Applied Intelligence (23 Jun 2017). https://doi.org/10.1007/s10489-017-0954-8
[15]
Omar Montano-Rivas, Roy McCasland, Lucas Dixon, and Alan Bundy. 2012. Scheme-based theorem discovery and concept invention. Expert systems with applications 39, 2 (2012), 1637–1646.
[16]
Markus N. Rabe, Dennis Lee, Kshitij Bansal, and Christian Szegedy. 2020. Mathematical Reasoning via Self-supervised Skip-tree Training. arxiv:2006.04757 [cs.LG]
[17]
Colin Runciman, Matthew Naylor, and Fredrik Lindblad. 2008. SmallCheck and Lazy SmallCheck: automatic exhaustive testing for small values. In Proceedings of the first ACM SIGPLAN symposium on Haskell. 37–48.
[18]
Nicholas Smallbone, Moa Johansson, Koen Claessen, and Maximilian Algehed. 2017. Quick specifications for the busy programmer. Journal of Functional Programming 27 (2017). https://doi.org/10.1017/S0956796817000090
[19]
Don Stewart. 2007. Roll Your Own Window Manager: Part 1: Defining and Testing a Model. https://donsbot.wordpress.com/2007/05/01/roll-your-own-window-manager-part-1-defining-and-testing-a-model/
[20]
Don Stewart and Spencer Sjanssen. 2007. Xmonad. In Proceedings of the ACM SIGPLAN Workshop on Haskell Workshop (Freiburg, Germany) (Haskell ’07). Association for Computing Machinery, New York, NY, USA, 119. https://doi.org/10.1145/1291201.1291218

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Other conferences
IFL '20: Proceedings of the 32nd Symposium on Implementation and Application of Functional Languages
September 2020
161 pages
ISBN:9781450389631
DOI:10.1145/3462172
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 23 July 2021

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Algebraic properties
  2. Functional programming
  3. Program understanding
  4. Property-based testing
  5. QuickSpec
  6. Theory exploration

Qualifiers

  • Research-article
  • Research
  • Refereed limited

Funding Sources

Conference

IFL 2020

Acceptance Rates

Overall Acceptance Rate 19 of 36 submissions, 53%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)5
  • Downloads (Last 6 weeks)2
Reflects downloads up to 31 Dec 2024

Other Metrics

Citations

Cited By

View all

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media