Pointer Program Derivation Using Coq: Graphs and Schorr-Waite Algorithm

  • Jean-François Dufourd
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8829)


We present a specification, a derivation and total correctness proofs of operations for bi-functional graphs implemented with pointers, including the Schorr-Waite algorithm. This one marks such a graph with an economical depth-first strategy. Our approach is purely algebraic and functional, from a simple graph specification to the simulation of a tail-recursive imperative program, then to a true C pointer program by elementary classical transformations. We stay in the unique higher-order formalism of the Calculus of Inductive Constructions for specifications, programs and proofs. All the development is supported by Coq.


Recursive Call Total Correctness Pointer Program Separation Logic Marked Vertex 
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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Abrial, J.-R.: Event Based Sequential Program Development: Application to Constructing a Pointer Program. In: Araki, K., Gnesi, S., Mandrioli, D. (eds.) FME 2003. LNCS, vol. 2805, pp. 51–74. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  2. 2.
    Bertot, Y., Casteran, P.: Interactive Theorem Proving and Program Development - Coq’Art: The Calculus of Inductive Constructions. Springer-Verlag (2004)Google Scholar
  3. 3.
    Bornat, R.: Proving Pointer Programs in Hoare Logic. In: Backhouse, R., Oliveira, J.N. (eds.) MPC 2000. LNCS, vol. 1837, pp. 102–126. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  4. 4.
    Broy, M., Pepper, P.: Combining Algebraic and Algorithmic Reasoning: An Approach to the Schorr-Waite Algorithm. ACM-TOPLAS 4(3), 362–381 (1982)CrossRefMATHGoogle Scholar
  5. 5.
    Bubel, R.: The schorr-waite-algorithm. In: Beckert, B., Hähnle, R., Schmitt, P.H. (eds.) Verification of Object-Oriented Software. LNCS (LNAI), vol. 4334, pp. 569–587. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  6. 6.
    Burstall, R.M.: Some techniques for proving correctness of programs which alters data structures. Machine Intelligence 7, 23–50 (1972)MATHGoogle Scholar
  7. 7.
    Chlipala, A.: Mostly-automated verification of low-level programs in computational separation logic. In: PLDI, pp. 234–245 (2011)Google Scholar
  8. 8.
    de Roever, W.-P.: On Backtracking and Greatest Fixpoints. In: Salomaa, A., Steinby, M. (eds.) ICALP 1977. LNCS, vol. 52, pp. 412–429. Springer, Heidelberg (1977)CrossRefGoogle Scholar
  9. 9.
    Dershowitz, N.: The Schorr-Waite Marking Algorithm Revisited. Inf. Proc. Lett. 11(3), 141–143 (1980)MathSciNetCrossRefMATHGoogle Scholar
  10. 10.
    Dufourd, J.-F.: Polyhedra genus theorem and Euler formula: A hypermap-formalized intuitionistic proof. Theor. Comp. Sci. 403(2-3), 133–159 (2008)MathSciNetCrossRefMATHGoogle Scholar
  11. 11.
    Dufourd, J.-F.: Dérivation de l’algorithme de Schorr-Waite en Coq par une méthode algébrique. In: JFLA 2012, INRIA (2012), http://hal.inria.fr/hal-00665909
  12. 12.
    Dufourd, J.-F.: Schorr-Waite Coq Development On-line Documentation (2013), http://dpt-info.u-strasbg.fr/~jfd/SW-LIB-PUBLI.tar.gz
  13. 13.
    Dufourd, J.-F.: Formal Study of Functional Orbits in Finite Domains, 35 pages (2013) (submitted)Google Scholar
  14. 14.
    Dufourd, J.-F.: Hypermap specification and certified linked implementation using orbits. In: Klein, G., Gamboa, R. (eds.) ITP 2014. LNCS, vol. 8558, pp. 242–257. Springer, Heidelberg (2014)CrossRefGoogle Scholar
  15. 15.
    Giorgino, M., Strecker, M., Matthes, R., Pantel, M.: Verification of the schorr-waite algorithm – from trees to graphs. In: Alpuente, M. (ed.) LOPSTR 2010. LNCS, vol. 6564, pp. 67–83. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  16. 16.
    Filliâtre, J.-C.: Verifying two lines of C with why3: An exercise in program verification. In: Joshi, R., Müller, P., Podelski, A. (eds.) VSTTE 2012. LNCS, vol. 7152, pp. 83–97. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  17. 17.
    Gerhardt, S.L.: A derivation-oriented proof of the Schorr-Waite algorithm. In: Gerhart, S.L., et al. (eds.) Program Construction. LNCS, vol. 69, pp. 472–492. Springer, Heidelberg (1979)CrossRefGoogle Scholar
  18. 18.
    Gonthier, G.: Formal Proof - The Four-Color Theorem. Notices of the AMS 55(11), 1382–1393 (2008)MathSciNetMATHGoogle Scholar
  19. 19.
    Gries, D.: The Schorr-Waite Graph Marking Algorithm. Acta Informatica 11, 223–232 (1979)CrossRefMATHGoogle Scholar
  20. 20.
    Griffiths, M.: Development of the Schorr-Waite algorithm. In: Gerhart, S.L., Pair, C., Pepper, P.A., Wössner, H., Dijkstra, E.W., Guttag, J.V., Owicki, S.S., Partsch, H., Bauer, F.L., Gries, D., Griffiths, M., Horning, J.J., Wirsing, M. (eds.) Program Construction. LNCS, vol. 69, pp. 464–471. Springer, Heidelberg (1979)CrossRefGoogle Scholar
  21. 21.
    Hackett, B., Rugina, R.: Region-Based Shape Analysis with Tracked Locations. In: 32nd ACM POPL 2005, pp. 310–323 (2005)Google Scholar
  22. 22.
    Hubert, T., Marché, C.: A case study of C source code verification; the Schorr-Waite algorithm. In: 3rd IEEE SEFM 2005, pp. 190–199 (2005)Google Scholar
  23. 23.
    Knuth, D.E.: The Art of Computer Programming: Fundamental Algorithms, vol. I. Add. -Wesley (1968)Google Scholar
  24. 24.
    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)CrossRefGoogle Scholar
  25. 25.
    Leroy, X., Blazy, S.: Formal Verification of a C-like Memory Model and Its Uses for Verifying Program Transformations. JAR 41(1), 1–31 (2008)MathSciNetCrossRefMATHGoogle Scholar
  26. 26.
    Loginov, A., Reps, T., Sagiv, M.: Automated verification of the deutsch-schorr-waite tree-traversal algorithm. In: Yi, K. (ed.) SAS 2006. LNCS, vol. 4134, pp. 261–279. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  27. 27.
    Mehta, F., Nipkow, T.: Proving pointer programs in higher-order logic. Info. and Comp. 199(1-2), 200–227 (2005)MathSciNetCrossRefMATHGoogle Scholar
  28. 28.
    Morris, J.M.: A Proof of the Schorr-Waite Algorithm. In: TFPM, vol. 91, pp. 43–51. NATO, D. Reidel (1982)Google Scholar
  29. 29.
    Preoteasa, V., Back, R.-J.: Invariant diagrams with data refinement. FAC 24(1), 67–95 (2012)MathSciNetMATHGoogle Scholar
  30. 30.
    Reynolds, J.C.: Separation Logic: A Logic for Shared Mutable Data Structures. In: LICS 2002, pp. 55–74 (2002)Google Scholar
  31. 31.
    Schorr, H., Waite, W.R.: An Efficient Machine-Independent Procedure for Garbage Collection in Various List Structures. CACM 10(8), 501–506 (1967)CrossRefMATHGoogle Scholar
  32. 32.
    Suzuki, N.: Automatic Verification of Programs with Complex Data Structures. PhD Th., Dept. of CS, Stanford (1976)Google Scholar
  33. 33.
    Topor, R.W.: The Correctness of the Schorr-Waite List Marking Algorithm. Acta Inf. 11, 211–221 (1979)MathSciNetCrossRefMATHGoogle Scholar
  34. 34.
    Ward, M.: Derivation of Data Intensive Algorithms by Formal Transformation. IEEE-TOSE 22(9), 665–686 (1996)Google Scholar
  35. 35.
    Yang, H.: Relational separation logic. TCS 375(1-3), 308–334 (2007)CrossRefMATHGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2014

Authors and Affiliations

  • Jean-François Dufourd
    • 1
  1. 1.ICUBE LaboratoryUniversity of Strasbourg - CNRSIllkirchFrance

Personalised recommendations