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

Logarithm and program testing

Published: 12 January 2022 Publication History

Abstract

Randomized property-based testing has gained much attention recently, but most frameworks stop short at polymorphic properties. Although Bernardy et al. have developed a theory to reduce a wide range of polymorphic properties to monomorphic ones, it relies upon ad-hoc embedding-projection pairs to massage the types into a particular form. This paper skips the embedding-projection pairs and presents a mechanical monomorphization for a general class of polymorphic functions, a step towards automatic testing for polymorphic properties. The calculation of suitable types for monomorphization turns out to be logarithm.

Supplementary Material

Auxiliary Archive (popl22main-p764-p-archive.zip)
Full proofs of a variant of Lemma 3.2 and Theorem 4.1 from the main article.
Auxiliary Presentation Video (popl22main-p764-p-video.mp4)
5-min talk on the paper.

References

[1]
Michael Abbott, Thorsten Altenkirch, and Neil Ghani. 2003. Categories of containers. In International Conference on Foundations of Software Science and Computation Structures. 23–38. https://doi.org/10.1007/3-540-36576-1_2
[2]
Thorsten Altenkirch, Neil Ghani, Peter Hancock, Conor McBride, and Peter Morris. 2015. Indexed containers. Journal of Functional Programming, 25, e5. https://doi.org/10.1017/S095679681500009X
[3]
Jean-Philippe Bernardy. 2017. A dual view of testing of (polymorphic) programs. https://jyp.github.io/posts/polytest-two.html
[4]
Jean-Philippe Bernardy, Patrik Jansson, and Koen Claessen. 2010. Testing Polymorphic Properties. In Programming Languages and Systems. Springer Berlin Heidelberg, Berlin, Heidelberg. 125–144. isbn:978-3-642-11957-6 https://doi.org/10.1007/978-3-642-11957-6_8
[5]
Richard Bird and Lambert Meertens. 1998. Nested datatypes. In International Conference on Mathematics of Program Construction. 52–67. https://doi.org/10.1007/BFb0054285
[6]
Koen Claessen and John Hughes. 2000. QuickCheck: A Lightweight Tool for Random Testing of Haskell Programs. In Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming (ICFP ’00). ACM, New York, NY, USA. 268–279. isbn:1-58113-202-6 https://doi.org/10.1145/351240.351266
[7]
CMU 15-210 Staff. 2018. The SEQUENCE signature. http://www.cs.cmu.edu/afs/cs/academic/class/15210-f15/www/docs/sig/sequence/SEQUENCE.html
[8]
Peter Hancock. 2019. Personal communication, along with some notes.
[9]
Ralf Hinze and Ross Paterson. 2006. Finger trees: a simple general-purpose data structure. Journal of functional programming, 16, 2 (2006), 197–217. https://doi.org/10.1017/S0956796805005769
[10]
Kuen-Bang Hou (Favonia) and Zhuyang Wang. 2021. Replication Package for Article: Logarithm and Program Testing. https://doi.org/10.1145/3462305
[11]
Jane Street Group. 2018. Ppxlib - Meta-programming for OCaml. https://github.com/ocaml-ppx/ppxlib
[12]
C Barry Jay. 1995. A semantics for shape. Science of Computer Programming, 25, 2-3 (1995), 251–283. https://doi.org/10.1016/0167-6423(95)00015-1 Selected Papers of ESOP’94, the 5th European Symposium on Programming
[13]
John C Reynolds. 1983. Types, abstraction and parametric polymorphism. In Information Processing 83, Proceedings of the IFIP 9th World Computer Congres. 513–523.
[14]
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 (Haskell ’08). ACM, New York, NY, USA. 37–48. isbn:978-1-60558-064-7 https://doi.org/10.1145/1411286.1411292
[15]
Janis Voigtländer. 2008. Much Ado About Two (Pearl): A Pearl on Parallel Prefix Computation. In Proceedings of the 35th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’08). ACM, New York, NY, USA. 29–35. isbn:978-1-59593-689-9 https://doi.org/10.1145/1328438.1328445
[16]
Philip Wadler. 1989. Theorems for Free!. In Proceedings of the Fourth International Conference on Functional Programming Languages and Computer Architecture (FPCA ’89). ACM, New York, NY, USA. 347–359. isbn:0-89791-328-0 https://doi.org/10.1145/99370.99404
[17]
Zhuyang Wang. 2021. PolyCheck: Testing Polymorphic Functions. https://github.com/hawnzug/polycheck
[18]
Li-yao Xia. 2017. A terminal view of testing polymorphic functions. https://blog.poisson.chat/posts/2017-06-29-terminal-monomorphization.html
[19]
Li-yao Xia. 2017. Test Polymorphic Functions with Metamorph. https://github.com/Lysxia/metamorph

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image Proceedings of the ACM on Programming Languages
Proceedings of the ACM on Programming Languages  Volume 6, Issue POPL
January 2022
1886 pages
EISSN:2475-1421
DOI:10.1145/3511309
Issue’s Table of Contents
This work is licensed under a Creative Commons Attribution International 4.0 License.

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 12 January 2022
Published in PACMPL Volume 6, Issue POPL

Permissions

Request permissions for this article.

Check for updates

Badges

Author Tags

  1. logarithm
  2. parametricity
  3. polymorphism

Qualifiers

  • Research-article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)237
  • Downloads (Last 6 weeks)22
Reflects downloads up to 25 Feb 2025

Other Metrics

Citations

Cited By

View all

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Full Access

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media