skip to main content
research-article
Open Access

Unifying execution of imperative generators and declarative specifications

Published:13 November 2020Publication History
Skip Abstract Section

Abstract

We present Deuterium---a framework for implementing Java methods as executable contracts. Deuterium introduces a novel, type-safe way to write method contracts entirely in Java, as a combination of imperative generators and declarative specifications (written in a first-order relational logic with transitive closure). Existing approaches are typically based on encoding both the specification and the program heap into a constraint language, and then using an off-the-shelf constraint solver---without any additional guidance---to search for a new program heap that satisfies the specification. Deuterium takes advantage of user-provided generators to prune the search space and reduce incurred overhead of constraint solving. Deuterium supports two ways of solving declarative constraints: SAT-based and search-based with in-memory state exploration. We evaluate our approach on a suite of data structures, established as a standard benchmark by prior work. Furthermore, we use random and sequence-based test generation to create a new benchmark designed to mimic realistic execution scenarios. Our results show that generators improve the performance of executable contracts and that in-memory state exploration is the algorithm of choice when heap sizes are small.

Skip Supplemental Material Section

Supplemental Material

Auxiliary Presentation Video

This is a presentation video for our work accepted at OOPSLA'20 research track: Unifying Execution of Imperative Generators and Declarative Specifications.

