skip to main content
research-article

Dijkstra and Hoare monads in monadic computation

Published: 02 November 2015 Publication History

Abstract

The Dijkstra and Hoare monads have been introduced recently for capturing weakest precondition computations and computations with pre- and post-conditions, within the context of program verification, supported by a theorem prover. Here we give a more general description of such monads in a categorical setting. We first elaborate the recently developed view on program semantics in terms of a triangle of computations, state transformers, and predicate transformers. Instantiating this triangle for different computational monads T shows how to define the Dijkstra monad associated with T, via the logic involved.Subsequently we give abstract definitions of the Dijkstra and Hoare monad, parametrised by a computational monad. These definitions presuppose a suitable (categorical) predicate logic, defined on the Kleisli category of the underlying monad. When all this structure exists, we show that there are maps of monads (Hoare) (State) (Dijkstra), all parametrised by a monad T.

References

[1]
S. Abramsky, Domain theory in logical form, Ann. Pure Appl. Logic, 51 (1991) 1-77.
[2]
S. Awodey, Category Theory, Oxford Univ. Press, 2006.
[3]
G. Barthe, B. Grégoire, S. Zanella Béguelin, Formal certification of code-based cryptographic proofs, in: Principles of Programming Languages, ACM Press, 2009, pp. 90-101.
[4]
E. D'Hondt, P. Panangaden, Quantum weakest preconditions, Math. Structures Comput. Sci., 16 (2006) 429-451.
[5]
E. Dijkstra, C. Scholten, Predicate Calculus and Program Semantics, Springer, Berlin, 1990.
[6]
A. Dvurečenskij, S. Pulmannová, New Trends in Quantum Structures, Kluwer Acad. Publ., Dordrecht, 2000.
[7]
D.J. Foulis, M.K. Bennett, Effect algebras and unsharp quantum logics, Found. Phys., 24 (1994) 1331-1352.
[8]
R. Furber, B. Jacobs, From Kleisli categories to commutative C * -algebras: probabilistic Gelfand duality, in: Lect. Notes Comp. Sci., vol. 8089, Springer, Berlin, 2013, pp. 141-157.
[9]
T. Heinosaari, M. Ziman, The Mathematical Language of Quantum Theory. From Uncertainty to Entanglement, Cambridge Univ. Press, 2012.
[10]
B. Jacobs, Semantics of weakening and contraction, Ann. Pure Appl. Logic, 69 (1994) 73-106.
[11]
B. Jacobs, Categorical Logic and Type Theory, North Holland, Amsterdam, 1999.
[12]
B. Jacobs, Convexity, duality, and effects, in: IFIP Adv. Inf. Commun. Technol., vol. 82(1), Springer, Boston, 2010, pp. 1-19.
[13]
B. Jacobs, Introduction to Coalgebra, in: Towards Mathematics of States and Observations, 2012.
[14]
B. Jacobs, New directions in categorical logic, for classical, probabilistic and quantum logic. arXiv:1205.3940
[15]
B. Jacobs, Measurable spaces and their effect logic, in: IEEE Symposium on Logic in Computer Science, Computer Science Press, 2013.
[16]
B. Jacobs, Dijkstra monads in monadic computation, in: Lect. Notes Comput. Sci., vol. 8446, Springer, Berlin, 2014, pp. 135-150.
[17]
B. Jacobs, Introduction to Coalgebra. Towards Mathematics of States and Observations, 2014.
[18]
B. Jacobs, J. Mandemaker, Coreflections in algebraic quantum logic, Found. Phys., 42 (2012) 932-958.
[19]
B. Jacobs, J. Mandemaker, The expectation monad in quantum foundations, in: Elect. Proc. in Theor. Comput. Sci., vol. 95, 2012, pp. 143-182.
[20]
P. Johnstone, S. Vickers, Preframe presentations present, in: Lect. Notes Math., vol. 1488, Springer, Berlin, 1991, pp. 193-212.
[21]
G. Leavens, A. Baker, C. Ruby, JML: a notation for detailed design, in: Behavioral Specifications of Business and Systems, Kluwer, 1999, pp. 175-188.
[22]
S. Liang, P. Hudak, M. Jones, Monad transformers and modular interpreters, in: Principles of Programming Languages, ACM Press, 1995, pp. 333-343.
[23]
E. Manes, A triple-theoretic construction of compact algebras, in: Lect. Notes Math., vol. 80, Springer, Berlin, 1969, pp. 91-118.
[24]
Y. Maruyama, Categorical duality theory: with applications to domains, convexity, and the distribution monad, in: Leibniz Int. Proc. in Informatics, 2013, pp. 500-520.
[25]
S. Mac Lane, Categories for the Working Mathematician, Springer, Berlin, 1971.
[26]
E. Moggi, Notions of computation and monads, Inform. and Comput., 93 (1991) 55-92.
[27]
A. Nanevski, G. Morrisett, A. Shinnar, P. Govereau, L. Birkedal, Ynot: dependent types for imperative programs, in: International Conference on Functional Programming, ACM SIGPLAN Notices, 2008, pp. 229-240.
[28]
S. Pulmannov�, S. Gudder, Representation theorem for convex effect algebras, Comment. Math. Univ. Carolin., 39 (1998) 645-659.
[29]
M. Stone, Postulates for the barycentric calculus, Ann. Math., 29 (1949) 25-30.
[30]
N. Swamy, J. Weinberger, C. Schlesinger, J. Chen, B. Livshits, Verifying higher-order programs with the Dijkstra monad, in: Proc. of the 34th ACM SIGPLAN Conf. on Programming Language Design and Implementation, ACM, 2013, pp. 387-398.
[31]
W. Swierstra, A Hoare logic for the state monad, in: Lect. Notes Comput. Sci., vol. 5674, Springer, Berlin, 2009, pp. 440-451.

Cited By

View all
  • (2024)Verifying Programs with Logic and Extended Proof Rules: Deep Embedding vs. Shallow EmbeddingJournal of Automated Reasoning10.1007/s10817-024-09706-568:3Online publication date: 10-Aug-2024
  • (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
  • Show More Cited By

Index Terms

  1. Dijkstra and Hoare monads in monadic computation

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image Theoretical Computer Science
    Theoretical Computer Science  Volume 604, Issue C
    November 2015
    133 pages

    Publisher

    Elsevier Science Publishers Ltd.

    United Kingdom

    Publication History

    Published: 02 November 2015

    Author Tags

    1. Hoare logic
    2. Monad
    3. Program semantics
    4. Weakest precondition

    Qualifiers

    • Research-article

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)0
    • Downloads (Last 6 weeks)0
    Reflects downloads up to 22 Oct 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (2024)Verifying Programs with Logic and Extended Proof Rules: Deep Embedding vs. Shallow EmbeddingJournal of Automated Reasoning10.1007/s10817-024-09706-568:3Online publication date: 10-Aug-2024
    • (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)Dijkstra monads for freeACM SIGPLAN Notices10.1145/3093333.300987852:1(515-529)Online publication date: 1-Jan-2017
    • (2017)Dijkstra monads for freeProceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages10.1145/3009837.3009878(515-529)Online publication date: 1-Jan-2017
    • (2017)Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming LanguagesundefinedOnline publication date: 1-Jan-2017
    • (2016)Healthiness from DualityProceedings of the 31st Annual ACM/IEEE Symposium on Logic in Computer Science10.1145/2933575.2935319(682-691)Online publication date: 5-Jul-2016

    View Options

    View options

    Get Access

    Login options

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media