Skip to main content

Reasoning about Loops in Total and General Correctness

  • Conference paper
Unifying Theories of Programming (UTP 2008)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 5713))

Included in the following conference series:

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Abrial, J.-R.: The B-Book: Assigning Programs to Meanings. Cambridge University Press, Cambridge (1996)

    Book  MATH  Google Scholar 

  2. Apt, K.R., Plotkin, G.D.: Countable nondeterminism and random assignment. Journal of the ACM 33(4), 724–767 (1986)

    Article  MATH  MathSciNet  Google Scholar 

  3. Back, R.-J., von Wright, J.: Refinement Calculus: A Systematic Introduction. Springer, New York (1998)

    MATH  Google Scholar 

  4. Cohen, E.: Separation and reduction. In: Backhouse, R., Oliveira, J.N. (eds.) MPC 2000. LNCS, vol. 1837, pp. 45–59. Springer, Heidelberg (2000)

    Chapter  Google Scholar 

  5. Conway, J.H.: Regular Algebra and Finite Machines. Chapman Hall, Boca Raton (1971)

    MATH  Google Scholar 

  6. 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)

    Chapter  Google Scholar 

  7. Dijkstra, E.W., Scholten, C.S.: Predicate Calculus and Program Semantics. Springer, Heidelberg (1990)

    MATH  Google Scholar 

  8. 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

    Google Scholar 

  9. 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

  10. 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

  11. 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

  12. Floyd, R.W.: Assigning meanings to programs. In: Proceedings of Symposia in Applied Mathematics, vol. 19, pp. 19–32 (1967)

    Google Scholar 

  13. 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)

    Chapter  Google Scholar 

  14. Hoare, C.A.R.: An axiomatic basis for computer programming. Communications of the ACM 12, 576–583 (1969)

    Article  MATH  Google Scholar 

  15. Hoare, C.A.R., Jifeng, H.: Unifying Theories of Programming. Prentice-Hall, Englewood Cliffs (1998)

    Google Scholar 

  16. Jacobs, D., Gries, D.: General correctness: a unification of partial and total correctness. Acta Informatica 22, 67–83 (1985)

    Article  MATH  MathSciNet  Google Scholar 

  17. Jones, C.B.: Systematic Software Development Using VDM, 2nd edn. Prentice-Hall, Englewood Cliffs (1990)

    MATH  Google Scholar 

  18. Kozen, D.: A completeness theorem for Kleene algebras and the algebra of regular events. Information and Computation 110, 366–390 (1994)

    Article  MATH  MathSciNet  Google Scholar 

  19. Kozen, D.: Kleene algebra with tests. ACM Transactions on Programming Languages and Systems 19, 427–443 (1999)

    Article  Google Scholar 

  20. Kozen, D.: On Kleene algebras and closed semirings. In: Rovan, B. (ed.) MFCS 1990. LNCS, vol. 452, pp. 26–47. Springer, Heidelberg (2000)

    Chapter  Google Scholar 

  21. Meinicke, L., Hayes, I.J.: Algebraic reasoning for probabilistic action systems and while-loops. Acta Informatica 45(5), 321–382 (2008)

    Article  MATH  MathSciNet  Google Scholar 

  22. 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)

    Chapter  Google Scholar 

  23. Morgan, C.C.: Programming from Specifications, 2nd edn. Prentice Hall International, Englewood Cliffs (1994)

    MATH  Google Scholar 

  24. Nelson, G.: A generalisation of Dijkstra’s calculus. ACM Transactions on Programmg Languages and Systems 11(4) (1989)

    Google Scholar 

  25. Tarski, A.: A lattice-theoretical fixpoint theorem and its applications. Pacific Journal of Mathematics 5(2), 285–309 (1955)

    MATH  MathSciNet  Google Scholar 

  26. 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)

    Chapter  Google Scholar 

  27. von Wright, J.: Towards a refinement algebra. Science of Computer Programming 51, 23–45 (2004)

    Article  MATH  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics