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

Hoare-style reasoning with (algebraic) continuations

Published: 25 September 2013 Publication History

Abstract

Continuations are programming abstractions that allow for manipulating the "future" of a computation. Amongst their many applications, they enable implementing unstructured program flow through higher-order control operators such as callcc. In this paper we develop a Hoare-style logic for the verification of programs with higher-order control, in the presence of dynamic state. This is done by designing a dependent type theory with first class callcc and abort operators, where pre- and postconditions of programs are tracked through types. Our operators are algebraic in the sense of Plotkin and Power, and Jaskelioff, to reduce the annotation burden and enable verification by symbolic evaluation. We illustrate working with the logic by verifying a number of characteristic examples.

References

[1]
ACETO, L., AND INGOLFSDOTTIR, A. Characteristic formulae: From automata to logic. Bulletin of the EATCS 91 (2007).
[2]
ARBIB, M. A., AND ALAGIC, S. Proof rules for gotos. Acta Inf. 11 (1979).
[3]
BARRAS, B., AND BERNARDO, B. The implicit calculus of constructions as a programming language with dependent types. In FoSSaCS (2008).
[4]
BARTHE, G., AND UUSTALU, T. CPS translating inductive and coinductive types. In PEPM (2002).
[5]
BERGER, M. Program logics for sequential higher-order control. In FSEN (2009).
[6]
BERTOT, Y., AND CASTÉRAN, P. Interactive Theorem Proving and Program Development. Coq'Art: The Calculus of Inductive Constructions. 2004.
[7]
BJØRNER, D., AND JONES, C. B., Eds. The Vienna Development Method: The Meta-Language (1978), vol. 61 of LNCS.
[8]
CHARGUE RAUD, A. Characteristic Formulae for Mechanized Program Verification. PhD thesis, Universite Paris-Diderot, 2010.
[9]
CLINT, M., AND HOARE, C. A. R. Program proving: Jumps and functions. Acta Inf. 1 (1972).
[10]
CROLARD, T., AND POLONOWSKI, E. Deriving a Floyd-Hoare logic for non-local jumps from a formulæ-as-types notion of control. J. Log. Algebr. Program. 81, 3 (2012).
[11]
DANVY, O., AND FILINSKI, A. Representing control: A study of the CPS transformation. MSCS 2, 4 (1992).
[12]
DELBIANCO, G. A., AND NANEVSKI, A. Supporting material. http://software.imdea.org/~germand/HTTcc, March 2013.
[13]
DREYER, D., NEIS, G., AND BIRKEDAL, L. The impact of higherorder state and control effects on local relational reasoning. In ICFP (2010).
[14]
FELLEISEN, M., FRIEDMAN, D. P., DUBA, B., AND MERRILL, J. Beyond Continuations. Tech. Rep. 216, Indiana University, 1987.
[15]
FELLEISEN, M., FRIEDMAN, D. P., KOHLBECKER, E. E., AND DUBA, B. F. Reasoning with continuations. In LICS (1986).
[16]
FELLEISEN, M., WAND, M., FRIEDMAN, D., AND DUBA, B. Abstract continuations: a mathematical semantics for handling full jumps. In LISP and functional programming (1988).
[17]
FILINSKI, A. Representing monads. In POPL (1994).
[18]
FRIEDMAN, D. P., AND FELLEISEN, M. The Seasoned Schemer. 1996.
[19]
GONTHIER, G., MAHBOUBI, A., AND TASSI, E. A Small Scale Reflection Extension for the Coq system. Tech. Rep. 6455, INRIA, 2008.
[20]
GRIFFIN, T. A formulae-as-types notion of control. In POPL (1990).
[21]
HYLAND, M., LEVY, P. B., PLOTKIN, G. D., AND POWER, J. Combining algebraic effects with continuations. TCS 375, 1--3 (2007).
[22]
JASKELIOFF, M. Modular monad transformers. In ESOP (2009).
[23]
JENSEN, J. B., BENTON, N., AND KENNEDY, A. High-level separation logic for low-level code. In POPL (2013).
[24]
KLEYMANN, T. Hoare logic and auxiliary variables. Formal Aspects of Computing 11 (1999).
[25]
KOWALTOWSKI, T. Axiomatic approach to side effects and general jumps. Acta Inf. 7 (1977).
[26]
KRISHNASWAMI, N. R. Verifying Higher-Order Imperative Programs with Higher-Order Separation Logic. PhD thesis, Carnegie Mellon University, 2011.
[27]
THE COQ DEVELOPMENT TEAM. The Coq proof assistant reference manual. TypiCal Project, 2012. Version 8.4.
[28]
MOGGI, E. Computational lambda-calculus and monads. In LICS (1989).
[29]
NANEVSKI, A., MORRISETT, J. G., AND BIRKEDAL, L. Hoare type theory, polymorphism and separation. JFP 18, 5--6 (2008).
[30]
NANEVSKI, A., VAFEIADIS, V., AND BERDINE, J. Structuring the verification of heap-manipulating programs. In POPL (2010).
[31]
O'HEARN, P. W., REYNOLDS, J. C., AND YANG, H. Local reasoning about programs that alter data structures. In CSL (2001).
[32]
PARK, D. M. R. Concurrency and automata on infinite sequences. In Theoretical Computer Science (1981).
[33]
PLOTKIN, G. D., AND POWER, A. J. Computational effects and operations: An overview. ENTCS 73 (2004).
[34]
PLOTKIN, G. D., AND POWER, J. Algebraic operations and generic effects. Applied Categorical Structures 11, 1 (2003).
[35]
REPPY, J. H. Concurrent Programming in ML. Cambridge University Press, Cambridge, England, 1999.
[36]
REYNOLDS, J. C. The discoveries of continuations. LISP and Symbolic Computation 6, 3--4 (1993).
[37]
REYNOLDS, J. C. Separation logic: A logic for shared mutable data structures. In LICS (2002).
[38]
SAABAS, A., AND UUSTALU, T. A compositional natural semantics and Hoare logic for low-level languages. TCS 373, 3 (2007).
[39]
SCHWINGHAMMER, J., BIRKEDAL, L., REUS, B., AND YANG, H. Nested Hoare triples and frame rules for higher-order store. LMCS 7, 3 (2011).
[40]
SPRINGER, G., AND FRIEDMAN, D. P. Scheme and the Art of Programming. MIT Press and McGraw-Hill, 1989.
[41]
STØVRING, K., AND LASSEN, S. B. A complete, co-inductive syntactic theory of sequential control and state. In POPL (2007).
[42]
STRACHEY, C., AND WADSWORTH, C. P. Continuations: A mathematical semantics for handling full jumps. HOSC 13, 1/2 (2000).
[43]
SVENDSEN, K., BIRKEDAL, L., AND NANEVSKI, A. Partiality, state and dependent types. In TLCA (2011).
[44]
SWAMY, N., WEINBERGER, J., SCHLESINGER, C., CHEN, J., AND LIVSHITS, B. Verifying higher-order programs with the Dijkstra monad. In PLDI (2013).
[45]
SWIERSTRA, W. A hoare logic for the state monad. TPHOLs '09.
[46]
TAN, G., AND APPEL, A. W. A compositional logic for control flow. In VMCAI (2006).
[47]
THIELECKE, H. Categorical Structure of Continuation Passing Style. PhD thesis, University of Edimburgh, 1997.
[48]
THIELECKE, H. Control effects as a modality. JFP 19, 1 (2009).
[49]
WADLER, P. Monads and composable continuations. LISP and Symbolic Computation 7, 1 (1994).
[50]
YOSHIDA, N., HONDA, K., AND BERGER, M. Logical reasoning for higher-order functions with local state. LMCS 4, 4 (2008).

