Abstract
This paper describes a formalization of the weakest precondition, wp, for general recursive programs using the type-theoretical proof assistant Coq. The formalization is a deep embedding using the computational power intrinsic to type theory. Since Coq accepts only structural recursive functions, the computational embedding of general recursive programs is non-trivial. To justify the embedding, an operational semantics is defined and the equivalence between wp and the operational semantics is proved. Three major healthiness conditions, namely: Strictness, Monotonicity and Conjunctivity are proved as well.
The work in this paper is sponsored by the EPSRC project GUSTT.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
R. J. R. Back. A calculus of refinements for program derivations. Acta Informatica, 25(6):593–624, August 1988.
B. Barras, S. Boutin, C. Cornes, J. Courant, J.C. Filliatre, E. Giménez, H. Herbelin, G. Huet, C. Mu noz, C. Murthy, C. Parent, C. Paulin, A. Saïbi, and B. Werner. The Coq Proof Assistant Reference Manual-Version V6.1. Technical Report 0203, INRIA, August 1997.
D. Carrington, I. Hayes, R. Nickson, G. Watson, and J. Welsh. Refinement in Ergo. Technical report 94-44, Software Verification Research Centre, School of Information Technology, The University of Queensland, Brisbane 4072. Australia, November 1994.
T. Coquand and G. Huet. The Calculus of Constructions. Information and Computation, 76:96–120, 1988.
E. W. Dijkstra. A Discipline of Programming. Prentice-Hall, 1976.
J.-C. Filliâtre. Proof of Imperative Programs in Type Theory. In International Workshop, TYPES’ 98, Kloster Irsee, Germany, volume 1657 of Lecture Notes in Computer Science. Springer-Verlag, March 1998.
T. Kleymann. Hoare Logic and VDM: M achine-Checked Soundness and Completeness Proofs. Ph.D. thesis, University of Edinburgh, 1998.
J. Knappmann. A PVS based tool for developing programs in the refinement calculus. Marster’s Thesis, Christian-Albrechts-University, 1996.
L. Laibinis and J. von Wright. Functional procedures in higher-order logic. Technical Report TUCS-TR-252, Turku Centre for Computer Science, Finland, March 15, 1999.
L. Lindqvist. A formalization of Dijkstra’s predicate transformer wp in Martin-Lof type theory. Master’s Thesis, Linkopin University, Sweden, 1997.
Z. Luo. Computation and Reasoning: A Type Theory for Computer Science. Number 11 in International Series of Monographs on Computer Science. Oxford University Press, 1994.
C. Morgan. The specification statement. ACM Transactions on Programming Languages and Systems, 10(3):403–419, July 1988.
J. M. Morris. A theoretical basis for stepwise refinement and the programming calculus. Science of Computer Programming, 9(3):287–306, December 1987.
T. Nipkow. Winskel is (almost) right: Towards a mechanized semantics textbook. In V. Chandru and V. Vinay, editors, Proceedings of the Conference on Foundations of Software Technology and Theoretical Computer Science, pages 180–192. Springer-Verlag LNCS 1180, 1996.
B. Nordström, K. Peterson, and J. M. Smith. Programming in Martin-Lof’s Type Theory, volume 7 of International Series of Monographs on Computer Science. Oxford University Press, New York, NY, 1990.
R. J. R. Back and J. von Wright. Refinement concepts formalized in higher-order logic. Reports on Computer Science & Mathematics Series A—85, Institutionen för Informationsbehandling & Mathematiska Institutet, Åbo Akademi, Lemmink:ainengatan 14, SF-20520 Turku, Finland, September 1989.
M. Staples. A Mechanised Theory of Refinement. Ph.D. Dissertation, Computer Laboratory, University of Cambridge, 1998.
M. Staples. Program transformations and refinements in HOL. In Y. Bertot G. Dowek, C. Paulin, editor, TPHOLs: The 12th International Conference on Theorem Proving in Higher-Order Logics. LNCS, Springer-Verlag., 1999.
J. von Wright and K. Sere. Program transformations and refinements in HOL. In Myla Archer, Jennifer J. Joyce, Karl N. Levitt, and Phillip J. Windley, editors, Proceedigns of the International Workshop on the HOL Theorem Proving System and its Applications, pages 231–241, Los Alamitos, CA, USA, August 1992. IEEE Computer Society Press.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Copyright information
© 2002 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Zhang, X., Munro, M., Harman, M., Hu, L. (2002). Weakest Precondition for General Recursive Programs Formalized in Coq. In: Carreño, V.A., Muñoz, C.A., Tahar, S. (eds) Theorem Proving in Higher Order Logics. TPHOLs 2002. Lecture Notes in Computer Science, vol 2410. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45685-6_22
Download citation
DOI: https://doi.org/10.1007/3-540-45685-6_22
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-44039-0
Online ISBN: 978-3-540-45685-8
eBook Packages: Springer Book Archive