References

  1. Ali Abbassi. 2018. Astra: Evaluating Translations from Alloy to SMT-LIB. http://hdl.handle.net/10012/14286 Ali Abbassi, Nancy A. Day, and Derek Rayside. 2019. Astra Version 1.0: Evaluating Translations from Alloy to SMT-LIB. ArXiv abs/ 1906.05881 ( 2019 ).Google ScholarGoogle Scholar
  2. Basel Y. Al-Nafouri. 2004. MintEra: A Testing Environment for Java Programs. Thesis (M. Eng.). Massachusetts Institute of Technology.Google ScholarGoogle Scholar
  3. Sahel Alouneh, Sa'ed Abed, Mohammad H. Al Shayeji, and Raed Mesleh. 2018. A Comprehensive Study and Analysis on SAT-Solvers: Advances, Usages and Achievements. Artificial Intelligence Review ( 2018 ), 1-27.Google ScholarGoogle Scholar
  4. Thomas Ball and Sriram K Rajamani. 2001. SLIC: A Specification Language for Interface Checking (of C). Technical Report. Technical Report MSR-TR-2001-21, Microsoft Research.Google ScholarGoogle Scholar
  5. Mike Barnett, Manuel Fähndrich, K Rustan M Leino, Peter Müller, Wolfram Schulte, and Herman Venter. 2011. Specification and Verification: The Spec# Experience. Commun. ACM 54, 6 ( 2011 ), 81-91.Google ScholarGoogle Scholar
  6. Mike Barnett, K. Rustan M. Leino, and Wolfram Schulte. 2005. The Spec# Programming System: An Overview. In Construction and Analysis of Safe, Secure, and Interoperable Smart Devices. 49-69.Google ScholarGoogle Scholar
  7. Chandrasekhar Boyapati, Sarfraz Khurshid, and Darko Marinov. 2002. Korat: Automated Testing Based on Java Predicates. In International Symposium on Software Testing and Analysis. 123-133.Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Eric Bruneton, Romain Lenglet, and Thierry Coupaye. 2002. ASM: A Code Manipulation Tool to Implement Adaptable Systems. In Adaptable and Extensible Component Systems.Google ScholarGoogle Scholar
  9. Lilian Burdy, Yoonsik Cheon, David R. Cok, Michael D. Ernst, Joseph R. Kiniry, Gary T. Leavens, K. Rustan M. Leino, and Erik Poll. 2005. An Overview of JML Tools and Applications. International Journal on Software Tools for Technology Transfer 7, 3 ( 2005 ), 212-232.Google ScholarGoogle ScholarCross RefCross Ref
  10. Patrice Chalin, Joseph R Kiniry, Gary T Leavens, and Erik Poll. 2005. Beyond Assertions: Advanced Specification and Verification with JML and ESC/Java2. In International Symposium on Formal Methods for Components and Objects. 342-363.Google ScholarGoogle Scholar
  11. Patrice Chalin, Robby, Perry R. James, Jooyong Lee, and George Karabotsos. 2010. Towards an Industrial Grade IVE for Java and Next Generation Research Platform for JML. International Journal on Software Tools for Technology Transfer 12, 6 ( 2010 ), 429-446.Google ScholarGoogle ScholarCross RefCross Ref
  12. Koen Claessen, Jonas Duregård, and Michal H Palka. 2014. Generating Constrained Random Data with Uniform Distribution. In International Symposium on Functional and Logic Programming, Vol. 8475. 18-34.Google ScholarGoogle Scholar
  13. David R. Cok. 2011. OpenJML: JML for Java 7 by Extending OpenJDK. In NASA Formal Methods Symposium. 472-479.Google ScholarGoogle ScholarCross RefCross Ref
  14. Stephen A. Cook. 1971. The Complexity of Theorem-Proving Procedures. In Symposium on Theory of Computing. 151-158.Google ScholarGoogle Scholar
  15. Brett Daniel, Danny Dig, Kely Garcia, and Darko Marinov. 2007. Automated Testing of Refactoring Engines. In Symposium on the Foundations of Software Engineering. 185-194.Google ScholarGoogle Scholar
  16. Manuel Fähndrich, Michael Barnett, Daan Leijen, and Francesco Logozzo. 2012. Integrating a Set of Contract Checking Tools into Visual Studio. In Workshop on Developing Tools as Plug-ins. 43-48.Google ScholarGoogle ScholarCross RefCross Ref
  17. Manuel Fähndrich, Michael Barnett, and Francesco Logozzo. 2010. Embedded Contract Languages. In Symposium on Applied Computing. 2103-2110.Google ScholarGoogle Scholar
  18. Burke Fetscher, Koen Claessen, Michał Pałka, John Hughes, and Robert Bruce Findler. 2015. Making random judgments: Automatically generating well-typed terms from the definition of a type-system. In European Symposium on Programming Languages and Systems. 383-405.Google ScholarGoogle ScholarCross RefCross Ref
  19. Norbert E. Fuchs. 1992. Specifications Are (Preferably) Executable. Software Engineering Journal 7, 5 ( 1992 ), 323-334.Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Juan Pablo Galeotti, Nicolás Rosner, Carlos Gustavo López Pombo, and Marcelo Fabian Frias. 2010. Analysis of Invariants for Eficient Bounded Verification. In International Symposium on Software Testing and Analysis. 25-36.Google ScholarGoogle Scholar
  21. Milos Gligoric, Tihomir Gvero, Vilas Jagannath, Sarfraz Khurshid, Viktor Kuncak, and Darko Marinov. 2010. Test Generation through Programming in UDITA. In International Conference on Software Engineering. 225-234.Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. C.A.R. Hoare. 1987. An Overview of Some Formal Methods for Program Design. Computer 9 ( 1987 ), 85-91.Google ScholarGoogle Scholar
  23. Daniel Jackson. 2002. Alloy: A Lightweight Object Modelling Notation. ACM Trans. Softw. Eng. Methodol. 11, 2 ( 2002 ), 256-290.Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Eugene Kuleshov. 2007. Using the ASM Framework to Implement Common Java Bytecode Transformation Patterns. In Aspect-Oriented Software Development.Google ScholarGoogle Scholar
  25. Viktor Kuncak, Etienne Kneuss, and Philippe Suter. 2013. Executing Specifications Using Synthesis and Constraint Solving. In International Conference on Runtime Verification. 1-20.Google ScholarGoogle Scholar
  26. Ivan Kuraj, Viktor Kuncak, and Daniel Jackson. 2015. Programming with Enumerable Sets of Structures. In International Conference on Object-Oriented Programming, Systems, Languages, and Applications. 37-56.Google ScholarGoogle Scholar
  27. Leonidas Lampropoulos, Diane Gallois-Wong, Cătălin Hriţcu, John Hughes, Benjamin C Pierce, and Li-yao Xia. 2017. Beginner's luck: a language for property-based generators. In Symposium on Principles of Programming Languages. 114-129.Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Leonid Anatolevich Levin. 1973. Universal Sequential Search Problems. Problemy Peredachi Informatsii 9, 3 ( 1973 ), 115-116.Google ScholarGoogle Scholar
  29. Barbara Liskov and John Guttag. 2000. Program Development in Java: Abstraction, Specification, and Object-Oriented Design.Google ScholarGoogle Scholar
  30. Francesco Logozzo. 2013. Practical Specification and Verification with Code Contracts. In SIGAda Annual Conference on High Integrity Language Technology. 7-8.Google ScholarGoogle Scholar
  31. Gus Lopez, Bjørn N. Freeman-Benson, and Alan Borning. 1993. Kaleidoscope: A Constraint Imperative Programming Language. In Constraint Programming, Proceedings of the NATO Advanced Study Institute on Constraint Programming. 313-329.Google ScholarGoogle Scholar
  32. Darko Marinov and Sarfraz Khurshid. 2001. TestEra: A Novel Framework for Automated Testing of Java Programs. In International Conference on Automated Software Engineering. 22-31.Google ScholarGoogle Scholar
  33. Baoluo Meng, Andrew Reynolds, Cesare Tinelli, and Clark Barrett. 2017. Relational Constraint Solving in SMT. In International Conference on Automated Deduction. 148-165.Google ScholarGoogle Scholar
  34. Aleksandar Milicevic, Ido Efrati, and Daniel Jackson. 2014. Rby-An Embedding of Alloy in Ruby. In International Conference on Abstract State Machines, Alloy, B, TLA, VDM, and Z. 56-71.Google ScholarGoogle Scholar
  35. Aleksandar Milicevic, Derek Rayside, Kuat Yessenov, and Daniel Jackson. 2011. Unifying Execution of Imperative and Declarative Code. In International Conference on Software Engineering. 511-520.Google ScholarGoogle Scholar
  36. Joseph P Near and Daniel Jackson. 2010. An Imperative Extension to Alloy. In International Conference on Abstract State Machines, Alloy, B and Z. 118-131.Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Oracle and/or its afiliates. 2020. Java™ Platform, Standard Edition 8 API Specification. https://docs.oracle.com/javase/8/ docs/api/.Google ScholarGoogle Scholar
  38. Carlos Pacheco, Shuvendu K. Lahiri, Michael D. Ernst, and Thomas Ball. 2007. Feedback-directed Random Test Generation. In International Conference on Software Engineering. 75-84.Google ScholarGoogle Scholar
  39. Nadia Polikarpova, Carlo A Furia, and Scott West. 2013. To Run What No One Has Run Before: Executing an Intermediate Verification Language. In International Conference on Runtime Verification. 251-268.Google ScholarGoogle ScholarCross RefCross Ref
  40. Derek Rayside, Aleksandar Milicevic, Kuat Yessenov, Greg Dennis, and Daniel Jackson. 2009. Agile Specifications. In International Conference on Object-Oriented Programming, Systems, Languages, and Applications. 999-1006.Google ScholarGoogle Scholar
  41. Derek Rayside, Vajihollah Montaghami, Francesca Leung, Albert Yuen, Kevin Xu, and Daniel Jackson. 2012. Synthesizing Iterators from Abstraction Functions. In International Conference on Generative Programming and Component Engineering. 31-40.Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Christoph Reichenbach, Yannis Smaragdakis, and Neil Immerman. 2012. PQL: A Purely-Declarative Java Extension for Parallel Programming. In European Conference on Object-Oriented Programming. 53-78.Google ScholarGoogle Scholar
  43. Nicolás Rosner, Valeria S. Bengolea, Pablo Ponzio, Shadi Abdul Khalek, Nazareno Aguirre, Marcelo F. Frias, and Sarfraz Khurshid. 2014. Bounded Exhaustive Test Input Generation from Hybrid Invariants. In International Conference on Object-Oriented Programming, Systems, Languages, and Applications. 655-674.Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. Hesam Samimi, Ei Darli Aung, and Todd Millstein. 2010. Falling Back on Executable Specifications. In European Conference on Object-Oriented Programming. 552-576.Google ScholarGoogle Scholar
  45. Hesam Samimi, Rebecca Hicks, Ari Fogel, and Todd Millstein. 2013. Declarative mocking. In International Symposium on Software Testing and Analysis. 246-256.Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. Rohan Sharma, Milos Gligoric, Andrea Arcuri, Gordon Fraser, and Darko Marinov. 2011a. Predicate Coverage. http://mir.cs.illinois.edu/coverage/.Google ScholarGoogle Scholar
  47. Rohan Sharma, Milos Gligoric, Andrea Arcuri, Gordon Fraser, and Darko Marinov. 2011b. Testing Container Classes: Random or Systematic?. In Fundamental Approaches to Software Engineering. 262-277.Google ScholarGoogle Scholar
  48. Armando Solar-Lezama, Liviu Tancau, Rastislav Bodík, Sanjit A. Seshia, and Vijay A. Saraswat. 2006. Combinatorial Sketching for Finite Programs. In International Conference on Architectural Support for Programming Languages and Operating Systems. 404-415.Google ScholarGoogle Scholar
  49. Emina Torlak and Rastislav Bodik. 2013. Growing Solver-Aided Languages with Rosette. In Symposium on New Ideas, New Paradigms, and Reflections on Programming & Software. 135-152.Google ScholarGoogle Scholar
  50. Emina Torlak and Daniel Jackson. 2007. Kodkod: A Relational Model Finder. In Tools and Algorithms for the Construction and Analysis of Systems. 632-647.Google ScholarGoogle Scholar
  51. Willem Visser, Jaco Geldenhuys, and Matthew B. Dwyer. 2012. Green: Reducing, Reusing and Recycling Constraints in Program Analysis. In International Symposium on the Foundations of Software Engineering. 58.Google ScholarGoogle Scholar
  52. Willem Visser, Corina S Paˇsaˇreanu, and Radek Pelánek. 2006. Test Input Generation for Java Containers using State Matching. In International Symposium on Software Testing and Analysis. 37-48.Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. Wikipedia. 2020. Eight Queens Puzzle. https://en.wikipedia.org/wiki/Eight_queens_puzzle.Google ScholarGoogle Scholar
  54. Kuat T. Yessenov. 2009a. JForge: Eclipse Plug-in for Bounded Code Verification. https://groups.csail.mit.edu/sdg/forge/plugin. html.Google ScholarGoogle Scholar
  55. Kuat T. Yessenov. 2009b. A Lightweight Specification Language for Bounded Program Verification. Ph.D. Dissertation. Massachusetts Institute of Technology.Google ScholarGoogle Scholar

Index Terms

  1. Unifying execution of imperative generators and declarative specifications

            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 Proceedings of the ACM on Programming Languages
              Proceedings of the ACM on Programming Languages  Volume 4, Issue OOPSLA
              November 2020
              3108 pages
              EISSN:2475-1421
              DOI:10.1145/3436718
              Issue’s Table of Contents

              Copyright © 2020 Owner/Author

              Publisher

              Association for Computing Machinery

              New York, NY, United States

              Publication History

              • Published: 13 November 2020
              Published in pacmpl Volume 4, Issue OOPSLA

              Permissions

              Request permissions about this article.

              Request Permissions

              Check for updates

              Qualifiers

              • research-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!