skip to main content
10.1145/3385412.3385967acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections
research-article

Data-driven inference of representation invariants

Published: 11 June 2020 Publication History

Abstract

A representation invariant is a property that holds of all values of abstract type produced by a module. Representation invariants play important roles in software engineering and program verification. In this paper, we develop a counterexample-driven algorithm for inferring a representation invariant that is sufficient to imply a desired specification for a module. The key novelty is a type-directed notion of visible inductiveness, which ensures that the algorithm makes progress toward its goal as it alternates between weakening and strengthening candidate invariants. The algorithm is parameterized by an example-based synthesis engine and a verifier, and we prove that it is sound and complete for first-order modules over finite types, assuming that the synthesizer and verifier are as well. We implement these ideas in a tool called Hanoi, which synthesizes representation invariants for recursive data types. Hanoi not only handles invariants for first-order code, but higher-order code as well. In its back end, Hanoi uses an enumerative synthesizer called Myth and an enumerative testing tool as a verifier. Because Hanoi uses testing for verification, it is not sound, though our empirical evaluation shows that it is successful on the benchmarks we investigated.

References

[1]
Andrew Appel. 2018. Software Foundations Volume 3: Verified Functional Algorithms. https://softwarefoundations.cis.upenn.edu/vfacurrent/index.html
[2]
Haniel Barbosa, Andrew Reynolds, Daniel Larraz, and Cesare Tinelli. 2019. Extending Enumerative Function Synthesis via SMT-Driven Classification. In 2019 Formal Methods in Computer Aided Design, FMCAD. IEEE, 212–220.
[3]
C. Boyapati, S. Khurshid, and D. Marinov. 2002. Korat: Automated testing based on Java predicates. In Proceedings of the International Symposium on Software Testing and Analysis (ISSTA’02). ACM, Roma, Italy, 123–133.
[4]
Aaron R. Bradley. [n.d.]. SAT-Based Model Checking without Unrolling. In Verification, Model Checking, and Abstract Interpretation - 12th International Conference, VMCAI 2011, Austin, TX, USA, January 23-25, 2011. Proceedings (Lecture Notes in Computer Science). Springer, 70–87.
[5]
Adrien Champion, Tomoya Chiba, Naoki Kobayashi, and Ryosuke Sato. 2018. ICE-Based Refinement Type Discovery for Higher-Order Functional Programs. In Tools and Algorithms for the Construction and Analysis of Systems - 24th International Conference, TACAS (Lecture Notes in Computer Science), Vol. 10805. Springer, 365–384.
[6]
Koen Claessen and John Hughes. 2000. QuickCheck: a lightweight tool for random testing of Haskell programs. In Proceedings of the ACM Sigplan International Conference on Functional Programming (ICFP-00) (ACM Sigplan Notices), Vol. 35.9. ACM Press, N.Y., 268–279.
[7]
P. Ezudheen, Daniel Neider, Deepak D’Souza, Pranav Garg, and P. Madhusudan. 2018. Horn-ICE Learning for Synthesizing Invariants and Contracts. PACMPL 2, OOPSLA (2018), 131:1–131:25.
[8]
Grigory Fedyukovich, Samuel J. Kaufman, and Rastislav Bodík. 2017. Sampling Invariants from Frequency Distributions. In 2017 Formal Methods in Computer Aided Design, FMCAD. IEEE, 100–107.
[9]
Robert Bruce Findler and Matthias Felleisen. 2002. Contracts for higher-order functions. In Proceedings of ACM SIGPLAN International Conference on Functional Programming. ACM, New York, NY, 48–59.
[10]
Pranav Garg, Daniel Neider, P. Madhusudan, and Dan Roth. 2016. Learning Invariants using Decision Trees and Implication Counterexamples. In Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL. ACM, 499–512.
[11]
Hossein Hojjat and Philipp Rümmer. 2018. The ELDARICA Horn Solver. In 2018 Formal Methods in Computer Aided Design, FMCAD. IEEE, 1–7.
[12]
Ming Kawaguchi, Patrick Rondon, and Ranjit Jhala. 2009. Typebased Data Structure Verification. In Proceedings of the 30th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’09). ACM, New York, NY, USA, 304–315.
[13]
Anvesh Komuravelli, Arie Gurfinkel, and Sagar Chaki. 2016. SMTBased Model Checking for Recursive Programs. Formal Methods in System Design 48, 3 (2016), 175–205. 016-0249-4
[14]
Ton Chanh Le, Guolong Zheng, and ThanhVu Nguyen. 2019. SLING: Using Dynamic Analysis to Infer Program Invariants in Separation Logic. In Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI, Kathryn S. McKinley and Kathleen Fisher (Eds.). ACM, 788–801. 3314221.3314634
[15]
Muhammad Zubair Malik, Aman Pervaiz, and Sarfraz Khurshid. 2007. Generating Representation Invariants of Structurally Complex Data. In Tools and Algorithms for the Construction and Analysis of Systems, 13th International Conference, TACAS (Lecture Notes in Computer Science), Vol. 4424. Springer, 34–49. 1_5
[16]
Bertrand Meyer. 1997. Design by Contract: Making Object-Oriented Programs that Work. In TOOLS (25). IEEE Computer Society, 360. https://ieeexplore.ieee.org/xpl/mostRecentIssue.jsp?punumber=5604
[17]
Anders Miltner, Saswat Padhi, Todd Millstein, and David Walker. 2020.
[18]
Data-Driven Inference of Representation Invariants. arXiv: cs.PL/2003.12106
[19]
Daniel Neider, Pranav Garg, P. Madhusudan, Shambwaditya Saha, and Daejun Park. 2018. Invariant Synthesis for Incomplete Verification Engines. In Tools and Algorithms for the Construction and Analysis of Systems - 24th International Conference, TACAS (Lecture Notes in Computer Science), Vol. 10805. Springer, 232–250. 1007/978-3-319-89960-2_13
[20]
ThanhVu Nguyen, Timos Antonopoulos, Andrew Ruef, and Michael Hicks. 2017. Counterexample-Guided Approach to Finding Numerical Invariants. In Proceedings of the 2017 11th Joint Meeting on Foundations of Software Engineering, ESEC/FSE. ACM, 605–615. 1145/3106237.3106281
[21]
Peter-Michael Osera and Steve Zdancewic. 2015. Type-and-Example-Directed Program Synthesis. In Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation, POPL. ACM, 619–630.
[22]
Saswat Padhi, Rahul Sharma, and Todd D. Millstein. 2016. Data-Driven Precondition Inference with Learned Features. In Proceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI. ACM, 42–56.
[23]
[24]
Benjamin C. Pierce. 2002. Types and Programming Languages. MIT Press.
[25]
https://www.cis.upenn.edu/~bcpierce/tapl/
[26]
John C. Reynolds. 1983. Types, Abstraction and Parametric Polymorphism. In Information Processing 83, Proceedings of the IFIP 9th World Computer Congress, Paris, France, September 19-23, 1983. 513–523.
[27]
Mooly Sagiv, Thomas Reps, and Reinhard Wilhelm. 1999. Parametric Shape Analysis via 3-valued Logic. In Proceedings of the 26th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’99). ACM, New York, NY, USA, 105–118. 1145/292540.292552
[28]
Rahul Sharma and Alex Aiken. 2016. From Invariant Checking to Invariant Inference using Randomized Search. Formal Methods in System Design 48, 3 (2016), 235–256. 016-0248-5
[29]
Xujie Si, Hanjun Dai, Mukund Raghothaman, Mayur Naik, and Le Song. 2018. Learning Loop Invariants for Program Verification. In Data-Driven Inference of Representation Invariants PLDI ’20, June 15–20, 2020, London, UK Advances in Neural Information Processing Systems 31: Annual Conference on Neural Information Processing Systems 2018, NeurIPS. 7762– 7773. https://papers.nips.cc/paper/8001-learning-loop-invariants-forprogram-verification
[30]
Lau Skorstengaard. 2015. An Introduction to Logical Relations. https://www.cs.uoregon.edu/research/summerschool/ summer16/notes/AhmedLR.pdf Notes based on lectures by Amal Ahmed at the Oregon Programming Languages Summer School.
[31]
Armando Solar-Lezama. 2013. Program Sketching. STTT 15, 5-6 (2013), 475–495.
[32]
Philippe Suter, Ali Sinan Köksal, and Viktor Kuncak. 2011. Satisfiability Modulo Recursive Programs. In Static Analysis - 18th International Symposium, SAS (Lecture Notes in Computer Science), Vol. 6887. Springer, 298–315.
[33]
The Coq Development Team. 2019. The Coq Proof Assistant, version 8.10.0.

Cited By

View all
  • (2024)A HAT Trick: Automatically Verifying Representation Invariants using Symbolic Finite AutomataProceedings of the ACM on Programming Languages10.1145/36564338:PLDI(1387-1411)Online publication date: 20-Jun-2024
  • (2024)Semantic Code Refactoring for Abstract Data TypesProceedings of the ACM on Programming Languages10.1145/36328708:POPL(816-847)Online publication date: 5-Jan-2024
  • (2024)On the Hunt for Invalid Objects: Exploring the Object State Space with Program Mutants2024 IEEE International Conference on Software Analysis, Evolution and Reengineering (SANER)10.1109/SANER60148.2024.00078(711-716)Online publication date: 12-Mar-2024
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
PLDI 2020: Proceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation
June 2020
1174 pages
ISBN:9781450376136
DOI:10.1145/3385412
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].

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 11 June 2020

Permissions

Request permissions for this article.

Check for updates

Badges

Author Tags

  1. Abstract Data Types
  2. Logical Relations
  3. Type-Directed Synthesis

Qualifiers

  • Research-article

Funding Sources

Conference

PLDI '20
Sponsor:

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)61
  • Downloads (Last 6 weeks)8
Reflects downloads up to 16 Nov 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