Skip to main content

Proofs and Refutations in Invariant-Based Programming

  • Conference paper
Integrated Formal Methods (IFM 2014)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 8739))

Included in the following conference series:

  • 706 Accesses

Abstract

Invariant-based programming is a correct-by-construction approach to program development in which the invariants of a program are written before the actual code. Socos is an environment for graphically constructing invariant-based programs (as statechart-like diagrams) and verifying their correctness (by invoking an automatic theorem prover). It borrows the specification language, logical framework and proof tactics from the PVS system. In this paper, we describe an extension to Socos for animating invariant-based programs in the logical framework of PVS. An invariant-based program is represented as an abstract datatype encoding the program state coupled a small-step state transition function encoding the operational semantics of the program. Socos visualizes the execution, allowing the user to inspect the current state and identify invalid assertions through test cases. Since programs are executed within the theorem prover framework (rather than translated into another language or compiled to machine code), failed test cases are logically sound refutations of the verification conditions. Invariants not executable in the general (e.g., containing unbounded quantification) can be handled for bounded test cases by introducing custom evaluation functions. While such functions provide no correctness guarantees, they can increase the assurance of a correctness condition before doing the actual proof. We illustrate this workflow through a verification exercise with non-trivial verification conditions, arguing that animation of invariant diagrams serves as an important stepping stone towards a fully verified program.

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

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

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.

Similar content being viewed by others

References

  1. Abrial, J.R., Butler, M., Hallerstede, S., Hoang, T.S., Mehta, F., Voisin, L.: Rodin: an open toolset for modelling and reasoning in Event-B. Int. J. Softw. Tools Technol. Transf. 12(6), 447–466 (2010)

    Article  Google Scholar 

  2. Abrial, J.-R., Hoang, T.S.: Using design patterns in formal methods: An event-B approach. In: Fitzgerald, J.S., Haxthausen, A.E., Yenigun, H. (eds.) ICTAC 2008. LNCS, vol. 5160, pp. 1–2. Springer, Heidelberg (2008)

    Chapter  Google Scholar 

  3. Ahrendt, W., Baar, T., Beckert, B., Bubel, R., Giese, M., Hähnle, R., Menzel, W., Mostowski, W., Roth, A., Schlager, S., Schmitt, P.H.: The KeY tool. Software and System Modeling 4, 32–54 (2005)

    Article  Google Scholar 

  4. Back, R.J.: Invariant based programs and their correctness. In: Biermann, W., Guiho, G., Kodratoff, Y. (eds.) Automatic Program Construction Techniques, pp. 223–242. MacMillan Publishing Company (1983)

    Google Scholar 

  5. Back, R.J.: Invariant based programming: Basic approach and teaching experiences. Formal Aspects of Computing 21(3), 227–244 (2009)

    Article  MATH  Google Scholar 

  6. Back, R.J., Eriksson, J., Mannila, L.: Teaching the construction of correct programs using invariant based programming. In: 3rd South-East European Workshop on Formal Methods (SEEFM 2007). South-East European Research Centre (2007)

    Google Scholar 

  7. Back, R.J., Eriksson, J., Myreen, M.: Testing and verifying invariant based programs in the SOCOS environment. In: Gurevich, Y., Meyer, B. (eds.) TAP 2007. LNCS, vol. 4454, pp. 61–78. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  8. Back, R.J., Preoteasa, V.: Semantics and proof rules of invariant based programs. In: Proceedings of the 2011 ACM Symposium on Applied Computing. ACM (2011)

    Google Scholar 

  9. Barnett, M., Leino, K.R.M., Schulte, W.: The Spec# programming system: An overview. In: Barthe, G., Burdy, L., Huisman, M., Lanet, J.-L., Muntean, T. (eds.) CASSIS 2004. LNCS, vol. 3362, pp. 49–69. Springer, Heidelberg (2005)

    Google Scholar 

  10. Crow, J., Owre, S., Rushby, J., Shankar, N., Stringer-Calvert, D.: Evaluating, testing, and animating PVS specifications. Tech. rep., Computer Science Laboratory, SRI International (March 2001)

    Google Scholar 

  11. Cuoq, P., Kirchner, F., Kosmatov, N., Prevosto, V., Signoles, J., Yakobowski, B.: Frama-C: a software analysis perspective. In: Eleftherakis, G., Hinchey, M., Holcombe, M. (eds.) SEFM 2012. LNCS, vol. 7504, pp. 233–247. Springer, Heidelberg (2012)

    Chapter  Google Scholar 

  12. Dutertre, B., de Moura, L.: The Yices SMT solver. Tech. rep., Computer Science Laboratory, SRI International, Menlo Park, CA (August 2006)

    Google Scholar 

  13. van Emden, M.H.: Programming with verification conditions. IEEE Transactions on Software Engineering 5(2), 148–159 (1979)

    Article  MATH  Google Scholar 

  14. Eriksson, J.: Tool-Supported Invariant-Based Programming. Ph.d. thesis, Turku Centre for Computer Science, Finland (2010)

    Google Scholar 

  15. Jackson, D.: Alloy: A lightweight object modelling notation. ACM Trans. Softw. Eng. Methodol. 11(2), 256–290 (2002)

    Article  Google Scholar 

  16. Leino, K.R.M.: Dafny: An automatic program verifier for functional correctness. In: Clarke, E.M., Voronkov, A. (eds.) LPAR-16 2010. LNCS, vol. 6355, pp. 348–370. Springer, Heidelberg (2010)

    Chapter  Google Scholar 

  17. Leuschel, M., Butler, M.: ProB: A model checker for B. In: Araki, K., Gnesi, S., Mandrioli, D. (eds.) FME 2003. LNCS, vol. 2805, pp. 855–874. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

  18. Muñoz, C.: Rapid prototyping in PVS. Contractor Report NASA/CR-2003-212418, NASA, Langley Research Center, Hampton VA 23681-2199, USA (May 2003)

    Google Scholar 

  19. Owre, S., Rushby, J.M., Shankar, N.: PVS: A prototype verification system. In: Kapur, D. (ed.) CADE 1992. LNCS, vol. 607, pp. 748–752. Springer, Heidelberg (1992)

    Google Scholar 

  20. Owre, S.: A brief overview of the PVS user interface. In: 8th International Workshop User Interfaces for Theorem Provers (UITP 2008) (August 2008)

    Google Scholar 

  21. Preoteasa, V., Back, R.J., Eriksson, J.: Verification and code generation for invariant diagrams in Isabelle. The Journal of Logic and Algebraic Programming, http://www.sciencedirect.com/science/article/pii/S1567832613000441 (in press)

  22. Reynolds, J.C.: Programming with transition diagrams. In: Gries, D. (ed.) Programming Methodology, pp. 153–165. Springer (1978)

    Google Scholar 

  23. Sam, O., Natarajan, S.: Abstract datatypes in PVS. Tech. rep., Computer Science Laboratory, SRI International (1997)

    Google Scholar 

  24. Shankar, N.: Efficiently executing PVS. Tech. rep., Computer Science Laboratory, SRI International (1999)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Johannes Eriksson .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2014 Springer International Publishing Switzerland

About this paper

Cite this paper

Eriksson, J., Parsa, M., Back, RJ. (2014). Proofs and Refutations in Invariant-Based Programming. In: Albert, E., Sekerinski, E. (eds) Integrated Formal Methods. IFM 2014. Lecture Notes in Computer Science(), vol 8739. Springer, Cham. https://doi.org/10.1007/978-3-319-10181-1_12

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-10181-1_12

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-10180-4

  • Online ISBN: 978-3-319-10181-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics