Skip to main content

Mechanizing Programming Logics in Higher Order Logic

  • Chapter

Abstract

Formal reasoning about computer programs can be based directly on the semantics of the programming language, or done in a special purpose logic like Hoare logic. The advantage of the first approach is that it guarantees that the formal reasoning applies to the language being used (it is well known, for example, that Hoare’s assignment axiom fails to hold for most programming languages). The advantage of the second approach is that the proofs can be more direct and natural.

In this paper, an attempt to get the advantages of both approaches is described. The rules of Hoare logic are mechanically derived from the semantics of a simple imperative programming language (using the HOL system). These rules form the basis for a simple program veri­fier in which verification conditions are generated by LCF-style tactics whose validations use the derived Hoare rules. Because Hoare logic is derived, rather than postulated, it is straightforward to mix semantic and axiomatic reasoning. It is also straightforward to combine the con­structs of Hoare logic with other application-specific notations. This is briefly illustrated for various logical constructs, including termina­tion statements, VDM-style ‘relational’ correctness specifications, weak­est precondition statements and dynamic logic formulae.

The theory underlying the work presented here is well known. Our contribution is to propose a way of mechanizing this theory in a way that makes certain practical details work out smoothly.

Keywords

  • Predicate Logic
  • Program Variable
  • Dynamic Logic
  • Verification Condition
  • High Order Logic

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.

This is a preview of subscription content, access via your institution.

Buying options

