Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/2429069.2429121acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
research-article

HALO: haskell to logic through denotational semantics

Published: 23 January 2013 Publication History

Abstract

Even well-typed programs can go wrong in modern functional languages, by encountering a pattern-match failure, or simply returning the wrong answer. An increasingly-popular response is to allow programmers to write contracts that express semantic properties, such as crash-freedom or some useful post-condition. We study the static verification of such contracts. Our main contribution is a novel translation to first-order logic of both Haskell programs, and contracts written in Haskell, all justified by denotational semantics. This translation enables us to prove that functions satisfy their contracts using an off-the-shelf first-order logic theorem prover.

Supplementary Material

JPG File (r1d3_talk5.jpg)
MP4 File (r1d3_talk5.mp4)

References

[1]
Andreas Abel, Thierry Coquand, and Ulf Norell. Connecting a logical framework to a first-order logic prover. In 5th International Workshop on Frontiers of Combining Systems (FroCoS), LNCS. Springer Verlag, 2005.
[2]
Michael Barnett, Bor-Yuh Evan Chang, Robert DeLine, Bart Jacobs, and K. Rustan M. Leino. Boogie: A modular reusable verifier for objectoriented programs. In Formal methods for Components and Objects, pages 364--387, 2005.
[3]
Nick Benton, Andrew Kennedy, and Carsten Varming. Some domain theory and denotational semantics in coq. In Proceedings of the 22nd International Conference on Theorem Proving in Higher Order Logics, TPHOLs'09, pages 115--130, Berlin, Heidelberg, 2009. Springer-Verlag.
[4]
Gavin M. Bierman, Andrew D. Gordon, Catalin Hritcu, and David Langworthy. Semantic subtyping with an SMT solver. In Proceedings of the 15th ACM SIGPLAN International Conference on Functional programming, ICFP'10, pages 105--116, New York, NY, USA, 2010. ACM.
[5]
Jasmin Blanchette, Sascha Bohme, and Lawrence Paulson. Extending Sledgehammer with SMT solvers. In Conference on Automated Deduction (CADE), LNCS. Springer Verlag, 2011.
[6]
Matthias Blume and David McAllester. Sound and complete models of contracts. J. Funct. Program., 16(4-5):375--414, July 2006. ISSN 0956-7968.
[7]
Ana Bove, Peter Dybjer, and Andrés Sicard-Ram1rez. Combining interactive and automatic reasoning in first order theories of functional programs. In Lars Birkedal, editor, 15th International Conference on Foundations of Software Science and Computational Structures, FoSSaCS 2012, volume 7213 of LNCS, pages 104--118, March 2012.
[8]
Arthur Charguéraud. Characteristic formulae for the verification of imperative programs. In Proceedings of the 16th ACM SIGPLAN International Conference on Functional Programming, ICFP'11, pages 418--430, New York, NY, USA, 2011. ACM.
[9]
Koen Claessen and Niklas Sörensson. New techniques that improve MACEstyle model finding. In Proc. of Workshop on Model Computation (MODEL), 2003.
[10]
Leonardo De Moura and Nikolaj Bjørner. Z3: an efficient SMT solver. In Proceedings of the Theory and Practice of Software, 14th International Conference on Tools and Algorithms for the Construction and Analysis of Systems, TACAS'08/ETAPS'08, pages 337--340, Berlin, Heidelberg, 2008. Springer-Verlag.
[11]
Robert Bruce Findler and Matthias Felleisen. Contracts for higher-order functions. In Proceedings of the seventh ACM SIGPLAN International Conference on Functional programming, ICFP'02, pages 48--59, New York, NY, USA, 2002. ACM.
[12]
Ralf Hinze, Johan Jeuring, and Andres Löh. Typed contracts for functional programming. In Proceedings of the 8th International Conference on Functional and Logic Programming, FLOPS'06, pages 208--225, Berlin, Heidelberg, 2006. Springer-Verlag.
[13]
Krystof Hoder, Laura Kovacs, and Andrei Voronkov. Interpolation and symbol elimination in Vampire. In Proceedings of the 5th International Conference on Automated Reasoning, IJCAR'10, pages 188--195, Berlin, Heidelberg, 2010. Springer-Verlag.
[14]
Brian Huffman. Formal verification of monad transformers. In Proceedings of the 17th ACM SIGPLAN International Conference on Functional Programming, ICFP'12, pages 15--16, New York, NY, USA, 2012. ACM.
[15]
Kenneth Knowles and Cormac Flanagan. Hybrid type checking. ACM Trans. Program. Lang. Syst., 32(2):6:1--6:34, February 2010. ISSN 0164-0925.
[16]
Naoki Kobayashi. Types and higher-order recursion schemes for verification of higher-order programs. In Proceedings of the 36th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL'09, pages 416--428, New York, NY, USA, 2009a. ACM.
[17]
Naoki Kobayashi. Model-checking higher-order functions. In Proceedings of the 11th ACM SIGPLAN Conference on Principles and Practice of Declarative Programming, PPDP'09, pages 25--36, New York, NY, USA, 2009b. ACM.
[18]
K. Rustan M. Leino. Automating induction with an SMT solver. In Proceedings of the 13th International Conference on Verification, Model Checking, and Abstract Interpretation, VMCAI'12, pages 315--331, Berlin, Heidelberg, 2012. Springer-Verlag.
[19]
Neil Mitchell and Colin Runciman. Not all patterns, but enough: an automatic verifier for partial but sufficient pattern matching. In Proceedings of the 1st ACM SIGPLAN Symposium on Haskell, Haskell'08, pages 49--60, New York, NY, USA, 2008. ACM.
[20]
Ulf Norell. Towards a practical programming language based on dependent type theory. PhD thesis, Chalmers University of Technology, 2007.
[21]
Andrew M. Pitts. Relational properties of domains. Inf. Comput., 127(2): 66--90, 1996.
[22]
Patrick M. Rondon, Ming Kawaguci, and Ranjit Jhala. Liquid types. In Proceedings of the 2008 ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI'08, pages 159--169, New York, NY, USA, 2008. ACM.
[23]
Yann Rgis-Gianas and Franois Pottier. A Hoare logic for call-by-value functional programs. In Proceedings of the Ninth International Conference on Mathematics of Program Construction (MPC'08), pages 305--335, July 2008.
[24]
Jeremy G. Siek and Walid Taha. Gradual typing for functional languages. In IN SCHEME AND FUNCTIONAL PROGRAMMING WORKSHOP, pages 81--92, 2006.
[25]
William Sonnex, Sophia Drossopoulou, and Susan Eisenbach. Zeno: an automated prover for properties of recursive data structures. In Proceedings of the 18th International Conference on Tools and Algorithms for the Construction and Analysis of Systems, TACAS'12, pages 407--421, Berlin, Heidelberg, 2012. Springer-Verlag.
[26]
Martin Sulzmann, Manuel M. T. Chakravarty, Simon Peyton Jones, and Kevin Donnelly. System F with type equality coercions. In Proceedings of the 2007 ACM SIGPLAN International Workshop on Types in Languages Design and Implementation, TLDI'07, pages 53--66, New York, NY, USA, 2007. ACM.
[27]
G. Sutcliffe. The TPTP Problem Library and Associated Infrastructure: The FOF and CNF Parts, v3.5.0. Journal of Automated Reasoning, 43 (4):337--362, 2009.
[28]
Philippe Suter, Ali Sinan Koksal, and Viktor Kuncak. Satisfiability modulo recursive programs. In Proceedings of the 18th International Conference on Static analysis, SAS'11, pages 298--315, Berlin, Heidelberg, 2011. Springer-Verlag.
[29]
Nikhil Swamy, Juan Chen, Cedric Fournet, Pierre-Yves Strub, Karthikeyan Bhargavan, and Jean Yang. Secure distributed programming with valuedependent types. In International Conference on Functional Programming, pages 266--278, 2011.
[30]
Sam Tobin-Hochstadt and David Van Horn. Higher-order symbolic execution via contracts. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA'12, 2012.
[31]
Philip Wadler and Robert Bruce Findler. Well-typed programs can't be blamed. In Proceedings of the 18th European Symposium on Programming Languages and Systems, ESOP'09, pages 1--16, Berlin, Heidelberg, 2009. Springer-Verlag.
[32]
Glynn Winskel. The formal semantics of programming languages -- an introduction. Foundation of computing series. MIT Press, 1993.
[33]
Hongwei Xi. Dependent ML: an approach to practical programming with dependent types. J. Funct. Program., 17(2):215--286, March 2007. ISSN 0956-7968.
[34]
Dana N. Xu. Hybrid contract checking via symbolic simplification. In Proceedings of the ACM SIGPLAN 2012 Workshop on Partial Evaluation and Program Manipulation, PEPM'12, pages 107--116, New York, NY, USA, 2012. ACM.
[35]
Dana N. Xu, Simon Peyton Jones, and Koen Claessen. Static contract checking for Haskell. In Proceedings of the 36th annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL'09, pages 41--52, New York, NY, USA, 2009. ACM.

Cited By

View all
  • (2022)Coinduction inductively: mechanizing coinductive proofs in Liquid HaskellProceedings of the 15th ACM SIGPLAN International Haskell Symposium10.1145/3546189.3549922(1-12)Online publication date: 6-Sep-2022
  • (2022)Liquid proof macrosProceedings of the 15th ACM SIGPLAN International Haskell Symposium10.1145/3546189.3549921(27-38)Online publication date: 6-Sep-2022
  • (2021)Intensional datatype refinement: with application to scalable verification of pattern-match safetyProceedings of the ACM on Programming Languages10.1145/34343365:POPL(1-29)Online publication date: 4-Jan-2021
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
POPL '13: Proceedings of the 40th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
January 2013
586 pages
ISBN:9781450318327
DOI:10.1145/2429069
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 48, Issue 1
    POPL '13
    January 2013
    561 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/2480359
    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]