Cited By

View all
  • (2019)Mechanized relational verification of concurrent programs with continuationsProceedings of the ACM on Programming Languages10.1145/33417093:ICFP(1-28)Online publication date: 26-Jul-2019
  • (2024)Specification and Verification for Unrestricted Algebraic Effects and HandlingProceedings of the ACM on Programming Languages10.1145/36746568:ICFP(909-937)Online publication date: 15-Aug-2024
  • (2021)A separation logic for effect handlersProceedings of the ACM on Programming Languages10.1145/34343145:POPL(1-28)Online publication date: 4-Jan-2021
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM SIGPLAN Notices
ACM SIGPLAN Notices  Volume 48, Issue 9
ICFP '13
September 2013
457 pages
ISSN:0362-1340
EISSN:1558-1160
DOI:10.1145/2544174
Issue’s Table of Contents
  • cover image ACM Conferences
    ICFP '13: Proceedings of the 18th ACM SIGPLAN international conference on Functional programming
    September 2013
    484 pages
    ISBN:9781450323260
    DOI:10.1145/2500365
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].

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 25 September 2013
Published in SIGPLAN Volume 48, Issue 9

Check for updates

Author Tags

  1. callcc
  2. continuations
  3. dependent types
  4. hoare logic

Qualifiers

  • Research-article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)7
  • Downloads (Last 6 weeks)0
Reflects downloads up to 12 Sep 2024

Other Metrics

Citations

Cited By

View all
  • (2019)Mechanized relational verification of concurrent programs with continuationsProceedings of the ACM on Programming Languages10.1145/33417093:ICFP(1-28)Online publication date: 26-Jul-2019
  • (2024)Specification and Verification for Unrestricted Algebraic Effects and HandlingProceedings of the ACM on Programming Languages10.1145/36746568:ICFP(909-937)Online publication date: 15-Aug-2024
  • (2021)A separation logic for effect handlersProceedings of the ACM on Programming Languages10.1145/34343145:POPL(1-28)Online publication date: 4-Jan-2021
  • (2019)The next 700 relational program logicsProceedings of the ACM on Programming Languages10.1145/33710724:POPL(1-33)Online publication date: 20-Dec-2019
  • (2019)Dijkstra monads for allProceedings of the ACM on Programming Languages10.1145/33417083:ICFP(1-29)Online publication date: 26-Jul-2019
  • (2017)Equational Theories of Abnormal Termination Based on Kleene AlgebraProceedings of the 20th International Conference on Foundations of Software Science and Computation Structures - Volume 1020310.1007/978-3-662-54458-7_6(88-105)Online publication date: 22-Apr-2017

View Options

Get Access

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