Abstract
For a number of programming languages, among them Eiffel, C, Java and Ruby, Hoare-style logics and dynamic logics have been developed. In these logics, pre- and postconditions are typically formulated using potentially effectful programs. In order to ensure that these pre- and postconditions behave like logical formulae (that is, enjoy some kind of referential transparency), a notion of purity is needed. Here, we introduce a generic framework for reasoning about purity and effects. Effects are modeled abstractly and axiomatically, using Moggi’s idea of encapsulation of effects as monads. We introduce a dynamic logic (from which, as usual, a Hoare logic can be derived) whose logical formulae are pure programs in a strong sense. We formulate a set of proof rules for this logic, and prove it to be complete with respect to a categorical semantics. Using dynamic logic, we then develop a relaxed notion of purity which allows for observationally neutral effects such writing on newly allocated memory.
Chapter PDF
Similar content being viewed by others
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
Beckert, B.: A dynamic logic for the formal verification of Java Card programs. In: Attali, I., Jensen, T. (eds.) JavaCard 2000. LNCS, vol. 2041, pp. 6–24. Springer, Heidelberg (2001)
Boehm, H.-J.: Side effects and aliasing can have simple axiomatic descriptions. ACM Trans. Program. Lang. Syst 7, 637–655 (1985)
Bonniot, D., Keller, B.: The Nice user’s manual (2003), http://nice.sourceforge.net
Bright, W.: The D programming language. Dr. Dobb’s Journal of Software Tools 27(2), 36–40 (2002)
Cok, D.R., Kiniry, J.R.: ESC/Java2: Uniting ESC/Java and JML. In: Barthe, G., Burdy, L., Huisman, M., Lanet, J.-L., Muntean, T. (eds.) CASSIS 2004. LNCS, vol. 3362, pp. 108–128. Springer, Heidelberg (2005)
Findler, R.B., Felleisen, M.: Contracts for higher-order functions. In: ICFP, pp. 48–59 (2002)
Goncharov, S., Schröder, L., Mossakowski, T.: Completeness of global evaluation logic. In: Královič, R., Urzyczyn, P. (eds.) MFCS 2006. LNCS, vol. 4162, pp. 447–458. Springer, Heidelberg (2006)
Hoare,: An axiomatic basis for computer programming. CACM 12 (1969)
Huisman, M.: Java program verification in higher order logic with PVS and Isabelle. PhD thesis, University of Nijmegen (2001)
Jacobs, B., Poll, E.: Coalgebras and Monads in the Semantics of Java. Theoret. Comput. Sci. 291, 329–349 (2003)
Mac Lane, S.: Categories for the Working Mathematician. Springer, Heidelberg (1997)
Meyer, B.: Eiffel: The Language. Prentice-Hall, Englewood Cliffs (1992)
Moggi, E.: Notions of computation and monads. Inform. and Comput. 93, 55–92 (1991)
Moggi, E.: A semantics for evaluation logic. Fund. Inform. 22, 117–152 (1995)
Naumann, D.A.: Observational purity and encapsulation. Theoret. Comput. Sci 376, 205–224 (2007)
Nipkow, T.: Hoare logics in Isabelle/HOL. In: Schwichtenberg, H., Steinbrüggen, R. (eds.) Proof and System-Reliability, pp. 341–367. Kluwer Academic Publishers, Dordrecht (2002)
Omohundro, S.M.: The Sather language. Technical report, International Computer Science Institute, Berkeley (1991)
Peyton-Jones, S. (ed.): Haskell 98 Language and Libraries — The Revised Report, Cambridge (2003), also: J. Funct. Programming 13 (2003)
Pitts, A.: Evaluation logic. In: Higher Order Workshop, Workshops in Computing, pp. 162–189. Springer, Heidelberg (1991)
Pratt, V.: Semantical considerations on Floyd-Hoare logic. In: Foundations of Conputer Science, FOCS 1976, pp. 109–121. IEEE, Los Alamitos (1976)
Schröder, L., Mossakowski, T.: Monad-independent Hoare logic in HasCASL. In: Pezzè, M. (ed.) FASE 2003. LNCS, vol. 2621, pp. 261–277. Springer, Heidelberg (2003)
Schröder, L., Mossakowski, T.: Generic Exception Handling and the Java Monad. In: Rattray, C., Maharaj, S., Shankland, C. (eds.) AMAST 2004. LNCS, vol. 3116, pp. 443–459. Springer, Heidelberg (2004)
Schröder, L., Mossakowski, T.: Monad-independent dynamic logic in HASCASL. J. Logic Comput. 14, 571–619 (2004)
Sonntag, B., Colnet, D.: Lisaac: the power of simplicity at work for operating system. In: Technology of Object-Oriented Languages and Systems, TOOLS Pacific 2002. CRPIT, vol. 10, pp. 45–52. ACS (2002)
Stenzel, K.: A formally verified calculus for full Java Card. In: Rattray, C., Maharaj, S., Shankland, C. (eds.) AMAST 2004. LNCS, vol. 3116, pp. 491–505. Springer, Heidelberg (2004)
van den Berg, J., Jacobs, B.: The LOOP compiler for Java and JML. In: Margaria, T., Yi, W. (eds.) TACAS 2001. LNCS, vol. 2031, pp. 299–312. Springer, Heidelberg (2001)
von Oheimb, D.: Hoare logic for Java in Isabelle/HOL. Concurrency and Computation: Practice and Experience 13, 1173–1214 (2001)
Walter, D.: Monadic dynamic logic: Application and implementation. Master’s thesis, University of Bremen (2005), http://www.cs.chalmers.se/~denniswa
Walter, D., Schröder, L., Mossakowski, T.: Parametrized exceptions. In: Fiadeiro, J.L., Harman, N.A., Roggenbach, M., Rutten, J. (eds.) CALCO 2005. LNCS, vol. 3629, pp. 424–438. Springer, Heidelberg (2005)
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 2008 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Mossakowski, T., Schröder, L., Goncharov, S. (2008). A Generic Complete Dynamic Logic for Reasoning About Purity and Effects. In: Fiadeiro, J.L., Inverardi, P. (eds) Fundamental Approaches to Software Engineering. FASE 2008. Lecture Notes in Computer Science, vol 4961. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-78743-3_15
Download citation
DOI: https://doi.org/10.1007/978-3-540-78743-3_15
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-78742-6
Online ISBN: 978-3-540-78743-3
eBook Packages: Computer ScienceComputer Science (R0)