Sponsors

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 23 January 2013

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. first-order logic
  2. static contract checking

Qualifiers

  • Research-article

Conference

POPL '13
Sponsor:

Acceptance Rates

Overall Acceptance Rate 860 of 4,328 submissions, 20%

Upcoming Conference

POPL '26

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

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

Other Metrics

Citations

Cited By

View all
  • (2022)Coinduction inductively: mechanizing coinductive proofs in Liquid HaskellProceedings of the 15th ACM SIGPLAN International Haskell Symposium10.1145/3546189.3549922(1-12)Online publication date: 6-Sep-2022
  • (2022)Liquid proof macrosProceedings of the 15th ACM SIGPLAN International Haskell Symposium10.1145/3546189.3549921(27-38)Online publication date: 6-Sep-2022
  • (2021)Intensional datatype refinement: with application to scalable verification of pattern-match safetyProceedings of the ACM on Programming Languages10.1145/34343365:POPL(1-29)Online publication date: 4-Jan-2021
  • (2021)Corpse reviver: sound and efficient gradual typing via contract verificationProceedings of the ACM on Programming Languages10.1145/34343345:POPL(1-28)Online publication date: 4-Jan-2021
  • (2021) Ready, Set , Verify! Applying hs-to-coq to real-world Haskell code Journal of Functional Programming10.1017/S095679682000028331Online publication date: 26-Feb-2021
  • (2020)Verifying replicated data types with typeclass refinements in Liquid HaskellProceedings of the ACM on Programming Languages10.1145/34282844:OOPSLA(1-30)Online publication date: 13-Nov-2020
  • (2019)EventActionACM Transactions on Interactive Intelligent Systems10.1145/33014029:4(1-31)Online publication date: 9-Aug-2019
  • (2019)Efficient automated repair of high floating-point errors in numerical librariesProceedings of the ACM on Programming Languages10.1145/32903693:POPL(1-29)Online publication date: 2-Jan-2019
  • (2019)Abstracting extensible data types: or, rows by any other nameProceedings of the ACM on Programming Languages10.1145/32903253:POPL(1-28)Online publication date: 2-Jan-2019
  • (2019)Polymorphic symmetric multiple dispatch with varianceProceedings of the ACM on Programming Languages10.1145/32903243:POPL(1-28)Online publication date: 2-Jan-2019
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media