Abstract
Dijkstra monads enable a dependent type theory to be enhanced with support for specifying and verifying effectful code via weakest preconditions. Together with their closely related counterparts, Hoare monads, they provide the basis on which verification tools like F*, Hoare Type Theory (HTT), and Ynot are built. We show that Dijkstra monads can be derived "for free" by applying a continuation-passing style (CPS) translation to the standard monadic definitions of the underlying computational effects. Automatically deriving Dijkstra monads in this way provides a correct-by-construction and efficient way of reasoning about user-defined effects in dependent type theories. We demonstrate these ideas in EMF*, a new dependently typed calculus, validating it via both formal proof and a prototype implementation within F*. Besides equipping F* with a more uniform and extensible effect system, EMF* enables a novel mixture of intrinsic and extrinsic proofs within F*.
- D. Ahman and T. Uustalu. Update monads: Cointerpreting directed containers. TYPES, 2013.Google Scholar
- D. Ahman, N. Ghani, and G. D. Plotkin. Dependent types and fibred computational effects. FOSSACS, 2016.Google Scholar
Cross Ref
- R. Atkey. Parameterised notions of computation. Journal of Functional Programming, 19:335–376, 2009. Google Scholar
Digital Library
- P. Audebaud and E. Zucca. Deriving proof rules from continuation semantics. Formal Asp. Comput., 11(4):426–447, 1999.Google Scholar
Digital Library
- G. Barthe and T. Uustalu. CPS translating inductive and coinductive types. PEPM. 2002. Google Scholar
Digital Library
- G. Barthe, C. Fournet, B. Grégoire, P.-Y. Strub, N. Swamy, and S. Zanella-Béguelin. Probabilistic relational verification for cryptographic implementations. POPL. 2014. Google Scholar
Digital Library
- N. Benton. Simple relational correctness proofs for static analyses and program transformations. POPL. 2004. Google Scholar
Digital Library
- N. Benton and A. Kennedy. Exceptional syntax. J. Funct. Program., 11(4): 395–410, 2001. Google Scholar
Digital Library
- N. Benton, J. Hughes, and E. Moggi. Monads and effects. APPSEM. 2000. Google Scholar
Digital Library
- E. Brady. Programming and reasoning with algebraic effects and dependent types. ICFP, 2013. Google Scholar
Digital Library
- E. Brady. Resource-dependent algebraic effects. TFP, 2014.Google Scholar
- C. Casinghino, V. Sjöberg, and S. Weirich. Combining proofs and programs in a dependently typed language. POPL, 2014. Google Scholar
Digital Library
- A. Charguéraud. Characteristic formulae for the verification of imperative programs. ICFP. 2011.Google Scholar
- A. Chlipala, G. Malecha, G. Morrisett, A. Shinnar, and R. Wisnesky. Effective interactive proofs for higher-order imperative programs. ICFP, 2009. Google Scholar
Digital Library
- T. Coquand and G. Huet. The calculus of constructions. Information and Computation, 76(2):95 – 120, 1988. Google Scholar
Digital Library
- L. M. de Moura and N. Bjørner. Z3: an efficient SMT solver. TACAS. 2008. Google Scholar
Digital Library
- E. W. Dijkstra. Guarded commands, nondeterminacy and formal derivation of programs. Commun. ACM, 18(8):453–457, 1975. Google Scholar
Digital Library
- E. W. Dijkstra. A Discipline of Programming. Prentice Hall PTR, Upper Saddle River, NJ, USA, 1st edition, 1997. Google Scholar
Digital Library
- A. Filinski. Representing monads. POPL. 1994. Google Scholar
Digital Library
- A. Filinski. Representing layered monads. POPL. 1999. Google Scholar
Digital Library
- A. Filinski. Monads in action. POPL. 2010. Google Scholar
Digital Library
- J.-C. Filliˆatre and A. Paskevich. Why3 — where programs meet provers. ESOP. 2013.Google Scholar
- C. Flanagan, A. Sabry, B. F. Duba, and M. Felleisen. The essence of compiling with continuations. PLDI, 1993. Google Scholar
Digital Library
- B. Jacobs. Dijkstra and Hoare monads in monadic computation. Theor. Comput. Sci., 604:30–45, 2015. Google Scholar
Digital Library
- K. Jensen. Connection between Dijkstra’s predicate-transformers and denotational continuation-semantics. DAIMI Report Series 7.86, 1978.Google Scholar
- K. Keimel. Healthiness conditions for predicate transformers. Electr. Notes Theor. Comput. Sci., 319:255–270, 2015. Google Scholar
Digital Library
- K. Keimel and G. Plotkin. Mixed powerdomains for probability and nondeterminism. submitted to LMCS, 2016.Google Scholar
- K. R. M. Leino. Dafny: An automatic program verifier for functional correctness. LPAR. 2010. Google Scholar
Digital Library
- E. Moggi. Computational lambda-calculus and monads. LICS. 1989. Google Scholar
Digital Library
- A. Nanevski, J. G. Morrisett, and L. Birkedal. Hoare type theory, polymorphism and separation. JFP, 18(5-6):865–911, 2008. Google Scholar
Digital Library
- A. Nogin. Quotient types: A modular approach. TPHOLs. 2002. Google Scholar
Digital Library
- C. Paulin-Mohring. Introduction to the Calculus of Inductive Constructions. In B. W. Paleo and D. Delahaye, editors, All about Proofs, Proofs for All, volume 55 of Studies in Logic (Mathematical logic and foundations). College Publications, 2015.Google Scholar
- G. D. Plotkin and M. Pretnar. Handlers of algebraic effects. ESOP. 2009. Google Scholar
Digital Library
- A. Sabelfeld and A. C. Myers. Language-based information-flow security. IEEE J.Sel. A. Commun., 21(1):5–19, 2006. Google Scholar
Digital Library
- D. Stefan, A. Russo, J. C. Mitchell, and D. Mazières. Flexible dynamic information flow control in haskell. SIGPLAN Not., 46(12):95–106, 2011. Google Scholar
Digital Library
- N. Swamy, N. Guts, D. Leijen, and M. Hicks. Lightweight monadic programming in ML. ICFP, 2011. Google Scholar
Digital Library
- N. Swamy, J. Weinberger, C. Schlesinger, J. Chen, and B. Livshits. Verifying higher-order programs with the Dijkstra monad. PLDI, 2013. Google Scholar
Digital Library
- N. Swamy, C. Hrit¸cu, C. Keller, A. Rastogi, A. Delignat-Lavaud, S. Forest, K. Bhargavan, C. Fournet, P.-Y. Strub, M. Kohlweiss, J.-K. Zinzindohoué, and S. Zanella-Béguelin. Dependent types and multi-monadic effects in F*. POPL. 2016. Google Scholar
Digital Library
- P. Wadler. Comprehending monads. In Proceedings of the 1990 ACM Conference on LISP and Functional Programming. 1990. Google Scholar
Digital Library
- P. Wadler. The essence of functional programming. POPL. 1992. Google Scholar
Digital Library
- P. Wadler. Monads and composable continuations. Lisp Symb. Comput., 7 (1):39–56, 1994. Google Scholar
Digital Library
Index Terms
Dijkstra monads for free
Recommendations
Dijkstra monads for free
POPL '17: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming LanguagesDijkstra monads enable a dependent type theory to be enhanced with support for specifying and verifying effectful code via weakest preconditions. Together with their closely related counterparts, Hoare monads, they provide the basis on which ...
Dijkstra monads for all
This paper proposes a general semantic framework for verifying programs with arbitrary monadic side-effects using Dijkstra monads, which we define as monad-like structures indexed by a specification monad. We prove that any monad morphism between a ...
Dependent types and multi-monadic effects in F*
POPL '16: Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming LanguagesWe present a new, completely redesigned, version of F*, a language that works both as a proof assistant as well as a general-purpose, verification-oriented, effectful programming language. In support of these complementary roles, F* is a dependently ...







Comments