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

Extending Liquid Types to Arrays

Published: 21 January 2020 Publication History

Abstract

A liquid type is an ordinary Hindley-Milner type annotated with a logical predicate that states the properties satisfied by the elements of that type. Liquid types are a powerful tool for program verification, as programmers can use them to specify pre- and post conditions of their programs, whereas the predicates of intermediate variables and auxiliary functions are inferred automatically. Type inference is feasible in this context, as the logical predicates within liquid types are constrained to a quantifier-free logic to maintain decidability.
In this article, we extend liquid types by allowing them to contain quantified properties on arrays so that they can be used to infer invariants on array-related programs (e.g., implementations of sorting algorithms). Although quantified logic is, in general, undecidable, we restrict properties on arrays to a decidable subset introduced by Bradley et al. We describe in detail the extended type system, the verification condition generator, and the iterative weakening algorithm for inferring invariants. After proving the correctness and completeness of these two algorithms, we apply them to find invariants on a set of algorithms involving array manipulations.

Supplementary Material

a13-montenegro-apndx.pdf (montenegro.zip)
Supplemental movie, appendix, image and software files for, Extending Liquid Types to Arrays

References

[1]
Wolfgang Ahrendt, Thomas Baar, Bernhard Beckert, Martin Giese, Elmar Habermalz, Reiner Hähnle, Wolfram Menzel, and Peter H. Schmitt. 2000. The KeY approach: Integrating object oriented design and formal verification. In JELIA 2000: Logics in Artificial Intelligence. Lecture Notes in Computer Science, Vol. 1919. Springer, 21--36.
[2]
Alexander Bakst and Ranjit Jhala. 2016. Predicate abstraction for linked data structures. In VMCAI 2016: Verification, Model Checking, and Abstract Interpretation. Lecture Notes in Computer Science, Vol. 9583. Springer, 65--84.
[3]
Thomas Ball, Rupak Majumdar, Todd D. Millstein, and Sriram K. Rajamani. 2001. Automatic predicate abstraction of C programs. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’01). 203--213.
[4]
Michael Barnett, Robert DeLine, Manuel Fähndrich, Bart Jacobs, K. Rustan M. Leino, Wolfram Schulte, and Herman Venter. 2005. The Spec# programming system: Challenges and directions. In VSTTE 2005: Verified Software: Theories, Tools, Experiments. Lecture Notes in Computer Science, Vol. 4171. Springer, 144--152.
[5]
Aaron R. Bradley, Zohar Manna, and Henny B. Sipma. 2006. What’s decidable about arrays? In Proceedings of the 7th International Conference on Verification, Model Checking, and Abstract Interpretation (VMCAI’06). Springer, 427--442.
[6]
Ravi Chugh, David Herman, and Ranjit Jhala. 2012. Dependent types for JavaScript. In Proceedings of the 27th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA’12). 587--606.
[7]
Benjamin Cosman and Ranjit Jhala. 2017. Local refinement typing. In Proceedings of the ACM Conference on Programming Languages, Vol. 1, Issue ICFP. Article 26, 27 pages.
[8]
Patrick Cousot, Radhia Cousot, and Francesco Logozzo. 2011. A parametric segmentation functor for fully automatic and scalable array content analysis. In Proceedings of the ACM SIGPLAN Symposium on Principles of Programming Languages (POPL’11). 105--118.
[9]
E. W. Dijkstra. 1976. A Discipline of Programming. Prentice Hall.
[10]
Matthias Felleisen and Philippa Gardner (Eds.). 2013. Programming Languages and Systems: 22nd European Symposium on Programming (ESOP’13). Lecture Notes in Computer Science, Vol. 7792. Springer.
[11]
Jean-Christophe Filliâtre and Andrei Paskevich. 2013. Why3—Where programs meet provers. In ESOP 2013: Programming Languages and Systems. Lecture Notes in Computer Science, Vol. 7792. Springer, 125--128.
[12]
Cormac Flanagan, K. Rustan M. Leino, Mark Lillibridge, Greg Nelson, James B. Saxe, and Raymie Stata. 2002. Extended static checking for Java. In Proceedings of the 2002 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’02). ACM, New York, NY, 234--245.
[13]
Cormac Flanagan and Shaz Qadeer. 2002. Predicate abstraction for software verification. In Proceedings of the 29th SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’02). ACM, New York, NY, 191--202.
[14]
Denis Gopan, Thomas W. Reps, and Shmuel Sagiv. 2005. A framework for numeric analysis of array operations. In Proceedings of the 32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’05). 338--350.
[15]
Sumit Gulwani, Bill McCloskey, and Ashish Tiwari. 2008. Lifting abstract interpreters to quantified logical domains. In Proceedings of the 35th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’08). ACM, New York, NY, 235--246.
[16]
Rajiv Gupta and Saman P. Amarasinghe (Eds.). 2008. Proceedings of the 2008 ACM SIGPLAN Conference on Programming Language Design and Implementation(PLDI’08). ACM, New York, NY.
[17]
Peter Habermehl, Radu Iosif, and Tomás Vojnar. 2008. What else is decidable about integer arrays? In FoSSaCS 2008: Foundations of Software Science and Computational Structures. Lecture Notes in Computer Science, Vol. 4962. Springer, 474--489.
[18]
Nicolas Halbwachs and Mathias Péron. 2008. Discovering properties about arrays in simple programs. In Proceedings of the 29th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’08). 339--348.
[19]
Michael Hind and Amer Diwan (Eds.). 2009. Proceedings of the 2009 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’09). ACM, New York, NY.
[20]
Ming Kawaguchi, Patrick Maxim Rondon, and Ranjit Jhala. 2009. Type-based data structure verification. In Proceedings of the 30th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’09). 304--315.
[21]
K. Rustan M. Leino. 2012. Developing verified programs with Dafny. In Proceedings of the 2012 ACM Conference on High Integrity Language Technology (HILT’12). ACM, New York, NY, 9--10.
[22]
Manuel Montenegro, Susana Nieva, Ricardo Peña, and Clara Segura. 2017. Liquid types for array invariant synthesis. In Proceedings of the International Symposium on Automated Technology for Verification and Analysis (ATVA’17). 289--306.
[23]
Manuel Montenegro, Ricardo Peña, and Jaime Sánchez-Hernández. 2015. A generic intermediate representation for verification condition generation. In LOPSTR 2015: Logic-Based Program Synthesis and Transformation. Lecture Notes in Computer Science, Vol. 9527. Springer, 227--243.
[24]
Leonardo Mendonça de Moura and Nikolaj Bjørner. 2008. Z3: An efficient SMT solver. In TACAS 2008: Tools and Algorithms for the Construction and Analysis of Systems. Lecture Notes in Computer Science, Vol. 4963. Springer, 337--340.
[25]
Leonardo Mendonça de Moura and Nikolaj Bjørner. 2009. Generalized, efficient array decision procedures. In Proceedings of the 2009 Conference on Formal Methods in Computer-Aided Design (FMCAD’09). IEEE, Los Alamitos, CA, 45--52.
[26]
John C. Reynolds. 1998. Definitional interpreters for higher-order programming languages. Higher-Order and Symbolic Computation 11, 4 (1998), 363--397.
[27]
Patrick Maxim Rondon, Ming Kawaguchi, and Ranjit Jhala. 2008. Liquid types. In Proceedings of the 29th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’08). 159--169.
[28]
Patrick Maxim Rondon, Ming Kawaguchi, and Ranjit Jhala. 2010. Low-level liquid types. In Proceedings of the 37th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’10). ACM, New York, NY, 131--144.
[29]
Saurabh Srivastava and Sumit Gulwani. 2009. Program verification using templates over predicate abstraction. In Proceedings of the 30th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’09). 223--234.
[30]
Aaron Stump, Clark W. Barrett, David L. Dill, and Jeremy R. Levitt. 2001. A decision procedure for an extensional theory of arrays. In Proceedings of the 16th Annual IEEE Symposium on Logic in Computer Science (LICS’01). IEEE, Los Alamitos, CA, 29--37.
[31]
Norihisa Suzuki and David Jefferson. 1980. Verification decidability of Presburger array programs. Journal of the ACM 27, 1 (1980), 191--205.
[32]
Nikhil Swamy, Catalin Hritcu, Chantal Keller, Aseem Rastogi, Antoine Delignat-Lavaud, Simon Forest, Karthikeyan Bhargavan, et al. 2016. Dependent types and multi-monadic effects in F*. In Proceedings of the 43rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’16). ACM, New York, NY, 256--270.
[33]
Nikhil Swamy, Joel Weinberger, Cole Schlesinger, Juan Chen, and Benjamin Livshits. 2013. Verifying higher-order programs with the Dijkstra monad. In Proceedings of the 34th Annual ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’13). 387--398.
[34]
Niki Vazou, Alexander Bakst, and Ranjit Jhala. 2015. Bounded refinement types. In Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming (ICFP’15). 48--61.
[35]
Niki Vazou, Patrick Maxim Rondon, and Ranjit Jhala. 2013. Abstract refinement types. In ESOP 2013: Programming Languages and Systems. Lecture Notes in Computer Science, Vol. 7792. Springer, 209--228.
[36]
Niki Vazou, Eric L. Seidel, and Ranjit Jhala. 2014. LiquidHaskell: Experience with refinement types in the real world. In Proceedings of the ACM SIGPLAN Symposium on Haskell (Haskell’14). 39--51.
[37]
Niki Vazou, Eric L. Seidel, Ranjit Jhala, Dimitrios Vytiniotis, and Simon L. Peyton Jones. 2014. Refinement types for Haskell. In Proceedings of the 19th ACM SIGPLAN International Conference on Functional Programming (ICFP’14). 269--282.
[38]
Panagiotis Vekris, Benjamin Cosman, and Ranjit Jhala. 2016. Refinement types for TypeScript. In Proceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’16). arXiv:arXiv:1604.02480v1

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Transactions on Computational Logic
ACM Transactions on Computational Logic  Volume 21, Issue 2
April 2020
316 pages
ISSN:1529-3785
EISSN:1557-945X
DOI:10.1145/3371152
  • Editor:
  • Orna Kupferman
Issue’s Table of Contents
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 ACM 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: 21 January 2020
Accepted: 01 September 2019
Revised: 01 June 2019
Received: 01 December 2018
Published in TOCL Volume 21, Issue 2

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Dependent types
  2. invariant synthesis
  3. liquid types

Qualifiers

  • Research-article
  • Research
  • Refereed

Funding Sources

  • EIE Funds of the EU
  • Comunidad de Madrid as part of the program
  • Spanish Ministry of Economy and Competitiveness, State Research Agency, and the European Regional Development Fund

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • 0
    Total Citations
  • 202
    Total Downloads
  • Downloads (Last 12 months)18
  • Downloads (Last 6 weeks)3
Reflects downloads up to 04 Oct 2024

Other Metrics

Citations

Cited By

View all

View Options

Get Access

Login options

Full Access

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

HTML Format

View this article in HTML Format.

HTML Format

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media