Chapter
GBP   19.95
Price includes VAT (United Kingdom)
  • DOI: 10.1007/978-1-4612-3658-0_10
  • Chapter length: 53 pages
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
eBook
GBP   73.50
Price includes VAT (United Kingdom)
  • ISBN: 978-1-4612-3658-0
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
Softcover Book
GBP   92.00
Price includes VAT (United Kingdom)

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  • Andrews, P.B.,An Introduction to Mathematical Logic and Type Theory, Academic Press, 1986.

    MATH  Google Scholar 

  • Boyer, R.S. and Moore, J S., AComputational Logic, Academic Press, 1979.

    MATH  Google Scholar 

  • Boyer, R.S., and Moore, J S., ’Metafunctions: proving them correct and using them efficiently as new proof procedures’ in Boyer, R.S. and Moore, J S. (eds),The Correctness Problem in ComputerScience, Academic Press, New York, 1981.

    Google Scholar 

  • Clarke, E.M. Jr., ’The characterization problem for Hoare logics’, in Hoare, C.A.R. and Shepherdson, J.C. (eds),Mathematical Logic and Programming Languages, Prentice Hall, 1985.

    Google Scholar 

  • A. Church, ’A Formulation of the Simple Theory of Types’, Journal of Symbolic Logic 5, 1940.

    Google Scholar 

  • Dijkstra, E.W., ADiscipline of Programming, Prentice-Hall, 1976.

    MATH  Google Scholar 

  • Floyd, R.W., ’Assigning meanings to programs’, in Schwartz, J.T. (ed.),Mathematical Aspects of Computer Science, Proceedings of Symposia in Applied Mathematics 19(American Mathematical Society), Providence, pp. 19 - 32, 1967.

    Google Scholar 

  • Good, D.I., ’Mechanical proofs about computer programs’, in Hoare, C.A.R. and Shepherdson, J.C. (eds),Mathematical Logic and Programming Languages, Prentice Hall, 1985.

    Google Scholar 

  • Goldblatt, R.,Logics of Time and Computation, CSLI Lecture Notes 7, CSLI/Stanford, Ventura Hall, Stanford, CA 94305, USA, 1987.

    Google Scholar 

  • Gordon, M.J.C., ’Representing a logic in the LCF metalanguage’, in Neel, D. (ed.),Tools and Notions for Program Construction, Cambridge University Press, 1982.

    Google Scholar 

  • Gordon, M.J.C., Milner, A.J.R.G. and Wadsworth, C.P.,Edinburgh LCF: a mechanized logic of computation, Springer Lecture Notes in Computer Science78, Springer-Verlag, 1979.

    Google Scholar 

  • M. Gordon, ’Why Higher-order Logic is a Good Formalism for Specifying and Verifying Hardware’, in G. Milne and P. A. Subrahmanyam (eds),Formal Aspects of VLSI Design, North-Holland, 1986.

    Google Scholar 

  • Gordon, M.J.C., ’HOL: A Proof Generating System for Higher-Order Logic’, University of Cambridge, Computer Laboratory, Tech. Report No. 103, 1987; Revised version in G. Birtwistle and P.A. Subrahmanyam (eds),VLSI Specification, Verification and Synthesis, Kluwer, 1987.

    Google Scholar 

  • Gordon, M.J.C.,Programming Language Theory and its Implementation, Prentice-Hall, 1988.

    Google Scholar 

  • Gries, D.,The Science of Programming, Springer-Verlag, 1981.

    MATH  Google Scholar 

  • Hoare, C.A.R., ’An axiomatic basis for computer programming’,Communications of the ACM 12, pp. 576 - 583, October 1969.

    MATH  CrossRef  Google Scholar 

  • Igarashi, S., London, R.L., Luckham, D.C., ’Automatic program verification I: logical basis and its implementation’, Acta Informatica 4, 1975, pp. 145 - 182.

    MathSciNet  CrossRef  Google Scholar 

  • INMOS Limited, ’Occam Programming Language’, Prentice-Hall.

    Google Scholar 

  • Jones, C.B., ’Systematic Program Development’ in Gehani, N. & McGettrick, A.D. (eds),Software Specification Techniques, Addison-Wesley, 1986.

    Google Scholar 

  • Joyce, J. J., Forthcoming Ph.D. thesis, University of Cambridge Computer Laboratory, expected 1989.

    Google Scholar 

  • Ligler, G.T., ’A mathematical approach to language design’, inProceedings of the Second ACM Symposium on Principles of Programming Languages pp. 41-53.

    Google Scholar 

  • Loeckx, J. and Sieber, K.,The Foundations of Program Verification, John Wiley & Sons Ltd. and B.G. Teubner, Stuttgart, 1984.

    Google Scholar 

  • London, R.L., et al. ’Proof rules for the programming language Euclid’, ActaInformatica 10, No. 1, 1978.

    Google Scholar 

  • Fourman, M.P., ’The Logic of Topoi’, in Barwise, J. (ed.),Handbook of Mathematical Logic, North-Holland, 1977.

    Google Scholar 

  • Melham. T.F., ’Automating Recursive Type Definitions in Higher Order Logic’, Proceedings of the1988 Banff Conference on Hardware Verification this volume.

    Google Scholar 

  • Mosses, P.D., ’Compiler Generation using Denotational Semantics’, inMathematical Foundations of Computer Science, Lecture Notes in Computer Science 45, Springer-Verlag, 1976.

    Google Scholar 

  • Milner, A.R.J.G., ’A Theory of Type Polymorphism in Programming’,Journal of Computer and System Sciences17, 1978.

    Google Scholar 

  • Paulson, L.C., ’A higher-order implementation of rewriting’,Science of Computer Programming3, pp 143 - 170, 1985.

    MathSciNet  CrossRef  Google Scholar 

  • Paulson, L.C., ’Natural deduction as higher-order resolution’,Journal of Logic Programming3, pp 237 - 258, 1986.

    MathSciNet  MATH  CrossRef  Google Scholar 

  • Paulson, L.C.,Logic and Computation: Interactive Proof with Cambridge LCF, Cambridge University Press, 1987.

    Google Scholar 

  • Plotkin, G.D., ’Dijkstra’s Predicate Transformers and Smyth’s Powerdomains’, in Bj0rner, D. (ed.),Abstract Software Specifications, Lecture Notes in Computer Science86, Springer-Verlag, 1986.

    Google Scholar 

  • Pratt, V.R., ’Semantical Considerations on Floyd-Hoare Logic’,Proceedings of the 17th IEEE Symposium on Foundations of Computer Science, 1976.

    Google Scholar 

  • Hayes, I. (ed.),Specification Case Studies, Prentice-Hall.

    Google Scholar 

Download references

Author information

Affiliations

Authors

Rights and permissions

Reprints and Permissions

Copyright information

© 1989 Springer-Verlag New York Inc.

About this chapter

Cite this chapter

Gordon, M.J.C. (1989). Mechanizing Programming Logics in Higher Order Logic. In: Birtwistle, G., Subrahmanyam, P.A. (eds) Current Trends in Hardware Verification and Automated Theorem Proving. Springer, New York, NY. https://doi.org/10.1007/978-1-4612-3658-0_10

Download citation

  • DOI: https://doi.org/10.1007/978-1-4612-3658-0_10

  • Publisher Name: Springer, New York, NY

  • Print ISBN: 978-1-4612-8195-5

  • Online ISBN: 978-1-4612-3658-0

  • eBook Packages: Springer Book Archive