Abstract
We introduce a calculus for reasoning about programs in total correctness which blends UTP designs with von Wright’s notion of a demonic refinement algebra. We demonstrate its utility in verifying the familiar loop-invariant rule for refining a total-correctness specification by a while loop. Total correctness equates non-termination with completely chaotic behaviour, with the consequence that any situation which admits non-termination must also admit arbitrary terminating behaviour. General correctness is more discriminating in allowing non-termination to be specified together with more particular terminating behaviour. We therefore introduce an analogous calculus for reasoning about programs in general correctness which blends UTP prescriptions with a demonic refinement algebra. We formulate a loop-invariant rule for refining a general-correctness specification by a while loop, and we use our general-correctness calculus to verify the new rule.
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
Abrial, J.-R.: The B-Book: Assigning Programs to Meanings. Cambridge University Press, Cambridge (1996)
Apt, K.R., Plotkin, G.D.: Countable nondeterminism and random assignment. Journal of the ACM 33(4), 724–767 (1986)
Back, R.-J., von Wright, J.: Refinement Calculus: A Systematic Introduction. Springer, New York (1998)
Cohen, E.: Separation and reduction. In: Backhouse, R., Oliveira, J.N. (eds.) MPC 2000. LNCS, vol. 1837, pp. 45–59. Springer, Heidelberg (2000)
Conway, J.H.: Regular Algebra and Finite Machines. Chapman Hall, Boca Raton (1971)
Deutsch, M., Henson, M.C.: A relational investigation of UTP designs and prescriptions. In: Dunne, S.E., Stoddart, W.J. (eds.) UTP 2006. LNCS, vol. 4010, pp. 101–122. Springer, Heidelberg (2006)
Dijkstra, E.W., Scholten, C.S.: Predicate Calculus and Program Semantics. Springer, Heidelberg (1990)
Dunne, S.E.: Abstract commands: a uniform notation for specifications and implementations. In: Fidge, C.J. (ed.) Computing: The Australasian Theory Symposium 2001. Electronic Notes in Theoretical Computer Science, vol. 42. Elsevier, Amsterdam (2001), http://www.elsevier.nl/locate/entcs
Dunne, S.E.: Recasting Hoare and He’s unifying theory of programs in the context of general correctness. In: Butterfield, A., Strong, G., Pahl, C. (eds.) Proceedings of the 5th Irish Workshop in Formal Methods, IWFM 2001, Workshops in Computing. British Computer Society (2001), http://ewic.bcs.org/conferences/2001/5thformal/papers
Dunne, S.E.: Junctive compositions of specifications in Total and General Correctness. In: Derrick, J., Boiten, E., Woodcock, J.C.P., von Wright, J. (eds.) Refine 2002: The BCS FACS Refinement Workshop. Electronic Notes in Theoretical Computer Science, vol. 70(3). Elsevier Science BV (2002), http://www.elsevier.nl/locate/entcs
Dunne, S.E., Stoddart, W.J., Galloway, A.J.: Specification and refinement in general correctness. In: Evans, A., Duke, D., Clark, A. (eds.) Proceedings of the 3rd Northern Formal Methods Workshop. BCS Electronic Workshops in Computing (1998), http://www.ewic.org.uk/ewic/workshop/view.cfm/NFM-98
Floyd, R.W.: Assigning meanings to programs. In: Proceedings of Symposia in Applied Mathematics, vol. 19, pp. 19–32 (1967)
Guttmann, W., Möller, B.: Modal design algebra. In: Dunne, S.E., Stoddart, W.J. (eds.) UTP 2006. LNCS, vol. 4010, pp. 236–256. Springer, Heidelberg (2006)
Hoare, C.A.R.: An axiomatic basis for computer programming. Communications of the ACM 12, 576–583 (1969)
Hoare, C.A.R., Jifeng, H.: Unifying Theories of Programming. Prentice-Hall, Englewood Cliffs (1998)
Jacobs, D., Gries, D.: General correctness: a unification of partial and total correctness. Acta Informatica 22, 67–83 (1985)
Jones, C.B.: Systematic Software Development Using VDM, 2nd edn. Prentice-Hall, Englewood Cliffs (1990)
Kozen, D.: A completeness theorem for Kleene algebras and the algebra of regular events. Information and Computation 110, 366–390 (1994)
Kozen, D.: Kleene algebra with tests. ACM Transactions on Programming Languages and Systems 19, 427–443 (1999)
Kozen, D.: On Kleene algebras and closed semirings. In: Rovan, B. (ed.) MFCS 1990. LNCS, vol. 452, pp. 26–47. Springer, Heidelberg (2000)
Meinicke, L., Hayes, I.J.: Algebraic reasoning for probabilistic action systems and while-loops. Acta Informatica 45(5), 321–382 (2008)
Möller, B., Struth, G.: wp is wlp. In: Düntsch, I., MacCaull, W., Winter, M. (eds.) RelMiCS 2005. LNCS, vol. 3929, pp. 855–874. Springer, Heidelberg (2006)
Morgan, C.C.: Programming from Specifications, 2nd edn. Prentice Hall International, Englewood Cliffs (1994)
Nelson, G.: A generalisation of Dijkstra’s calculus. ACM Transactions on Programmg Languages and Systems 11(4) (1989)
Tarski, A.: A lattice-theoretical fixpoint theorem and its applications. Pacific Journal of Mathematics 5(2), 285–309 (1955)
von Wright, J.: From Kleene algebra to refinement algebra. In: Möller, B., Boiten, E. (eds.) MPC 2002. LNCS, vol. 2386, pp. 233–262. Springer, Heidelberg (2002)
von Wright, J.: Towards a refinement algebra. Science of Computer Programming 51, 23–45 (2004)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2010 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Dunne, S.E., Hayes, I.J., Galloway, A.J. (2010). Reasoning about Loops in Total and General Correctness. In: Butterfield, A. (eds) Unifying Theories of Programming. UTP 2008. Lecture Notes in Computer Science, vol 5713. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-14521-6_5
Download citation
DOI: https://doi.org/10.1007/978-3-642-14521-6_5
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-14520-9
Online ISBN: 978-3-642-14521-6
eBook Packages: Computer ScienceComputer Science (R0)