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 verifier 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 constructs of Hoare logic with other application-specific notations. This is briefly illustrated for various logical constructs, including termination statements, VDM-style ‘relational’ correctness specifications, weakest 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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Andrews, P.B.,An Introduction to Mathematical Logic and Type Theory, Academic Press, 1986.
Boyer, R.S. and Moore, J S., AComputational Logic, Academic Press, 1979.
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.
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.
A. Church, ’A Formulation of the Simple Theory of Types’, Journal of Symbolic Logic 5, 1940.
Dijkstra, E.W., ADiscipline of Programming, Prentice-Hall, 1976.
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.
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.
Goldblatt, R.,Logics of Time and Computation, CSLI Lecture Notes 7, CSLI/Stanford, Ventura Hall, Stanford, CA 94305, USA, 1987.
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.
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.
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.
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.
Gordon, M.J.C.,Programming Language Theory and its Implementation, Prentice-Hall, 1988.
Gries, D.,The Science of Programming, Springer-Verlag, 1981.
Hoare, C.A.R., ’An axiomatic basis for computer programming’,Communications of the ACM 12, pp. 576 - 583, October 1969.
Igarashi, S., London, R.L., Luckham, D.C., ’Automatic program verification I: logical basis and its implementation’, Acta Informatica 4, 1975, pp. 145 - 182.
INMOS Limited, ’Occam Programming Language’, Prentice-Hall.
Jones, C.B., ’Systematic Program Development’ in Gehani, N. & McGettrick, A.D. (eds),Software Specification Techniques, Addison-Wesley, 1986.
Joyce, J. J., Forthcoming Ph.D. thesis, University of Cambridge Computer Laboratory, expected 1989.
Ligler, G.T., ’A mathematical approach to language design’, inProceedings of the Second ACM Symposium on Principles of Programming Languages pp. 41-53.
Loeckx, J. and Sieber, K.,The Foundations of Program Verification, John Wiley & Sons Ltd. and B.G. Teubner, Stuttgart, 1984.
London, R.L., et al. ’Proof rules for the programming language Euclid’, ActaInformatica 10, No. 1, 1978.
Fourman, M.P., ’The Logic of Topoi’, in Barwise, J. (ed.),Handbook of Mathematical Logic, North-Holland, 1977.
Melham. T.F., ’Automating Recursive Type Definitions in Higher Order Logic’, Proceedings of the1988 Banff Conference on Hardware Verification this volume.
Mosses, P.D., ’Compiler Generation using Denotational Semantics’, inMathematical Foundations of Computer Science, Lecture Notes in Computer Science 45, Springer-Verlag, 1976.
Milner, A.R.J.G., ’A Theory of Type Polymorphism in Programming’,Journal of Computer and System Sciences17, 1978.
Paulson, L.C., ’A higher-order implementation of rewriting’,Science of Computer Programming3, pp 143 - 170, 1985.
Paulson, L.C., ’Natural deduction as higher-order resolution’,Journal of Logic Programming3, pp 237 - 258, 1986.
Paulson, L.C.,Logic and Computation: Interactive Proof with Cambridge LCF, Cambridge University Press, 1987.
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.
Pratt, V.R., ’Semantical Considerations on Floyd-Hoare Logic’,Proceedings of the 17th IEEE Symposium on Foundations of Computer Science, 1976.
Hayes, I. (ed.),Specification Case Studies, Prentice-Hall.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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