Correctness-by-Construction and Post-hoc Verification: A Marriage of Convenience?

  • Bruce W. WatsonEmail author
  • Derrick G. Kourie
  • Ina Schaefer
  • Loek Cleophas
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9952)


Correctness-by-construction (CbC), traditionally based on weakest precondition semantics, and post-hoc verification (PhV) aspire to ensure functional correctness. We argue for a lightweight approach to CbC where lack of formal rigour increases productivity. In order to mitigate the risk of accidentally introducing errors during program construction, we propose to complement lightweight CbC with PhV. We introduce lightweight CbC by example and discuss strength and weaknesses of CbC and PhV and their combination, both conceptually and using a case study.


Refinement Step Sorting Algorithm Functional Correctness Program Verification Infinite Loop 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.



This work was partially supported by the DFG (German Research Foundation) under grant SCHA1635/2-2, and by the NRF (South African National Research Foundation) under grants 81606 and 93063.


  1. 1.
    Beck, K.: Extreme Programming Explained: Embrace Change. Addison-Wesley Longman Publishing Co. Inc., Boston (2000)Google Scholar
  2. 2.
    Hall, A., Chapman, R.: Correctness by construction: developing a commercial secure system. Softw. IEEE 19(1), 18–25 (2002)CrossRefGoogle Scholar
  3. 3.
    Beckert, B., Hähnle, R.: Reasoning and verification. IEEE Intell. Syst. 29(1), 20–29 (2014)CrossRefGoogle Scholar
  4. 4.
    Beckert, B., Hähnle, R., Schmitt, P.H. (eds.): Verification of Object-Oriented Software: The KeY Approach. LNCS, vol. 4334. Springer, Heidelberg (2007)Google Scholar
  5. 5.
    Jacobs, B., Smans, J., Philippaerts, P., Vogels, F., Penninckx, W., Piessens, F.: VeriFast: a powerful, sound, predictable, fast verifier for C and Java. In: Havelund, K., Holzmann, G.J., Joshi, R., Bobaru, M. (eds.) NFM 2011. LNCS, vol. 6617, pp. 41–55. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  6. 6.
    Barnett, M., M. Leino, K.R., 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)CrossRefGoogle Scholar
  7. 7.
    Filliâtre, J.-C., Marché, C.: The why/krakatoa/caduceus platform for deductive program verification. In: Damm, W., Hermanns, H. (eds.) CAV 2007. LNCS, vol. 4590, pp. 173–177. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  8. 8.
    Dijkstra, E.W.: A Discipline of Programming. Prentice Hall, Upper Saddle River (1976)zbMATHGoogle Scholar
  9. 9.
    Gries, D.: The Science of Programming. Springer, Heidelberg (1987)zbMATHGoogle Scholar
  10. 10.
    Cohen, E.: Programming in the 1990s: An Introduction to the Calculation of Programs. Springer, Heidelberg (1990)CrossRefzbMATHGoogle Scholar
  11. 11.
    Morgan, C.: Programming from Specifications, 2nd edn. Prentice Hall, Upper Saddle River (1994)zbMATHGoogle Scholar
  12. 12.
    Kourie, D.G., Watson, B.W.: The Correctness-by-Construction Approach to Programming. Springer, Heidelberg (2012)CrossRefzbMATHGoogle Scholar
  13. 13.
    Chapman, R.: Correctness by construction: a manifesto for high integrity software. In: Proceedings of the 10th Australian Workshop on Safety Critical Systems and Software. SCS 2005, vol. 55, pp. 43–46(2006)Google Scholar
  14. 14.
    Abrial, J.: Modeling in Event-B - System and Software Engineering. Cambridge University Press, Cambridge (2010)CrossRefzbMATHGoogle Scholar
  15. 15.
    Méry, D., Monahan, R.: Transforming event B models into verified C# implementations. In: First International Workshop on Verification and Program Transformation, VPT 2013, Saint Petersburg, Russia, 12–13 July 2013, pp. 57–73 (2013)Google Scholar
  16. 16.
    Cheng, Z., Mery, D., Monahan, R.: On two friends for getting correct programs - automatically translating event-B specifications to recursive algorithms in Rodin. In: Margaria, T., Steffen, B. (eds.) ISoLA 2016. LNCS, vol. 9953, pp. 821–838. Springer, Heidelberg (2016)Google Scholar
  17. 17.
    Lamprecht, A., Margaria, T., Schaefer, I., Steffen, B.: Synthesis-based variability control: correctness by construction. In: Formal Methods for Components and Objects, 10th International Symposium, pp. 69–88. Revised Selected Papers (2011)Google Scholar
  18. 18.
    ter Beek, M., Reniers, M., de Vink, E.: Supervisory controller synthesis for product lines using CIF 3. In: Margaria, T., Steffen, B. (eds.) ISoLA 2016. LNCS, vol. 9953, pp. 856–873. Springer, Heidelberg (2016)Google Scholar
  19. 19.
    ter Beek, M., Carmona, J., Kleijn, J.: Conditions for compatibility of components - the case of masters and slaves. In: Margaria, T., Steffen, B. (eds.) ISoLA 2016. LNCS, vol. 9953, pp. 784–805. Springer, Heidelberg (2016)Google Scholar
  20. 20.
    Cleophas, L., Kourie, D.G., Pieterse, V., Schaefer, I., Watson, B.W.: Correctness-by-construction \(\wedge \) taxonomies \(\Rightarrow \) deep comprehension of algorithm families. In: Margaria, T., Steffen, B. (eds.) ISoLA 2016. LNCS, vol. 9953, pp. 766–783. Springer, Heidelberg (2016)Google Scholar
  21. 21.
    ter Beek, M., Hähnle, R., Schaefer, I.: Correctness-by-construction and post-hoc verification - friends or foes? In: Margaria, T., Steffen, B. (eds.) ISoLA 2016. LNCS, vol. 9953, pp. 723–729. Springer, Heidelberg (2016)Google Scholar
  22. 22.
    Lagarias, J.C.: The 3x + 1 problem and its generalizations. IEEE Intell. Syst. 92(1), 3–23 (1985)MathSciNetzbMATHGoogle Scholar
  23. 23.
    Hoare, C.A.R.: Algorithm 64: quicksort. Commun. ACM 4(7), 321 (1961)CrossRefGoogle Scholar
  24. 24.
    Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms, 3rd edn. MIT Press, Cambridge (2009)zbMATHGoogle Scholar
  25. 25.
    Burdy, L., Cheon, Y., Cok, D.R., Ernst, M.D., Kiniry, J.R., Leavens, G.T., Leino, K.R.M., Poll, E.: An overview of JML tools and applications. Commun. ACM 7(3), 212–232 (2005)Google Scholar
  26. 26.
    Voelter, M., Benz, S., Dietrich, C., Engelmann, B., Helander, M., Kats, L., Visser, E., Wachsmuth, G.: DSL Engineering - Designing, Implementing and Using Domain-Specific Languages (2013).

Copyright information

© Springer International Publishing AG 2016

Authors and Affiliations

  • Bruce W. Watson
    • 1
    • 2
    Email author
  • Derrick G. Kourie
    • 1
    • 2
  • Ina Schaefer
    • 3
  • Loek Cleophas
    • 1
    • 4
  1. 1.Department of Information ScienceStellenbosch UniversityStellenboschSouth Africa
  2. 2.Centre for Artificial Intelligence ResearchCSIR Meraka InstitutePretoriaSouth Africa
  3. 3.Technische Universität Braunschweig, Software Engineering InstituteBraunschweigGermany
  4. 4.Technische Universiteit Eindhoven, Software Engineering and Technology GroupEindhovenThe Netherlands

Personalised recommendations