Functional Procedures in Higher-Order Logic
In this paper we present an approach for modelling functional procedures (as they occur in imperative programming languages) in a weakest precondition framework. Functional procedures are called inside expressions, but the body of a functional procedure is built using standard specification/programming syntax, including nondeterminism, sequential composition, conditionals and loops. We integrate our theory of functional procedures into the existing mechanisation of the refinement calculus in the HOL system. To make formal reasoning possible, we derive correctness rules for functional procedures and their calls. We also show how recursive functional procedures can be handled according to our approach. Finally, we provide a nontrivial example of reasoning about a recursive procedure for binary search.
KeywordsFunction Call Choice Operator Weak Precondition Predicate Transformer Hoare Logic
Unable to display preview. Download preview PDF.
- 1.R.J. Back and J. von Wright Refinement Calculus: A Systematic introduction. Springer-Verlag, 1998.Google Scholar
- 2.G. Collins. A Proof Tool for Reasoning about Functional Programs. In Proc. 1996 International Workshop on Higher Order Logic Theorem Proving, Lecture Notes in Computer Science 1125, Turku, Finland, August 1996. Springer-Verlag.Google Scholar
- 3.M.J. Butler and J. Grundy and T. Långbacka and R. Rukšėnas and J. von Wright The Refinement Calculator: Proof Support for Program Refinement. Proc. FMP’97 — Formal Methods Pacific, Wellington, New Zealand, July 1997. Springer-Verlag.Google Scholar
- 4.E.W. Dijkstra A Discipline of Programming. Prentice-Hall international, 1976.Google Scholar
- 5.L. Laibinis. Mechanising procedures in HOL. Technical Report No.253, Turku Centre for Computer Science, 1999.Google Scholar
- 6.B. Mahony. Expression Refinement in Higher Order Logic. In Proc. 1998 International Refinement Workshop and Formal Methods Pacific, Discrete Mathematics and Theoretical Computer Science, Springer-Verlag, 1998.Google Scholar
- 8.M. Norrish. C formalised in HOL. PhD thesis, University of Cambridge, 1998.Google Scholar
- 9.M. Schwenke and K. Robinson. What If? In Second Australian Refinement Workshop, 1992.Google Scholar
- 10.K. Slind. Function Definition in Higher-Order Logic. In Proc. 1996 International Workshop on Higher Order Logic Theorem Proving, Lecture Notes in Computer Science 1125, Turku, Finland, August 1996. Springer-Verlag.Google Scholar
- 11.J. von Wright. Verifying Modular Programs in HOL. Technical Report No.324, Computer Laboratory of University of Cambridge, 1994.Google Scholar
- 12.J. von Wright. Program Refinement by Theorem Prover. Proc. 6th Refinement Workshop, London, January 1994. Springer-Verlag.Google Scholar