Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article
Open access

Merging Inductive Relations

Published: 06 June 2023 Publication History

Abstract

Inductive relations offer a powerful and expressive way of writing program specifications while facilitating compositional reasoning. Their widespread use by proof assistant users has made them a particularly attractive target for proof engineering tools such as QuickChick, a property-based testing tool for Coq which can automatically derive generators for values satisfying an inductive relation. However, while such generators are generally efficient, there is an infrequent yet seemingly inevitable situation where their performance greatly degrades: when multiple inductive relations constrain the same piece of data.
In this paper, we introduce an algorithm for merging two such inductively defined properties that share an index. The algorithm finds shared structure between the two relations, and creates a single merged relation that is provably equivalent to the conjunction of the two. We demonstrate, through a series of case studies, that the merged relations can improve the performance of automatic generation by orders of magnitude, as well as simplify mechanized proofs by getting rid of the need for nested induction and tedious low-level book-keeping.

References

[1]
Andrew W. Appel. 2022. Verified Functional Algorithms (Software Foundations, Vol. 3). Electronic textbook.
[2]
Lukas Bulwahn. 2012. The New Quickcheck for Isabelle - Random, Exhaustive and Symbolic Testing under One Roof. In 2nd International Conference on Certified Programs and Proofs (CPP) (Lecture Notes in Computer Science, Vol. 7679). Springer, 92–108. https://www.irisa.fr/celtique/genet/ACF/BiblioIsabelle/quickcheckNew.pdf
[3]
Lukas Bulwahn. 2012. Smart Testing of Functional Programs in Isabelle. In 18th International Conference on Logic for Programming, Artificial Intelligence, and Reasoning (LPAR) (Lecture Notes in Computer Science, Vol. 7180). Springer, 153–167. isbn:978-3-642-28716-9 http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.229.1307&rep=rep1&type=pdf
[4]
Harsh Raju Chamarthi, Peter C. Dillinger, Matt Kaufmann, and Panagiotis Manolios. 2011. Integrating Testing and Interactive Theorem Proving. In 10th International Workshop on the ACL2 Theorem Prover and its Applications (EPTCS, Vol. 70). 4–19. arxiv:1105.4394
[5]
Koen Claessen, Jonas Duregård, and Michal H. Palka. 2015. Generating constrained random data with uniform distribution. J. Funct. Program., 25 (2015), https://doi.org/10.1017/S0956796815000143
[6]
Koen Claessen and John Hughes. 2000. QuickCheck: a lightweight tool for random testing of Haskell programs. In 5th ACM SIGPLAN International Conference on Functional Programming (ICFP). ACM, 268–279. http://www.eecs.northwestern.edu/~robby/courses/395-495-2009-fall/quick.pdf
[7]
The Coq Development Team. 2021. The Coq Proof Assistant. https://doi.org/10.5281/zenodo.4501022
[8]
Pierre-Évariste Dagan and Conor McBride. 2014. Transporting functions across ornaments. Journal of Functional Programming, 24, 2-3 (2014), 316–383. https://doi.org/10.1017/S0956796814000069
[9]
Carl Eastlund. 2009. DoubleCheck Your Theorems. In ACL2. http://www.ccs.neu.edu/scheme/pubs/acl209-e.pdf
[10]
Burke Fetscher, Koen Claessen, Michal H. Palka, John Hughes, and Robert Bruce Findler. 2015. Making Random Judgments: Automatically Generating Well-Typed Terms from the Definition of a Type-System. In 24th European Symposium on Programming (Lecture Notes in Computer Science, Vol. 9032). Springer, 383–405. isbn:978-3-662-46668-1 http://users.eecs.northwestern.edu/~baf111/random-judgments/
[11]
Catalin Hritcu, Leonidas Lampropoulos, Antal Spector-Zabusky, Arthur Azevedo Amorim, Maxime Denes, John Hughes, Benjamin C. Pierce, and Dimitrios Vytiniotis. 2016. Testing Noninterference, Quickly. In Journal of Functional Programming (JFP). https://doi.org/10.1017/S0956796816000058
[12]
John Hughes. 2019. How to Specify It!. 20th International Symposium on Trends in Functional Programming.
[13]
Hsiang-Shang Ko and Jeremy Gibbons. 2011. Modularising inductive families. In WGP@ICFP.
[14]
Hsiang-Shang Ko and Jeremy Gibbons. 2016. Programming with ornaments. Journal of Functional Programming, 27 (2016), 12, https://doi.org/10.1017/S0956796816000307
[15]
Leonidas Lampropoulos. 2018. Random Testing for Language Design. Ph. D. Dissertation. University of Pennsylvania.
[16]
Leonidas Lampropoulos. 2023. QuickChick 2.0 release. Github. https://github.com/QuickChick/QuickChick/releases/tag/v.2.0+beta.16
[17]
Leonidas Lampropoulos, Diane Gallois-Wong, Catalin Hritcu, John Hughes, Benjamin C. Pierce, and Li-yao Xia. 2017. Beginner’s Luck: a language for property-based generators. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, (POPL). https://doi.org/10.1145/3009837.3009868
[18]
Leonidas Lampropoulos, Zoe Paraskevopoulou, and Benjamin C. Pierce. 2018. Generating Good Generators for Inductive Relations. In Proceedings of the ACM Conference on Principles of Programming Languages (POPL). https://doi.org/10.1145/3158133
[19]
Leonidas Lampropoulos and Benjamin C. Pierce. 2018. QuickChick: Property-Based Testing In Coq. Electronic textbook. http://www.cis.upenn.edu/~bcpierce/sf
[20]
Fredrik Lindblad. 2007. Property Directed Generation of First-Order Test Data. In 8th Symposium on Trends in Functional Programming (Trends in Functional Programming, Vol. 8). Intellect, 105–123. isbn:978-1-84150-196-3 http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.116.2439&rep=rep1&type=pdf
[21]
Jan Midtgaard, Mathias Nygaard Justesen, Patrick Kasting, Flemming Nielson, and Hanne Riis Nielson. 2017. Effect-Driven QuickChecking of Compilers. Proc. ACM Program. Lang., 1, ICFP (2017), Article 15, aug, 23 pages. https://doi.org/10.1145/3110259
[22]
Ulf Norell. 2008. Dependently Typed Programming in Agda. In Proceedings of the 6th International Conference on Advanced Functional Programming (AFP’08). Springer-Verlag, Berlin, Heidelberg. 230–266. isbn:3642046517
[23]
Michał H. Pał ka, Koen Claessen, Alejandro Russo, and John Hughes. 2011. Testing an Optimising Compiler by Generating Random Lambda Terms. In Proceedings of the 6th International Workshop on Automation of Software Test (AST ’11). ACM, New York, NY, USA. 91–97. isbn:978-1-4503-0592-1 https://doi.org/10.1145/1982595.1982615
[24]
Zoe Paraskevopoulou, Aaron Eline, and Leonidas Lampropoulos. 2022. Computing Correctly with Inductive Relations. In Proceedings of the ACM SIGPLAN Symposium on Programming Language Design and Implementation (PLDI). https://doi.org/10.1145/3519939.3523707
[25]
Benjamin C. Pierce, Arthur Azevedo de Amorim, Chris Casinghino, Marco Gaboardi, Michael Greenberg, Cǎtǎlin Hriţcu, Vilhelm Sjöberg, and Brent Yorgey. 2018. Logical Foundations. Electronic textbook, Version 5.5. http://www.cis.upenn.edu/~bcpierce/sf
[26]
Amir Pnueli, Michael Siegel, and Eli Singerman. 1998. Translation Validation. In Tools and Algorithms for Construction and Analysis of Systems, 4th International Conference, TACAS ’98, Held as Part of the European Joint Conferences on the Theory and Practice of Software, ETAPS’98, Lisbon, Portugal, March 28 - April 4, 1998, Proceedings, Bernhard Steffen (Ed.) (Lecture Notes in Computer Science, Vol. 1384). Springer, 151–166. isbn:3-540-64356-7 https://doi.org/10.1007/BFb0054170
[27]
Jacob Prinz and Leonidas Lampropoulos. 2023. Artifact for Merging Inductive Relations. Zenodo. https://doi.org/10.5281/zenodo.7709704
[28]
Philip Wadler. 1990. Linear Types can Change the World!. In Programming Concepts and Methods.
[29]
Xuejun Yang, Yang Chen, Eric Eide, and John Regehr. 2011. Finding and understanding bugs in C compilers. In Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2011, San Jose, CA, USA, June 4-8, 2011. 283–294. https://doi.org/10.1145/1993498.1993532

Recommendations

Comments

Information & Contributors

Information

Published In

cover image Proceedings of the ACM on Programming Languages
Proceedings of the ACM on Programming Languages  Volume 7, Issue PLDI
June 2023
2020 pages
EISSN:2475-1421
DOI:10.1145/3554310
Issue’s Table of Contents
This work is licensed under a Creative Commons Attribution 4.0 International License.

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 06 June 2023
Published in PACMPL Volume 7, Issue PLDI

Permissions

Request permissions for this article.

Check for updates

Badges

Author Tags

  1. QuickChick
  2. inductive relations
  3. merging

Qualifiers

  • Research-article

Funding Sources

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • 0
    Total Citations
  • 214
    Total Downloads
  • Downloads (Last 12 months)135
  • Downloads (Last 6 weeks)19
Reflects downloads up to 12 Sep 2024

Other Metrics

Citations

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Get Access

Login options

Full Access

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media