Representing WP Semantics in Isabelle/ZF

  • Mark Staples
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1690)


We present a shallow embedding of the weakest precondition semantics for a program refinement language. We use the Isabelle/ZF theorem prover for untyped set theory, and statements in our refinement language are represented as set transformers. Our representation is significant in making use of the expressiveness of Isabelle/ZF’s set theory to represent states as dependently-typed functions from variable names to their values. This lets us give a uniform treatment of statements such as variable assignment, framed specification statements, local blocks, and parameterisation. ZF set theory requires set comprehensions to be explicitly bounded. This requirement propagates to the definitions of statements in our refinement language, which have operands for the state type. We reduce the syntactic burden of repeatedly writing the state type by using Isabelle’s meta-logic to define a lifted set transformer language which implicitly passes the state type to statements.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    J. R. Abrial. The B Book: Assigning Programs to Meanings. Cambridge University Press, 1996.Google Scholar
  2. [2]
    S. Agerholm. Mechanizing program verification in HOL. Master’s thesis, Computer Science Department, Aarhus University, April 1992.Google Scholar
  3. [3]
    R. J. R. Back. On the correctness of refinement steps in program development. Technical Report A-1978-4, 0Abo Akademi University, 1978.Google Scholar
  4. [4]
    R. J. R. Back. A calculus of refinements for program derivations. Acta Informatica, 25:593–624, 1988.MathSciNetCrossRefzbMATHGoogle Scholar
  5. [5]
    R. J. R. Back and J. von Wright. Refinement calculus, part I: Sequential nondeterministic programs. In J. W. de Bakker, W. P. de Roever, and G. Rozenberg, editors, Stepwise Refinement of Distributed Systems, volume 430 of LNCS, pages 42–66. Springer-Verlag, 1989.Google Scholar
  6. [6]
    R. J. R. Back and J. von Wright. Refinement concepts formalized in higher order logic. Formal Aspects of Computing, 2(3):247–272, 1990.CrossRefzbMATHGoogle Scholar
  7. [7]
    Richard Boulton, Andrew Gordon, Mike Gordon, John Harrison, and John Herbert. Experience with embedding hardware description languages. In Proceedings of the IFIP TC10/WG 10.2 International Conference on Theorem Provers in Circuit Design: Theory, Practice and Experience, volume A10 of IFIP Transactions, pages 129–156. North-Holland/Elsevier, June 1992.Google Scholar
  8. [8]
    D. Carrington, I. Hayes, R. Nickson, G. Watson, and J. Welsh. Refinement in Ergo. Technical Report 94-44, Software Verification Research Centre, The University of Queensland, July 1995.Google Scholar
  9. [9]
    E. W. Dijkstra. A Discipline of Programming Prentice Hall, 1976.Google Scholar
  10. [10]
    M. Gordon, R. Milner, and C. Wadsworth. Edinburgh LCF: A Mechanised Logic of Computation, volume 78 of LNCS. Springer-Verlag, 1979.Google Scholar
  11. [11]
    M. J. C. Gordon and T. F. Melham, editors. Introduction to HOL: A theorem proving environment for higher order logic. Cambridge University Press, 1993.Google Scholar
  12. [12]
    Thomas Kleymann. Hoare Logic and VDM: Machine-Checked Soundness and Completeness Proofs. PhD thesis, Laboratory for Foundations of Computer Science, The University of Edinburgh, September 1998.Google Scholar
  13. [13]
    J. Knappmann. A PVS based tool for developing programs in the refinement calculus. Master’s thesis, Christian-Albrechts-University of Kiel, October 1996.Google Scholar
  14. [14]
    R. Milner, M. Tofte, and R. Harper. The Definition of Standard ML. The MIT Press, 1990.Google Scholar
  15. [15]
    Carroll Morgan. Procedures, parameters, and abstraction: Separate concerns. Science of Computer Programming, 11(1):17–28, 1988.MathSciNetCrossRefzbMATHGoogle Scholar
  16. [16]
    Carroll Morgan. The specification statement. ACM Transactions on Programming Languages and Systems, 10(3):403–419, July 1988.CrossRefzbMATHGoogle Scholar
  17. [17]
    Carroll Morgan. Programming from Specifications. Prentice-Hall International, 2nd edition, 1994.Google Scholar
  18. [18]
    J. M. Morris. A theoretical basis for stepwise refinement and the programming calculus. Science of Computer Programming, 9(3):287–306, December 1987.MathSciNetCrossRefzbMATHGoogle Scholar
  19. [19]
    R. G. Nickson and L. J. Groves. Metavariables and conditional refinements in the refinement calculus. Technical Report 93-12, Software Verification Research Centre, The University of Queensland, 1993.Google Scholar
  20. [20]
    L. C. Paulson. Isabelle: A Generic Theorem Prover, volume 828 of LNCS. Springer-Verlag, 1994.CrossRefzbMATHGoogle Scholar
  21. [21]
    H. Pfeifer, A. Dold, F. W. von Henke, and H. Rueff. Mechanised semantics of simple imperative programming constructs. Technical Report UIB-96-11, Universität Ulm, December 1996.Google Scholar
  22. [22]
    Chris H. Pratten. Refinement in a Language with Procedures and Modules. PhD thesis, Department of Engineering and Computer Science, University of Southampton, June 1996.Google Scholar
  23. [23]
    Mark Staples. Window inference in Isabelle. In L. Paulson, editor, Proceedings of the First Isabelle User’s Workshop, volume 379, pages 191–205. University of Cambridge Computer Laboratory Technical Report, September 1995.Google Scholar
  24. [24]
    Mark Staples. A Mechanised Theory of Refinement. PhD thesis, Computer Laboratory, University of Cambridge, November 1998. Submitted.Google Scholar
  25. [25]
    M. Utting and K. Whitwell. Ergo user manual. Technical Report 93-19, Software Verification Research Centre, The University of Queensland, February 1994.Google Scholar
  26. [26]
    J. von Wright. The lattice of data refinement. Acta Informatica, 31, 1994.Google Scholar
  27. [27]
    J. von Wright. Verifying modular programs in HOL. Technical Report 324, University of Cambridge Computer Laboratory, January 1994.Google Scholar
  28. [28]
    J. von Wright. A Mechanised Calculus of Refinement in HOL, January 27, 1994.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1999

Authors and Affiliations

  • Mark Staples
    • 1
  1. 1.University of Cambridge Computer LaboratoryCambridgeUK

Personalised recommendations